I created a KVM virtual machine in a 10-G logical volume using Vm-manager. I later expanded the logical volume to 30G. Now I want to resize the / partition that's inside the logical volume to occupy the new space. Here's what I have:
The / partition (with ext4 filesystem) is mountable on the host with the correct offsets, but not directly as "/dev/VG1/vm-Dev1". Resize2fs run on the host system does not work directly on the logical volume, no doubt because the volume contains more than one partition. From within the running VM, I probably could manipulate the partition table to remove the swap partition and recreate it at the end of the volume, then resize the / partition to fill the remaining space, while mounted.
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
vm-Dev VG1 -wi-a--- 30.00g
# fdisk -l /dev/VG1/vm-Dev
Disk /dev/VG1/vm-Dev: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders, total 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009acb7
Device Boot Start End Blocks Id System
/dev/VG1/vm-Dev1 * 2048 18382847 9190400 83 Linux
/dev/VG1/vm-Dev2 18384894 20477951 1046529 5 Extended
/dev/VG1/vm-Dev5 18384896 20477951 1046528 82 Linux swap / Solaris
My question is whether there is a way to do this without starting up the vm, i.e. directly on the logical volume contents from the host?