3

I have an EBS volume that is 800GB and I am using only 5GB of this. I want to shrink it but AWS doesn't support this, after a bit of a research, I have found that I can mount both volumes and rsync the content of the bigger one to the new one. This should work considering I have a data volume. While in my case, this is a root volume (mounted at "/"). So rsync didn't work.

I have tried to mount both volumes to a different EC2 instance (so I can avoid having the big volume mounted "/") but I couldn't mount it.

root@****:~# lsblk
NAME    MAJ:MIN RM    SIZE RO TYPE MOUNTPOINT
xvda    202:0    0      8G  0 disk
├─xvda1 202:1    0 1007.5K  0 part
└─xvda2 202:2    0      8G  0 part /
xvdf    202:80   0     10G  0 disk
xvdg    202:96   0    800G  0 disk
├─xvdg1 202:97   0 1007.5K  0 part
└─xvdg2 202:98   0    200G  0 part
root@****:~# sudo file -s /dev/xvdf
/dev/xvdf: Linux rev 1.0 ext4 filesystem data, UUID=ad182c34-1f1f-440b-af0b-3aa94ae57f71 (extents) (large files) (huge files)
root@****:~# sudo file -s /dev/xvdg
/dev/xvdg: DOS/MBR boot sector, extended partition table (last)
root@****:~# mkdir new old
root@****:~# mount /dev/xvdf new
root@****:~# mount /dev/xvdg old
mount: wrong fs type, bad option, bad superblock on /dev/xvdg,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

Is there a way I can mirror everything in the big partition to the small one including file system and DOS/MBR boot sector?

Mahmoud Khateeb
  • 141
  • 1
  • 1
  • 11

0 Answers0