[fedora-virt] P2V and grub bootloader

Richard W.M. Jones rjones at redhat.com
Thu Apr 30 22:27:00 UTC 2009


On Fri, May 01, 2009 at 12:16:29AM +0200, Dennis J. wrote:
> On 04/30/2009 11:39 PM, Richard W.M. Jones wrote:
>> Why not just copy across the whole block device?  This is essentially
>> what virt-p2v does (http://et.redhat.com/~rjones/virt-p2v/), although
>> virt-p2v is doing nothing more than automating what you could do by
>> hand.
[...]
> virt-p2v's achilles heel for me is that it can only copy on the block  
> device level. /dev/sda is 50gb in size, the root logical volume only 10gb 
> and copying the files over by piping a tar into ssh allowed me to shrink 
> it to 5gb in the process. also I plan to move machines that use regular  
> partitioning into VMs that use LVM volumes. Also copying the 3gb of files 
> is obviously faster then copying 50gb of mostly empty space.

Right, and that's one of the reasons for writing libguestfs.  When
libguestfs is more mature I'll be able to rewrite virt-p2v to make it
do this.

>>> How can I install grub from outside the VM?
>>
>> I haven't tried it, but it's possibly something you can do from
>> libguestfs, or if not, it's something that we could add to libguestfs.
>
> That would be great. What I'm a little confused about is the different  
> perspectives of the device-space you get when simply chroot-ing into the  
> VMs root filesystem and actually booting the VM. In the VM booting case  
> /dev/sda is /dev/sda so a "grub-install /dev/sda" does the trick but in 
> the chrooting case /dev/sda is still the physical /dev/sda (if I'm not 
> making a mistake in my thinking here). That's why I thought I could 
> "grub-install /dev/loop0" to treat the image file as the virtual 
> /dev/sda.
> Unfortunately that seems to confuse grub. I think I'll have to dive into  
> the grub-install source to see why exactly it is complaining and how to 
> get around that.

It's highly doubtful that grub-install would work on a loop device.
Grub needs to query the kernel for the real CHS geometry of the disk,
and I don't think /dev/loop0 will give that information, only the real
/dev/sda device.

In any case, libguestfs boots a mini-VM, so this is a non-issue.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw




More information about the Fedora-virt mailing list