How to Resize a Linux Cloud Disk Size After an Upgrade
This article was written to outline the steps required to resize the disk space on a Codero Cloud instance that had previously been upgraded to a larger size. Please be aware that Codero has moved to using LVM partioning in Codero Cloud instances, so there are now two different paths to successfully resize a Codero Cloud disk after an upgrade.
A Codero Cloud account
A running Codero Cloud instance that had previously been upgraded to a larger size
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.
Resize the disk (pre-LVM Codero Cloud instances)
Resize the disk using the resize2fs command.
Resize 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.