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.
- Run
pvresize /dev/xvdato resize the PVvgscanandvgchange -ayto update the mapperlvresize -l +100%FREE /dev/centos_dev/rootto resize the LVxfs_repair /dev/mapper/centos_dev-rootto check the FS- Reboot the machine then
xfs_growfs dev/mapper/centos_dev-root