VirtualBox

Ticket #1461 (new defect)

Opened 7 months ago

Last modified 3 days ago

Virtualizing physical partition with createrawvmdk fails on Mac OS X Leopard

Reported by: jtbandes Assigned to:
Priority: critical Component: virtual disk
Version: VirtualBox 1.6.0 Keywords: createarawvmdk raw partition
Cc: Guest type: other
Host type: Mac OS X

Description

On Mac OS X 10.5.2 (Intel iMac Core Duo) with VirtualBox 1.6.0, trying to create a VMDK for disk0s3, running the command

sudo VBoxManage internalcommands createrawvmdk -filename test.vmdk -rawdisk /dev/disk0 -partitions 3 -register

returns:

Error while creating the raw disk VMDK: VERR_INVALID_PARAMETER

Change History

05/14/08 06:54:16 changed by cadement

This behavior is also observed when referencing the partition directly as a device:

sudo VBoxManage internalcommands createrawvmdk -filename test.vmdk -rawdisk /dev/disk0s3 -register

06/15/08 08:20:00 changed by jtbandes

With version 1.6.2, using sudo VBoxManage internalcommands createrawvmdk -filename /path/to/test.vmdk -rawdisk /dev/disk0s3 succeeds, however, using the file does not (VERR_ACCESS_DENIED). If you sudo chmod 777 /dev/disk0s3, it works, and then when you try to start up the virtual machine, you get "FATAL: No bootable medium found! System halted" (trying to boot Ubuntu) or "A disk read error occurred; Press Ctrl+Alt+Del to restart" (trying to boot Windows Server 2003).

Why doesn't using -rawdisk /dev/disk0 -partitions 3 work? It makes more sense. When I try, I get {{{ERROR: VMDK: could not open raw partition file '/dev/disk0' Error code VERR_DEV_IO_ERROR at /Users/test/coding/vbox/1.6-osx-rel/src/VBox/Devices/Storage/VmdkHDDCore.cpp(2664) in function int vmdkCreateRawImage(VMDKIMAGE*, VBOXHDDRAW*, uint64_t) Error while creating the raw disk VMDK: VERR_DEV_IO_ERROR}}}

06/28/08 04:41:35 changed by h1d

