VirtualBox

Opened 16 years ago

Last modified 10 years ago

#1461 reopened defect

Virtualizing physical partition with createrawvmdk fails on Mac OS X Leopard — at Version 43

Reported by: jtbandes Owned by:
Component: virtual disk Version: VirtualBox 3.0.4
Keywords: createarawvmdk raw partition Cc:
Guest type: other Host type: Mac OS X

Description (last modified by Frank Mehnert)

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 (45)

comment:1 by Casey Dement, 16 years ago

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

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

comment:2 by jtbandes, 16 years ago

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}}}

comment:3 by h1d, 16 years ago

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.

comment:4 by Frank Mehnert, 16 years ago

Host type: otherMac OS X

comment:5 by Frank Mehnert, 16 years ago

Component: othershared folders

comment:6 by Frank Mehnert, 16 years ago

Component: shared foldersvirtual disk

comment:7 by Alexey Kuznetsov, 16 years ago

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$ 

comment:8 by Paul Ortman, 16 years ago

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

comment:9 by Jona, 15 years ago

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 .

comment:10 by Darrel Yurychuk, 15 years ago

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.

comment:11 by Jona, 15 years ago

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

comment:12 by Darrel Yurychuk, 15 years ago

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.

comment:13 by intery, 15 years ago

Thank you, dmyurych (Dmytryi Yurievich propably)! I did same and it add bootcamp to vmdk... BUT, as i did it on MacBoook Air, there is no SATA at all, Air has PATA. So when i'm start VM it tells "A DISK READ ERROR OCURRED"

In Disk Utility it is:

FS: Windows NT Filesystem (NTFS-3G) C: ATA Tree: /PCI0/PATA@1F,1/PRID@0/@0:3

Would be great if it could run in on Air with Leopard!!!.

comment:14 by viz, 15 years ago

I can confirm the workaround of dmyurych works for me also on Leopard - MBP osx 10.5.6.

I can mount ext3 partition (my sweet home) to Ubuntu 8.10 !

comment:15 by mpi, 15 years ago

Tiger 10.4.11 / VirtualBox 2.1.0 / MacBook 2,1

Did as dmyurych said (with jonrodolea typos fix) and got the following error:

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

Any suggestion? Thanks.

comment:16 by Bill McGonigle, 15 years ago

dmyurych's strategy works for me, though the permissions needn't be so open. Apparently the user needs access to the vmdk and r/w on the partition.

A bit more restrictive would be:

sudo chown whoami ~/Library/VirtualBox/VDI/raw-disk.vmdk sudo chgrp admin /dev/disk0s4 (or whatever disk/slice you need) sudo chmod 660 /dev/disk0s4

if your user is an administrative user on the OSX box he'll be able to use the raw disk with this permissions scheme.

While I appreciate the workaround, I'll just add my voice that it's not ideal, as I now need to go figure out how to teach grub to deal with a new disk geometry, so whole-disk raw access is still desirable (and at the moment grub is failing to probe the disk geometry...).

comment:17 by Bill McGonigle, 15 years ago

Ugh, looks like this form doesn't respect plaintext formatting. Once, more with 'WikiFormatting':

sudo chown whoami ~/Library/VirtualBox/VDI/raw-disk.vmdk 
sudo chgrp admin /dev/disk0s4 (or whichever disk/slice you need) 
sudo chmod 660 /dev/disk0s4

comment:18 by Oliver Schulze, 15 years ago

Hi,
sorry to use this bug report as a forum, but could anyone boot the bootcamp partition using this procedures?

I could create the partition and boot it, but I'm stuck in:

A disk read error occurred
Press Ctrl+Alt+Del to restart

This commands worked for me:

umount /Volumens/WinXP
sudo VBoxManage internalcommands createrawvmdk -filename /Users/myusername/Library/VirtualBox/VDI/raw-disk.vmdk -rawdisk /dev/disk0s3 -register
sudo chown myusername /Users/myusername/Library/VirtualBox/VDI/raw-disk.vmdk
sudo chgrp admin /dev/disk0s3
sudo chmod 660 /dev/disk0s3

Change myusername to your username. Change disk0s3 to your partition

Many thanks
Oliver
http://tinymailto.com/oliversl <-- my email after a captcha

comment:19 by Bill McGonigle, 15 years ago

Oliver - in my instance this workaround does not result in a bootable partition because the VB guest sees the partition as an entire disk, so in my case of Fedora 10, fedora writes an x86 bootsector to the 'drive', a partition map, and then the partition. My bootloader, rEFIt expects there to just be a bootable partition there, so it doesn't know what to do with all that extra stuff. I put in an RFE for rEFIt to be able to chainload this setup, but even better would be for this bug to be fixed so it's unnecessary.

If anybody read my prior comment, please note that this page ate the backticks around whoami and that these perms need to be applied after each OSX boot, they get reset on boot. Fortunately the VB GUI will warn you in this case.

comment:20 by Klaus Espenlaub, 15 years ago

Resolution: fixed
Status: newclosed
Summary: Virtualizing physical partition with createrawvmdk fails on Mac OS X LeopardVirtualizing physical partition with createrawvmdk fails on Mac OS X Leopard => fixed in svn

OK, tracked it down. OSX is pretty paranoid about opening the devices, and the error code printed by virtualbox was very misleading (the original error code was EBUSY). In the first place one cannot open an entire disk for writing when one partition is mounted. There are probably ways around this (otherwise it'd be impossible to repartition), but it looks like they are not necessary. After all it's good that people cannot shoot themselves into the foot.

After applying a few small hacks to the current svn code I could create a raw partition vmdk (required changing the permissions of /dev/disk0s3 AND ejecting the volume) - and when I enabled IO-APIC in the VM settings booting the bootcamped Vista worked as expected.

So either build the latest code yourself (should show up in the public svn soon) or wait for the next VirtualBox release.

comment:21 by Giovanni Toraldo (gionn), 15 years ago

Resolution: fixed
Status: closedreopened

Hi klaus,

I cannot achieve how to boot my physical Debian from Mac host.

I've created the physical vmdk: VBoxManage internalcommands createrawvmdk -filename raw-disk-linux.vmdk -rawdisk /dev/disk0 -partitions 4,5 (4: ext4 root, 5: swap)

Now, when I try to boot, grub starts (so the MBR is here), but Linux recognize me only a /dev/hda with an unknown partition table. If I do fdisk -l, I can see the true partition table. Somehow the partitions are gone? Or is the virtual disk layout (CHS?) different from the physical disk that inhibit Linux to see them (and create device nodes)?

I also tried to create the vmdk with -rawdisk /dev/disk0s4, and with Ubuntu Live I can mount it, but obviously there isn't any mbr/partition table on the partition itself for making it bootable.

Thanks.

ps: should I create a new ticket? The createrawvmdsk command works for sure, but isn't very useful to me :P

comment:22 by Alexey Kuznetsov, 15 years ago

on my system after starting vb fail to grub but unable to boot to linux or mount linux partitions

comment:23 by Bill McGonigle, 15 years ago

Is your disk real MBR or EFI with MBR emulation? If the latter, something like rEFIt's gptsync is often necessary to align things properly.

comment:24 by Giovanni Toraldo (gionn), 15 years ago

Sure bill_mcgonigle, GPT+MBR, partitions are already gptsynced, I can boot them nativley as usual.

comment:25 by JonnyMD, 15 years ago

I encountered the same issue oliversl described:

A disk read error occurred[[BR]]
Press Ctrl+Alt+Del to restart[[BR]]


I executed the vmdk creation command as described, as well as the permissions changes. The vmdk was created successfully and
I was able to add it to the VB disk manager. But trying to start up the disk in the VM results in the same error above.
I'm running 3.0.4. Any ideas? Can anyone confirm the bug is fixed in this version (it's listed in the version changes).

comment:26 by Giovanni Toraldo (gionn), 15 years ago

