0

Is there a way when extending an LVM of a VM, while this VM is still running, to make this virtual machine see the extension of his LVM volume without rebooting it?

Lets say I have 5 GB LVM volume with system X running on it (debian squeeze). X is on. I perform an LVextend on my hypervisor, X does not notice its disks have grown unless I reboot X.

Is there away to update something that I can extend X his harddrives while it is live AND not have to reboot it after the extend?

Alan
  • 856
  • 1
  • 9
  • 18
Lucas Kauffman
  • 16,880
  • 9
  • 58
  • 93

2 Answers2

2

If your disk is seen as SCSI disk, issue a rescan: echo "- - -" >/sys/class/scsi_host/host0/scan, where host0 is your SCSI adapter. Then check with fdisk -lif disk size got changed.

Then if you have created your LVM volumes straight on top of the disk without partitioning it, you should be ready to run lvextend at this point. If you have created your LVM volume on some partition, then you need to resize the partition first with fdiskor some other tool, and after that run lvextend.

Janne Pikkarainen
  • 31,852
  • 4
  • 58
  • 81
1

I usually go the other way around. I add "disks" (either file or lun backed) to the virtual machine and this is usually admitted without reboot by the guest machine. Then i use lvm in guest machine to add a new physical volume and add it to the required volume group.

Ochoto
  • 1,166
  • 7
  • 12