16

Is it possible to use a LVM partition as a Virtualbox disk?

I can't find any option to use a device as a Virtualbox disk, only disk images.

2
  • What happens if you try to specify /dev/mapper/mygroup-mylv as the image? Commented Jul 8, 2011 at 22:23
  • @Gilles It asks me if I want to overwrite the file. Commented Jul 8, 2011 at 22:28

1 Answer 1

16

Yes. You can create a VMDK (not a VDI — you have to use the VMware disk image format) that accesses a raw disk. You can easily use a logical volume as if it were a whole disk, but just like most virtual disks, you probably won't be able to make the host kernel interpret its partition table and mount it.

Once you create your volume, just run

VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk \
    -rawdisk /dev/volumegroup/logicalvolume

Now you can use that VMDK file just like any other disk image, except it will store data on the raw volume rather than in the filesystem.

2
  • 1
    Can I not mount it as a loop back device??
    – balki
    Commented Feb 1, 2012 at 19:23
  • 1
    I believe you can. If you use losetup on it, you should end up with /dev/loop0p1 -type names. Unless vmw does something odd, in which case you might have to look for ways to access its image format specifically.
    – XTL
    Commented Mar 23, 2012 at 13:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .