I used the soluton from this thread but always i get

VirtualBox error: The medium 'lvol.vmdk' can't be used as the requested device type (0x80004005)

I've tried all controllers SATA, SCSI, IDE and SAS still not working.

Host SO: Ubuntu 12.04.1 amd64 VirtualBox 4.1

lvol.vmdk was create with

vboxmanage internalcommands createrawvmdk -filename /VDK/lvlol.vmdk -rawdisk /dev/vg/lv

the raw disk have:

1 primary ext3 156MB
2 primary swap 2147MB
3 primary ext3 4137MB
  • What does the vmdk file contain? (it should be a short text file). Is the LV device readable and writable (is it not in use by something else, like already mounted?). What has dd to do with all this? – Stéphane Chazelas Oct 31 '12 at 20:25
  • What is the output for id and what is the ownership/permissions of the logical volume you created? What is the contents of lvol.vmdk? Please add this info to your question. What Operating System and which version do you use? – jippie Oct 31 '12 at 20:27
  • What does cat /VDK/lvlol.vmdk output? – jippie Oct 31 '12 at 21:04

If you are running a system comparable with Ubuntu 12.10, using udev, then you have to instruct udev to assign proper permissions to the logical volume you want to assign to Virtualbox.

To check current permissions to on the logical volume:

$ ls -lL /dev/mapper/vg_usbraid-vm_webserver
brw-rw---- 1 root disk      252,   8 Oct 26 09:26 vg-lv
uid=1000(username) gid=1000(groupid) groups=1000(groupid),4(adm),20(dialout),24(cdrom),46(plugdev),115(lpadmin),117(admin),122(sambashare)

And check if the group id of the device is listed in the group list from the id command.

The problem in the example above is that neither 'root' nor 'disk' is in the list that id spits out. Although it is easy to extend the group list for a user, this is really not what you want as adding either root or disk to your user account is a major security risk. You would be able as a normal user to write to any disk at a very low level. A better solution is explained below.

With the limited information available at the moment of writing, I cannot go into much detail, but this is what I've done to accomplish a Vbox VM running from a Logical Volume under my own username:

Create the following file: /etc/udev/rules.d/65-vmdmsetup.rules with contents:

SUBSYSTEM!="block",                             GOTO="vm_device_mapper_end"
KERNEL!="dm-*",                                 GOTO="vm_device_mapper_end"
ACTION!="add|change",                           GOTO="vm_device_mapper_end"

# Obtain device status
IMPORT{program}="/sbin/dmsetup export -j%M -m%m"
ENV{DM_NAME}!="?*",                             GOTO="vm_device_mapper_end"

ENV{DM_NAME}=="vg_usbraid-vm_webserver",        GROUP="groupid"                                                



  • vg_usbraid is the name of the volume group
  • vm_webserver is the name of the logical volume
  • groupid is the group id that comes with your username. Check for 'gid=' in the output of id

Of course you need to reload udev, but making typos in udev rules can crash your system. So be sure to have closed as many applications as possible and maybe just run a sync to flush as much data to disk as possible. Consider increasing the log level so in case it doesn't work, at least you have some lead to what went wrong.

$ udevadm control --log-priority=info
$ sudo udevadm control --reload

On Ubuntu logging is redirected to /var/log/syslog.

Only once udev is set up, you should create the logical volume, otherwise udev will not see the events. If your LV already exists run a:

$ sudo udevadm trigger --subsystem-match=block

Then finally check with if permissions were correctly set using:

$ ls -lL vg_usbraid-vm_webserver
brw-rw---- 1 root groupid  252,   8 Oct 26 09:26 vg_usbraid-vm_webserver

And return the logging lever to the default setting:

$ sudo udevadm control --log-priority=err

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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