Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
    
What happens if you try to specify /dev/mapper/mygroup-mylv as the image? –  Gilles Jul 8 '11 at 22:23
    
@Gilles It asks me if I want to overwrite the file. –  Let_Me_Be Jul 8 '11 at 22:28

1 Answer 1

up vote 10 down vote accepted

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.

share|improve this answer
1  
Can I not mount it as a loop back device?? –  balki Feb 1 '12 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 Mar 23 '12 at 13:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.