[fedora-virt] Does this virtual disk exist?
Mark McLoughlin
markmc at redhat.com
Fri Aug 14 08:23:33 UTC 2009
On Thu, 2009-08-13 at 15:32 -0400, Tom Horsley wrote:
> I've seen all kinds of virtual disk devices for virtual machines
> to use, but I was wondering just the other day if this (possibly
> silly) sort of virtual disk exists:
>
> Take partitions /dev/sda1, /dev/sdb2, slap together a pretend
> MBR and partition table out of thin air, and tell this virtual
> machine it is his virtual disk drive.
>
> The motivation being to easily run a virtual machine from
> a partition I can also boot as a stand alone separate boot
> partition.
>
> Naturally, the initrd stuff would get kind of dicey (hence
> the "possibly silly" qualifier :-).
You would probably be able to achieve this with the device-mapper linear
target.
It would take a lot of experimentation, but the idea would be:
1) Create a single sector loopback device containing the MBR and
partition table
2) Create a device mapper device with a table like this:
0 1 linear /dev/loop0 0
1 N_sda1_sects linear /dev/sda1 0
1+N_sda1_sects N_sdb2_sects linear /dev/sdb2 0
3) Pass the device mapper device to the virtual machine
Fun project! :-)
Cheers,
Mark.
More information about the virt
mailing list