All the preparations to grow the ext4 root LVM partition on CentOS 6.6 64-bit running on XenServer 6.2 have been completed.
- Grow the
xvdavirtual disk on XenServer - check. - Create
xvdaNas LVM on CentOS guest using fdisk - check. pvcreate /dev/xvdaNon CentOS guest - check.vgextend VolGroup /dev/xvdaNon CentOS guest - check.lvresize --extents /dev/mapper/VolGroup-lv_rooton CentOS guest - check.
Now I need to resize2fs /dev/mapper/VolGroup-lv_root. Here's the problem.
It's the root volume. My understanding is that it cannot be resized while the VM is running - lest we corrupt the volume. However, the volume is not recognized when I boot from the CentOS 6.5 LiveCD iso (there is no 6.6 LiveCD.)
So, how do I resize2fs a logical volume that cannot be touched with the VM running, and isn't recognized when the VM is not running?
Eventually found the answer online...
sudo su -lSwitch user to rootvgchange -aayThis is the magic. It will automatically find and activate existing volume groups.e2fsck -f /dev/mapper/VolGroup-lv_rootForce check the volume for errorsresize2fs /dev/mapper/VolGroup-lv_rootAdd available space to volumee2fsck -f /dev/mapper/VolGroup-lv_rootForce check the volume for errorsreboot...and viola, the root volume is now using the additional available space.