Re: Converting QEMU Harddisk to native Partition

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

 



On 02/15/2011 01:54 PM, Erik Rull wrote:
David Mair wrote:

I have currently virtualized two partitions (/dev/sda2 and /dev/sda3)
that are exposed as QEMU Harddisks to the Windows XP Guest (Drive C and
D there).
Are there possibilities to convert or adapt those to native partitions
or native disks so that I could theoretically boot the Windows that is
placed in the virtual disk natively?

Anything that works on real hardware is likely to work if run in a
guest. At the very least, one of several similar and equivalent methods
would be, create another virtual disk a bit bigger than the Windows
partition you want to make native and attach it to a VM with the Windows
partition you want to make native and boot a linux rescue disk. Put a
linux file system on the new disk and mount it (say at /mnt/workspace)
then, assuming the Windows partition you want to make native is hda1:

# dd if=/dev/sda2 of=/mnt/workspace/windowsCdrive.img bs=1M
# dd if=/dev/sda3 of=/mnt/workspace/windowsDdrive.img bs=1M
# scp /mnt/workspace/windows*img user@vmhost:~/

I'm assuming you get how that would give you a block copy of the guest
partitions as files on the host, which you could then lay down on a real
disk via dd and a USB device for example.


Yeah, I thought about a similar approach already but it looked too
complex to me :-) I assume that my hardware resources might be too
limited for such an operation, but I will give it a try. For saving
space I could try to do a .gz or .tgz out of it right (using "dd |
tar...")?
Are there other possibilities from the host side to handle that? I heard
about the qemu-img tool but it doesn't seem to match my usecase.
Or have I just missed some parameters?

qemu-nbd (see man qemu-nbd) might be what you are looking for, booting a guest with it attached seems simpler to me so I admit I haven't tried qemu-nbd.

If it's a simple block image you can mount it on the host via the loop device like any unencoded disk image in a file.

You could go directly to a USB disk in a guest just by using USB pass-thru of a physical disk, I'd boot a linux rescue disk and use dd.

--
David Mair.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux