Decrease the size of an EBS Volume in AWS

decrease-ebs

At this point you there is no way to decrease the size of an EBS volume from the AWS panel and you will have to do it manually.

To get started create a new volume in the AWS panel and attach it to your instance

Format the disk

[ubuntu ~]$ sudo mkfs -t ext4 /dev/smalldrive

Create a temporary folder and mount the new disk

[ubuntu ~]$ sudo mkdir /path/to/temp/folder
[ubuntu ~]$ sudo mount /dev/smalldrive /path/to/temp/folder

Copy the files from the old disk into the new one

[ubuntu ~]$ sudo rsync -aHAXxSP /path/to/folder/ /path/to/temp/folder

Unmount both drives

[ubuntu ~]$ sudo umount /dev/largedrive
[ubuntu ~]$ sudo umount /dev/smalldrive

Mount the new (small) drive on the old folder

[ubuntu ~]$ sudo mount /dev/smalldrive /path/to/folder

Update fstab so the new disk gets mounted after restarting the instance

[ubuntu ~]$ sudo vim /etc/fstab
/dev/xvdg /path/to/folder ext4 defaults 0 1

**Don’t forget to remove the entry for the old (large) drive**

Finally, remove the old disk from the AWS panel