qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Converting installed windows (or ?) partition to virtua


From: Johannes Schindelin
Subject: Re: [Qemu-devel] Converting installed windows (or ?) partition to virtual machine image
Date: Fri, 10 Oct 2008 14:26:44 +0200 (CEST)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

Hi,

On Thu, 9 Oct 2008, address@hidden wrote:

> I'd like to try to convert the installed Windows partition of a dual 
> boot machine into a virtual machine image.  It seems like qemu-img 
> currently only supports copying an entire disk (/dev/sda for example) to 
> a disk image.  It would be nice if one could specify a single partition.
> 
> As a first hack/attempt to try this out, I'm trying the patch below 
> (against 0.9.1) to only copy a certain number of sectors.  Since the 
> Windows partition is almost always the first partition on the disk, 
> hopefully this will work for most folks.  I guess if you've already 
> installed grub you'll have issues unless you also include the /boot 
> partition.

I think a better method would be to do something like this:

        (dd if=/dev/zero bs=32256 count=1 && dd if=/dev/sda1) > disk.img

and then adding one partition with "fdisk disk.img".  The 32256 is what is 
commonly reserved before the first partition (this is where the mbr and 
boot sector viruses live).

> It would be nice though to think about what it would take to do this
> "right".   Seems like you could source from a single partition and
> generate the proper MBR and partition table in the virtual machine image
> without too much trouble.  A cursory glance seems to indicate that the
> vvfat format does something like this.

vvfat does something completely different.  It takes an existing directory 
structure and simulates a VFAT partition from that, no matter what the 
original file system was.

Ciao,
Dscho





reply via email to

[Prev in Thread] Current Thread [Next in Thread]