4
Oct
Although my migration attempt cross different regions failed,
I successfully shrink the os volume from 8G to 4G. Here is how:
- snapshot the running os volume
- create a new volume use the snapshot, and attach to /dev/big
- create an empty volume with smaller size, and attach to /dev/small
- operate on the big volume
e2fsck -f /dev/big resize2fs -M -p /dev/big # the command above shrink the volume - mirror the content from the big to the small volume
dd if=/dev/big ibs=16M of=/dev/small obs=16M count=128 # count needs to be adjusted; mine was 415315 4k block, which was about 101 16M block resize2fs -p /dev/small # the command above expand the volume to full space e2fsck -f /dev/small - stop the running instance, replace the os volume with the small and all set

Leave a Reply