Hi, What I'm currently experimenting with is how to move a VM between two hosts efficiently. Specifically we are talking Linux guest with virtual disk sizes of 150G of which only about 10-20G are used. Doing a plain "dd" takes a lot of time and is kind of wasteful given that 90% of the logical volume used doesn't contain relevant data. So right now I'm trying to re-create the lvm/filesystem structure from scratch on the target system and then copying the data using tar from the source system. This looks good so far but I cannot start the guest on the target because the boot-sector is missing. I tried using guestfish as described here: http://rwmj.wordpress.com/2009/05/11/rescuing-a-failed-vm-install-with-guest... but when I issue the "grub-install / /dev/sda" all I get is: "libguestfs: error: grub_install: grub-install: /dev/sda does not have any corresponding BIOS drive." I also tried copying the MBR using "dd bs=448 count=1 ..." but that only results in the output of "GRUB" on the target system and then nothing happens. What is the best way to copy/initialize the MBR so the target system boots again?
Another method I intend to test is to copy the entire volume with "dd" while the VM is still running then shutting the VM down and using "rsync" to do the final fixup on the logical volumes. That of course assumes that rsync actually works on device nodes which I'm not so sure about.
Has anyone experience with this kind of thing? (Just to be clear I'm not talking about cloning the VM requiring making changes to the files in the VM but just simply moving the VM to another host with as little down-time as possible.)
Regards, Dennis
On Thu, Oct 29, 2009 at 08:35:58PM +0100, Dennis J. wrote:
http://rwmj.wordpress.com/2009/05/11/rescuing-a-failed-vm-install-with-guest... but when I issue the "grub-install / /dev/sda" all I get is: "libguestfs: error: grub_install: grub-install: /dev/sda does not have any corresponding BIOS drive."
I read the rest of your comment with awe. All I can say is good luck with your experiments.
Just about the particular error above .. Is /dev/sda the real name of the drive? (Try the list-devices command to list the real device names).
Rich.
On 10/29/2009 09:28 PM, Richard W.M. Jones wrote:
On Thu, Oct 29, 2009 at 08:35:58PM +0100, Dennis J. wrote:
http://rwmj.wordpress.com/2009/05/11/rescuing-a-failed-vm-install-with-guest... but when I issue the "grub-install / /dev/sda" all I get is: "libguestfs: error: grub_install: grub-install: /dev/sda does not have any corresponding BIOS drive."
I read the rest of your comment with awe. All I can say is good luck with your experiments.
Just about the particular error above .. Is /dev/sda the real name of the drive? (Try the list-devices command to list the real device names).
Success! The problem was that the guest is usually using /dev/vda but I couldn't get guestfish to start with:
[root@nexus ~]# guestfish -a /var/lib/libvirt/images/test2.img -m /dev/vg_test/lv_root -m /dev/vda1:/boot libguestfs: error: mount: mount_stub: /dev/vda1: No such file or directory
Using /dev/sda1 instead lets guestfish start and /boot is mounted properly but grub-install didn't work. What did the trick was changing "/dev/vda" to "/dev/sda" in /boot/grub/device.map followed by a grub-install which now works and then changing the device.map back so I don't get problems when booting up the guest for real.
After that the "new" guest boots up perfectly.
I'm not very familiar with guestfish (yet) so I'm not sure if the /dev/vda1 thing is a bug or simply not supposed to work. The next step would be to automate the whole thing with a script even if it's only useful in some cases (where the guest only really uses a small part of the image).
Regards, Dennis
On Thu, Oct 29, 2009 at 11:06:41PM +0100, Dennis J. wrote:
I'm not very familiar with guestfish (yet) so I'm not sure if the /dev/vda1 thing is a bug or simply not supposed to work.
Reliable device naming is always a problem with Linux. This explains the situation vis-a-vis libguestfs clients:
http://libguestfs.org/guestfs.3.html#block_device_naming
Rich.