drjb: Yes, and imho because VB expose only the single partition, without the MBR.

I found this blog post: http://mesbalivernes.blogspot.com/2008/01/virtual-box-booting-from-existing.html

It create a new standard mbr, that somehow will be included in the vmdk. Don't have tried yet personally, but you can give it a try. Can also be more effective copying the real mbr using dd for embedding in the vmdk.

comment:27 by jerome, 15 years ago

Same problem here. Using 3.0.4, with MacOSX 10.5.8, I've succeeded to create the VMDK files using VBoxManage, setup a VM and boot it. Grub launches but init stops after loading the kernel at mounting the root FS. The reason being "sda: unknow partition table" After the few seconds delay, Busybox kicks in. cat /proc/partitions only reports /dev/sda. No partition.

I tried to provide a MBR. Not better. I guess the -pt.vmdk file is broken.

It seems that on MacOSX hosts, only bootcamp'd vista is supported :-/

in reply to:  27 ; comment:28 by jerome, 15 years ago

I tried to provide a MBR. Not better. I guess the -pt.vmdk file is broken.

Using the evaluation Vmware Fusion, I created a VM following http://fearandloath.us/vmware-fusion-bootcamp-partition.html for instance.

Then, using the vmware generated xxx-pt.vmdk instead of the vbox one, the VM started correctly, partition table being recognized just fine.

in reply to:  28 comment:29 by jerome, 15 years ago

Replying to jerome:

Then, using the vmware generated xxx-pt.vmdk instead of the vbox one, the VM started correctly, partition table being recognized just fine.

I just noticed the size difference between the two files :

$ ls -l ~/Library/VirtualBox/HardDisks/
...
-rw-------@ 1 USERNAME  USERNAME  -      32256 26 aoû 13:17 VMNAME-pt.vmdk.vmware
-rw-------  1 USERNAME  USERNAME  -        512 19 aoû 17:42 VMNAME-pt.vmdk.vbox
...

Left a note there : http://blog.jardinmagique.info/2009/08/setup-virtualbox-on-macosx-to-boot.html

comment:30 by JonnyMD, 15 years ago

Whether or not you got it to work with VMWare trial is helpful for fixing the problem for the moment but it certainly signals a problem in virtualbox that should be addressed. In other words...this ticket should remain open. There is currently no way within VirtualBox alone to get a vmdk that boots properly because of the MBR problem. Please fix, as this sort of functionality is HUGELY important to Mac OS X users.

comment:31 by Eric Drechsel, 15 years ago

The original issue is fixed, however gionn, myself and others are experiencing a new issue with physical partitions on OSX hosts, that Linux guests report "unrecognized partition table", although grub is able to recognize the partitions and browse their filesystems.

I opened a new ticket as #4897.

comment:32 by JimBushWhacker, 15 years ago

Before this tickit is signed off as being complete, please note that there still seem to be problems in general when trying to setup a MacOS X bootcamp partition as a Guest with VirtualBox release 3.0.4. This despite some peoples success in setting up some Guest OSes. In my case, I have tried to setup a bootcamp partition containing Windows XP (SP2). I am able to setup the Virtual Machine using the prescribed VboxManage command line and setting RW permissions on the Unix devnodes for /dev/disk0 and /dev/disk0s3. This part of it was made to work with rev 3.0.4. But when I attempt to start the Virtual Machine, I get the following message block in the Virtual Machine window:

"Windows could not start because of a computer disk hardware configuration problem. Could not read from the selected boot disk. Check boot path and disk hardware. Please check the Windows documentation about hardware disk configuration and your hardware reference manuals for additional information."

It has been about a year now since I discovered VirtualBox. I originally found it because I was contemplating buying vmware fusion and decided to look if there was an open source solution before I spent the money. I found VBox and was pleased with what I saw. That is with the exception of the fact that I could not setup VBox on my existing bootcamp partition. I decided to use a regular VDI virtual machine while I was waiting for this to be fixed. I was encouraged when the 3.0.4 release came out, but was frustrated when it was discovered that this only fixed part of the problem.