On 10.5.3 intel core 2 duo (macbook air). Installed Windows XP pro on a physical partition with NTFS file system. it boots fine directly but trying to use VBoxManage command, I first got VERR_ACCESS_DENIED, so, looking into the device file in question, it had the group 'operator' on it, so I put my own user in 'operator' group, now the command succeeds. (although, like said above, specifying the -partition parameter fails with VERR_DEV_IO_ERROR, which means, I can't give more than 2 partitions access to the guest OS.)

Now I do have a vmdk file created at specified location, but whenever I add a new virtual machine through the gui interface and tries to load it up, it now gives same 'VERR_ACCESS_DENIED' even though the user can access the device now.

Something is broken down here.

07/07/08 15:19:56 changed by frank

  • host changed from other to Mac OS X.

07/10/08 09:52:23 changed by frank

  • owner changed.
  • component changed from other to shared folders.

07/10/08 09:52:28 changed by frank

  • owner changed.
  • component changed from shared folders to virtual disk.

09/04/08 15:11:24 changed by axet

Same for 2.0.0

axet-laptop:~ axet$ sudo VBoxManage internalcommands createrawvmdk -filename localhost.vmdk -rawdisk /dev/disk0
VirtualBox Command Line Management Interface Version 2.0.0
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

Error while creating the raw disk VMDK: VERR_DEV_IO_ERROR
The raw disk vmdk file was not created
axet-laptop:~ axet$ 

09/05/08 18:39:42 changed by portman

Trying a number of other things to try to get this to work, I unmounted my raw partition:

 ~ root# umount /dev/disk0s3

 ~ root# VBoxManage internalcommands createrawvmdk -filename /Users/manager/Library/VirtualBox/VDI/Disk0x3.vmdk -rawdisk /dev/disk0s3 
VirtualBox Command Line Management Interface Version 2.0.0
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

Bus error

The above did try to create the image (it exists as a file), but dies with the "Bus error" you see above.

Trying different syntax gave this result:

~ root#  rm -f /Users/manager/Library/VirtualBox/VDI/Disk0x3.vmdk 
~ root# VBoxManage internalcommands createrawvmdk -filename /Users/manager/Library/VirtualBox/VDI/Disk0x3.vmdk -rawdisk /dev/disk0 -partitions 3
VirtualBox Command Line Management Interface Version 2.0.0
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

Error while creating the raw disk VMDK: VERR_DEV_IO_ERROR
The raw disk vmdk file was not created

11/04/08 02:20:09 changed by jonrodolea

Is there any progress on this? I've been able to create a vmdk file for my XP Bootcamp partition /dev/disk0s3 by running:

sudo VBoxManage internalcommands createrawvmdk -filename /Library/VirtualBox/VDI/Disk0x3.vmdk -rawdisk /dev/disk0s3
sudo chmod -R g=u /Library/VirtualBox

but if I try to run it when logged in as myself, I get this error from VirtualBox:

VD: error opening image file '/Library/VirtualBox/VDI/Disk0x3.vmdk' (VERR_ACCESS_DENIED).


Result Code: 
NS_ERROR_FAILURE (0x80004005)
Component: 
HardDisk
Interface: 
IHardDisk {fd443ec1-000f-4f5b-9282-d72760a66916}
Callee: 
IVirtualBox {557a07bc-e6ae-4520-a361-4a8493199137}

If I log into the GUI as root, I can start the VM, but at boot I get:

Disk error
Press any key to restart

BTW, if I use

-rawdisk /dev/disk0 -partitions 3

I get the

Error while creating the raw disk VMDK: VERR_DEV_IO_ERROR
The raw disk vmdk file was not created

error as mentioned by others.

Thanks devs for all the great work, I hope this has been of help. I'm using Mac OS 10.5.5 and VirtualBox 2.0.4 .

11/17/08 08:00:24 changed by dmyurych

I am running OSX Tiger with some of the same problems. I was able to get a single partition
to work using the following:

    sudo VBoxManage internalcommands createrawvmdk /
    -filename ~MyUserName/Library/VDI/raw-disk.vmdk -rawdisk /dev/disk0sX -register


Where X was the partition to access listed with the 'diskutil list' command.

This created the vmdk file as root so I reverted it back to my userid as the owner and group
with:

    sudo chown MyUserName:MyUserName ~MyUserName/Library/VirtualBox/VDI/raw-disk.vmdk


Finally I had to open up the permissions on not only the vmdk file but also the device file
using:

    sudo chmod a+rw /dev/disk0sX 
    sudo chmod a+rw ~MyUserName/Library/VirtualBox/VDI/raw-disk.vmdk


Which opens up a huge security hole but hopefully they'll come up with a better way
of doing this in the future. Other programs seem to be able to access the disks and
partitions directly without the need to open up the permission completely or running
as root (ExtFS comes to mind).

Also I played around unsuccessfully with the -partition option but settled with this
since I only need access to one partition.

11/17/08 14:14:11 changed by jonrodolea

Thanks dmyurych, It's great that that is working with Tiger. Unforutnately, though it doesn't seem to work in Leopard ... Also, I think you made 2 typos ... I presume your first line of code should be:

sudo VBoxManage internalcommands createrawvmdk \
-filename ~MyUserName/Library/VirtualBox/VDI/raw-disk.vmdk -rawdisk /dev/disk0sX -register

11/21/08 04:41:24 changed by dmyurych

Yes thanks jonrodolea that was a typo. Well this is one of the few places I found
searching for a solution to my problem, so just wanted to leave a comment to hopefully
help anyone else who is experiencing the same problem with Tiger.

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy