Online resizing of kvm guest root filesystem?

Posted by Bittrance on Server Fault See other posts from Server Fault or by Bittrance
Published on 2014-06-13T10:00:59Z Indexed on 2014/08/23 4:22 UTC
Read the original article Hit count: 358

Filed under:
|
|

I have a Linux guest that uses an LVM volume directly as root file system (that is, there is no partition table). libvirt config looks thus:

<os>
  <type arch='x86_64' machine='rhel6.4.0'>hvm</type>
  <kernel>/boot/vmlinuz-X.Y.Z.el6.x86_64</kernel>
  <initrd>/boot/initramfs-X.Y.Z.el6.x86_64.img</initrd>
  <cmdline>console=ttyS0 root=/dev/vda</cmdline>
  <boot dev='hd'/>
</os>

<disk type='block' device='disk'>
  <driver name='qemu' type='raw' cache='none' io='native'/>
  <source dev='/dev/vg/guest'/>
  <target dev='vda' bus='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>

From inside the guest:

$ mount
/dev/vda on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

Is it possible to resize the guest's root partition without rebooting the guest? Just doing lvextend on the host and resize2fs from the guest does not seem to be enough.

© Server Fault or respective owner

Related posts about kvm-virtualization

Related posts about lvm