So, I guess my next question is can we get some priority on getting the general bootcamp partition running as a virtual machine working?

comment:33 by Eric Drechsel, 15 years ago

I think I prematurely opened a new ticket, now that I better understand the current issue, I see that it is closely related to the original issue so that this ticket could be considered "incomplete" or "in progress"

Following jerome's steps, I was able to use VMWare Fusion trial's vmware-rawdiskCreator (don't think it requires a current trial license) to create a working rawdisk-pt.vmdk. This util doesn't seem to support multiple partitions though, so I don't have access to the swap partition. Steps:

chgrp admin /dev/disk0 /dev/disk0s3 #s3 is my Ubuntu partition
chmod g+w /dev/disk0s3
cd ~/Library/VirtualBox/Machines/
VBoxManage internalcommands createrawvmdk -filename rawdisk.vmdk -rawdisk /dev/disk0 -partitions 3
# after installing vmware-fusion trial
"/Library/Application Support/VMware Fusion/vmware-rawdiskCreator" print /dev/disk0
"/Library/Application Support/VMware Fusion/vmware-rawdiskCreator" create /dev/disk0 3  /Users/eric/Library/VirtualBox/Machines/vmware-rawdisk ide
mv vmware-rawdisk-pt.vmdk rawdisk-pt.vmdk

Now add the disk, and Ubuntu (presumably windows too) can see the partitions.

I'm attaching both -pt files.

comment:35 by Frank Mehnert, 15 years ago

Summary: Virtualizing physical partition with createrawvmdk fails on Mac OS X Leopard => fixed in svnVirtualizing physical partition with createrawvmdk fails on Mac OS X Leopard

comment:36 by Frank Mehnert, 15 years ago

Version: VirtualBox 1.6.0VirtualBox 3.0.4

in reply to:  36 comment:37 by JimBushWhacker, 15 years ago

Replying to frank: Hopefully, these last 2 entries mean that this problem is now being actively worked on by the appropriate developers?

comment:38 by JonnyMD, 14 years ago

I got this working finally. I don't know if something was resolved between 3.0.4 and now (3.0.8) or if it was the change I did. Whatever it was, it's working.

All I did was unmount the bootcamp drive, then type in terminal (my username is J),

sudo chmod 777 /dev/disk0s3

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

sudo chown J *.vmdk

I then used virtualbox media manager to add the created vmdk to my list of harddrives. Then I added that to my virtual machine (settings, harddrives,add). I changed the IDE Controller Type to ICH6 (found that tip elsewhere regarding this issue). I also have updated bootcamp to 3.0 since this problem started.

Maybe a combination of all these changes (or just one in particular) but now it boots fine! Hope this helps someone else...

comment:39 by Alexey Kuznetsov, 14 years ago

My linux/windows partiton still unbootable. I able to create vmdk but unable to boot os. My linux box say unable to find root file system.

comment:40 by Alexey Kuznetsov, 14 years ago

my grub loader under virtualbox say something about wrong cylinders and bios... which never happens on real boot.

by Alexey Kuznetsov, 14 years ago

grub bios error

by Alexey Kuznetsov, 14 years ago

Attachment: localhost.vmdk added

grub bios error vmdk

in reply to:  40 ; comment:41 by jerome, 14 years ago

Replying to axet:

my grub loader under virtualbox say something about wrong cylinders and bios... which never happens on real boot.

See post and Steve Cheng comment on how to create a linux bootable GPT-aware "-pt.vmdk" file : http://blog.jardinmagique.info/2009/08/setup-virtualbox-on-macosx-to-boot.html

in reply to:  41 comment:42 by Alexey Kuznetsov, 14 years ago

thx jerome, my linux box start to work under virtualbox. but my windows xp still show error about problems with hard drives.

comment:43 by Frank Mehnert, 10 years ago

Description: modified (diff)
priority: criticalmajor
Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use