Resize a Linux Cloud Disk Size After an Upgrade

Log In

Log into your cloud instance as root using SSH.


Verify upgraded size

You can verify the size of the drive had been upgraded by running fdisk.


Notice: If you see this output, you are using a pre-LVM Codero Cloud instance.


Notice: If you see this output, you are using a LVM Codero Cloud instance.

Verify current disk 

Check the current size of the disk by running the df (disk free) command.

resizedisk2.jpgResize the disk (pre-LVM Codero Cloud instances)

Resize the disk using the resize2fs command.

resizedisk4.jpgResize the disk (LVM Codero Cloud instance)

1. Run fdisk /dev/xvda.
2. Create a new partition (n). Make it primary (p). The start and end should be the defaults provided by fdisk.
2. Write the changes (w).
4. Reboot the VM so the kernel picks up the partition changes.
5. Run pvcreate /dev/xvda3 to make /dev/xvda3 a LVM partition.
6. Determine your vgname by running vgdisplay. It should be one of debian, ubuntu, redhat, fedora, oracle.
7. Run vgextend vgname /dev/xvda3 to add /dev/xvda3 to the vgname volume group. Remember to substitue the correct name discoverd in step 6 for vgname.
8. Run lvresize -r -l +100%FREE vgname/root to resize the / partition. Remember to substitute the correct name discovered in step 6 for vgname.
9. Run df -H. You should now see the increased size on the / partition.