Resizing Disk - increasing the size

We sometimes resize disks in AWS at Togai. We do this manually. Below is the guide for the same. We only talk about how to increase the size of a disk, not decrease

Follow these steps to increase the size of a disk/volume

  1. Do all the steps with the volume attached to the running EC2 instance. All the volumes we use support resizing (increasing the size) of volume while its attached to the running EC2 instance. Do check if there are any programs running in the EC2 instance that are dependent on the volume and if it will get affected due to the online resizing of the volume i.e. resizing when its attached to the EC2 instance and the EC2 instance is up and running

  2. Find the volume that needs to be resized in AWS Web Console

  3. Click on Modify to modify the volume size

  4. Provide the new volume size - greater than the current volume size and then save changes

  5. Once done, monitor the volume status of the volume to understand and monitor the progress of the volume resize

  6. Once the volume shows that its in use and that its not in modifying state (its probably moved on to optimizing state / completed 儭 state), follow the below steps

  7. Find out the hypervisor type of the instance. Usually, all the instances we use are Nitro instances. If not sure, use the below command to find out

aws ec2 describe-instance-types --instance-type <instance_type> --query "InstanceTypes[].Hypervisor"
  1. SSH into the EC2 instance that the volume is attached to

  2. Use the following command to find the mount point of the volume and ensure it has no partitions (type part) in it / under it

sudo lsblk
  1. If the volume has partitions, follow or else move on to the next step

  2. Use df -HT to know the file system type, size, mount point and usage

  3. For xfs (XFS) file system, use the following command to resize

sudo xfs_growfs -d <mount-point>

# for example

sudo xfs_growfs -d /blah-mount-point
  1. Use df -HT again to check if the resize succeeded