Increase CentOS 7 Disk Size
One of my VMs filled up the root filesystem today so I had to remember how to fix it.
- Shutdown the VM and increase the size of the disk image using VSphere or XenCenter or whatever.
- Boot the VM off the CentOS ISO and choose the “Troubleshooting” then “Rescue a CentOS Linux system” options. Once it boots, choose the “Skip to shell” option to get to a prompt.
- Recreate the partition. Run
fdisk /dev/xvda, delete partition 2 and recreate it using the defaults. It should start at the same point as the original and end and the end of the disk now. Write the new partitions and quit.
pvresize /dev/xvdato resize the PV
vgchange -ayto update the mapper
lvresize -l +100%FREE /dev/centos_dev/rootto resize the LV
xfs_repair /dev/mapper/centos_dev-rootthe check the FS
- Reboot the machine then