-1

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 xvda virtual disk on XenServer - check.
  • Create xvdaN as LVM on CentOS guest using fdisk - check.
  • pvcreate /dev/xvdaN on CentOS guest - check.
  • vgextend VolGroup /dev/xvdaN on CentOS guest - check.
  • lvresize --extents /dev/mapper/VolGroup-lv_root on 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?

Etan Reisner
  • 77,877
  • 8
  • 106
  • 148
  • I believe you can extend a live partition safely. – Etan Reisner Dec 19 '14 at 17:31
  • 1
    Thanks, Etan. I was considering taking a snapshot of the VM and then attempting to resize online. However, I've just run across the command "vgchange -aay" which should activate the volume group when booting from the LiveCD. So, that will be my first attempt. Failing that, I will attempt to resize online. – Statler Waldorf Dec 19 '14 at 18:47

1 Answers1

1

Eventually found the answer online...

  1. Boot from LiveCD
  2. Open a terminal
  3. sudo su -l Switch user to root
  4. vgchange -aay This is the magic. It will automatically find and activate existing volume groups.
  5. e2fsck -f /dev/mapper/VolGroup-lv_root Force check the volume for errors
  6. resize2fs /dev/mapper/VolGroup-lv_root Add available space to volume
  7. e2fsck -f /dev/mapper/VolGroup-lv_root Force check the volume for errors
  8. reboot

...and viola, the root volume is now using the additional available space.