* Converting QEMU Harddisk to native Partition
@ 2011-02-15 17:06 Erik Rull
2011-02-15 20:01 ` David Mair
0 siblings, 1 reply; 4+ messages in thread
From: Erik Rull @ 2011-02-15 17:06 UTC (permalink / raw)
To: kvm@vger.kernel.org
Hi all,
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?
Thanks!
Best regards,
Erik
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Converting QEMU Harddisk to native Partition
2011-02-15 17:06 Converting QEMU Harddisk to native Partition Erik Rull
@ 2011-02-15 20:01 ` David Mair
2011-02-15 20:54 ` Erik Rull
0 siblings, 1 reply; 4+ messages in thread
From: David Mair @ 2011-02-15 20:01 UTC (permalink / raw)
To: Erik Rull; +Cc: kvm@vger.kernel.org
On 02/15/2011 10:06 AM, Erik Rull wrote:
> Hi all,
>
> 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?
>
> Thanks!
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.
--
David.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Converting QEMU Harddisk to native Partition
2011-02-15 20:01 ` David Mair
@ 2011-02-15 20:54 ` Erik Rull
2011-02-15 22:32 ` David Mair
0 siblings, 1 reply; 4+ messages in thread
From: Erik Rull @ 2011-02-15 20:54 UTC (permalink / raw)
To: David Mair; +Cc: kvm@vger.kernel.org
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?
Thanks.
Best regards,
Erik
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Converting QEMU Harddisk to native Partition
2011-02-15 20:54 ` Erik Rull
@ 2011-02-15 22:32 ` David Mair
0 siblings, 0 replies; 4+ messages in thread
From: David Mair @ 2011-02-15 22:32 UTC (permalink / raw)
To: Erik Rull; +Cc: kvm@vger.kernel.org
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-02-15 22:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-15 17:06 Converting QEMU Harddisk to native Partition Erik Rull
2011-02-15 20:01 ` David Mair
2011-02-15 20:54 ` Erik Rull
2011-02-15 22:32 ` David Mair
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox