Using a raw hard disk on Mac OS X

Discussions related to using VirtualBox on Mac OS X hosts.

Using a raw hard disk on Mac OS X

Postby Yoc » 5. Sep 2008, 14:05

Hello,
I'm very pleased with this software, the 2.0 version is a big step forward for Mac OS X users. The only thing missing is the possibiity to use Bootcamp disk/partition.
Reading the Manual, I see that we can create a virtual hard disk for a real disk/partition using CLI. I tried with this command :
Code: Select all   Expand viewCollapse view
./VBoxManage internalcommands createrawvmdk -filename /Volumes/Media/vmware/BootCamp.vmdk -rawdisk /dev/disk0 -partitions 4

But I got an error :
Code: Select all   Expand viewCollapse view
Error while creating the raw disk VMDK: VERR_DEV_IO_ERROR
The raw disk vmdk file was not created

The listpartitions command works.

Do you know a way to make this work in Mac OS X ?
Yoc
 
Posts: 6
Joined: 5. Sep 2008, 14:01

Postby TerryE » 5. Sep 2008, 16:05

You still need to conform to access rights. Does your account have write access to the bare drive?
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
TerryE
Volunteer
 
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS

Postby aquarius » 5. Sep 2008, 17:50

It seems still broken on 2.0. See the latest bad news in http://www.virtualbox.org/ticket/1461.
aquarius
 
Posts: 69
Joined: 3. Jun 2008, 22:35
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: MS Windows XP

Postby amagine » 5. Sep 2008, 19:02

Just curious:

Do you have MacFUSE and MacNTFS-3G installed?

As TerryE pointed out, you need to have WRITE access to the BOOTCAMP partition. Since Mac OS X.5.4 comes only with READ access of NTFS the stock system lacks WRITE access.

Installing MacFUSE and then MacNTFS-3G installs a framework that allows read/write access to NTFS drives.

Worth a try if you have not installed these frameworks.
amagine
Volunteer
 
Posts: 177
Joined: 28. Jul 2008, 19:52

Using a raw hard disk on Mac OS X

Postby JimBushWhack » 6. Sep 2008, 08:08

I am having the same problem, except I am trying to use a FAT32 FS on a 30 GB partition:
Code: Select all   Expand viewCollapse view
sh-3.2# vboxmanage internalcommands listpartitions -rawdisk /dev/disk0
VirtualBox Command Line Management Interface Version 2.0.0
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

Number  Type   StartCHS       EndCHS      Size (MiB)  Start (Sect)
1       0xee  0   /0  /2   25  /127/14           200            1
2       0xaf  25  /127/15  1023/152/54        206720       409640
3       0x0c  1023/233/56  1023/80 /23         31427    424034344
sh-3.2# fdisk /dev/disk0 |grep FAT
*3: 0C 1023 233  56 - 1023  80  23 [ 424034344 -   64362784] Win95 FAT32L

sh-3.2# vboxmanage internalcommands createrawvmdk -filename /Users/Jim/Library/VirtualBox/WinXP.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
sh-3.2#

sh-3.2# ls -l disk0*
brw-r-----  1 root  operator   14,   0 Sep  5 17:03 disk0
brw-r-----  1 root  operator   14,   1 Sep  5 17:03 disk0s1
brw-r-----  1 root  operator   14,   2 Sep  5 17:03 disk0s2
brw-r-----  1 root  operator   14,   3 Sep  5 17:03 disk0s3

I did this as the root user as well. I also tried setting write access on the devnode for everyone, but this did not help either:
Code: Select all   Expand viewCollapse view
sh-3.2# chmod 766 disk0s3
sh-3.2# ls -l disk0*
brw-r-----  1 root  operator   14,   0 Sep  5 17:03 disk0
brw-r-----  1 root  operator   14,   1 Sep  5 17:03 disk0s1
brw-r-----  1 root  operator   14,   2 Sep  5 17:03 disk0s2
brwxrw-rw-  1 root  operator   14,   3 Sep  5 17:03 disk0s3
sh-3.2# vboxmanage internalcommands createrawvmdk -filename /Users/Jim/Library/VirtualBox/WinXP.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

I also tried unmounting the Win XP partition too. But that did not help.

One thing that is kind of annoying is that there is no description of the "internalcommands" request in the user manual, there is also no Unix style manpage for vxboxmanage and the usage message does not list the internalcommands request either. This is pretty much a "secret request". I did try using "-partition" and got this usage message:
Code: Select all   Expand viewCollapse view
sh-3.2# vboxmanage internalcommands createrawvmdk -filename /Users/Jim/Library/VirtualBox/WinXP.vmdk -rawdisk /dev/disk0 -partition 3
VirtualBox Command Line Management Interface Version 2.0.0
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

Usage: VBoxManage internalcommands <command> [command arguments]

Commands:

  createrawvmdk -filename <filename> -rawdisk <diskname>
                [-partitions <list of partition numbers> [-mbr <filename>] ]
                [-register] [-relative]
       Creates a new VMDK image which gives access to an entite host disk (if
       the parameter -partitions is not specified) or some partitions of a
       host disk. If access to individual partitions is granted, then the
       parameter -mbr can be used to specify an alternative MBR to be used
       (the partitioning information in the MBR file is ignored).
       The diskname is on Linux e.g. /dev/sda, and on Windows e.g.
       \\.\PhysicalDrive0).
       On Linux host the parameter -relative causes a VMDK file to be created
       which refers to individual partitions instead to the entire disk.
       Optionally the created image can be immediately registered.
       The necessary partition numbers can be queried with
         VBoxManage internalcommands listpartitions

WARNING: This is a development tool and shall only be used to analyse
         problems. It is completely unsupported and will change in
         incompatible ways without warning.

Syntax error: Invalid parameter '-partition'
sh-3.2#

So note that they don't mention MacOS X, but do mention Windoze and Linux. Maybe it still is not really supported on the MacOS X host. Although, the Introduction in the mpkg file did not mention this as a restriction, which I guess it used to.
JimBushWhack
 
Posts: 77
Joined: 1. Sep 2008, 23:07
Location: SF Bay Area; California, USA
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win XP on iMac; Win 7 on MacBook pro + bootcamp

Postby Yoc » 6. Sep 2008, 09:18

Your last error was due to the fact that you type partition instead of partitions.
I'm using also a FAT32 partition type, and tried to unmount the volume first. A also tried to sudo the command without any success.
Yoc
 
Posts: 6
Joined: 5. Sep 2008, 14:01

Postby amagine » 6. Sep 2008, 09:22

Okay I spent some time playing with the internalcommands also and came up with the same issues as JimBushWhack and previous users.

I do not have a completely separate internal hard drive to test this on but confirm I have been unable to create a raw disk VMDK image from my NTFS BootCamp of Windows Vista Ultimate 32bit.
amagine
Volunteer
 
Posts: 177
Joined: 28. Jul 2008, 19:52

Using a raw hard disk on Mac OS X

Postby JimBushWhack » 6. Sep 2008, 16:18

In answer to Yoc, yes I know that I put in partition instead of partitions. I did that just to see if it made a difference. Then I included the usage msg I got back to show that the syntax seems to support Linux and Windows, but maybe not MacOS X.

One other thought. I don't have time to try this this morning, but I would expect that the wmdk file format that should be made here has an ascii description of the partition extent information. So in my case, it would have to have the starting sector and length of partition 3 (424034344/31427 MiB). It might be possible to go through the motions of setting up a new virtual machine with a wmdk file, then copy this file so it can be edited with say textedit and put in extent info at the right place. Of course I would guess that in the act of setting up the virtual machine, the space requested would have to be withdrawn from the MacOS X HFS file system. So once the wmdk file is copied, the new virtual machine should be backed out, to regain the FS space. Then go through the gui again and use the edited wmdk file to describe an existing virtual machine.
JimBushWhack
 
Posts: 77
Joined: 1. Sep 2008, 23:07
Location: SF Bay Area; California, USA
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win XP on iMac; Win 7 on MacBook pro + bootcamp

Postby JimBushWhack » 6. Sep 2008, 16:22

Sorry, I shouldn't have posted my last one without coffee.. Everywhere I mentioned wmdk, please substitute vmdk.
JimBushWhack
 
Posts: 77
Joined: 1. Sep 2008, 23:07
Location: SF Bay Area; California, USA
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win XP on iMac; Win 7 on MacBook pro + bootcamp

Step By Step...

Postby JayMcB74 » 24. Mar 2009, 21:56

A Step By Step Walk Thru On How To Make A Raw Disk Image On Mac OS X
Use at your own risk j;-)

01.0 Open a Terminal and Sudo yourself: sudo su
02.0 Check your disk layout: df -k
02.5 Pick your disk out of the list so you know it's disk number. In my case it was the Store volume, disk0s2.
03.0 Eject the Volume in the Finder or Unmount it in Disk Utility
03.5 Give VBox access to the drive: chmod 777 /dev/disk0s2
04.0 Give the command: VBoxManage internalcommands createrawvmdk -filename /Users/Jay/Library/VirtualBox/HardDisks/Store.vmdk -rawdisk /dev/disk0s2 -register
05.0 Give access to the image file: chmod -R 777 /Users/jay/Library/VirtualBox/HardDisks/Store.vmdk
06.0 control+d to log out
Code: Select all   Expand viewCollapse view
J:~ jay$ sudo su
WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:

J:~ jay$ df -k
Filesystem     1024-blocks      Used Available Capacity  Mounted on
/dev/disk1s2     292721440 186159120 106306320    64%    /
devfs                  111       111         0   100%    /dev
fdesc                    1         1         0   100%    /dev
map -hosts               0         0         0   100%    /net
map auto_home            0         0         0   100%    /home
/dev/disk0s1      83891396  26678680  57212716    32%    /Volumes/WinXP
/dev/disk0s2     209158264  31873316 177284948    16%    /Volumes/Store
/dev/disk3s1       1010700       516   1010184     1%    /Volumes/Flash Drive
/dev/disk4s1s2      408818    408818         0   100%    /Volumes/Civilization IV Warlords
sh-3.2# chmod 777 /dev/disk0s2
sh-3.2# VBoxManage internalcommands createrawvmdk -filename /Users/Jay/Library/VirtualBox/HardDisks/Store.vmdk -rawdisk /dev/disk0s2 -register
VirtualBox Command Line Management Interface Version 2.1.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

RAW host disk access VMDK file /Users/Jay/Library/VirtualBox/HardDisks/Store.vmdk created successfully.
sh-3.2# chmod -R 777  /Users/jay/Library/VirtualBox/HardDisks/Store.vmdk
sh-3.2# exit
J:~ jay$


Notes:
Error: VERR_FILE_NOT_FOUND - Don't use relative paths
Error: VERR_ACCESS_DENIED - Give Access to the drive : sh-3.2# chmod 777 /dev/disk0s2
Error: VERR_DEV_IO_ERROR - Unmount the drive, try all related drive partitions also.
I'm not using the -partitions command.
I don't have a driver for NTFS though I do have write access in the WinXP vm

Hopes this helps j;-)
Last edited by JayMcB74 on 22. Mar 2011, 16:07, edited 3 times in total.
JayMcB74
 
Posts: 3
Joined: 24. Mar 2009, 21:11
Location: Texas
Primary OS: Ubuntu other
VBox Version: OSE self-compiled
Guest OSses: WinXP/Linux

Re: Using a raw hard disk on Mac OS X

Postby _savage » 2. Apr 2009, 08:28

Hello,

I guess this thread comes closest to my problem. I'm running VirtualBox on a 10.4.11 host, with Win7 as a guest. Works great. Now I got an old XP installation on an external USB drive which I would like to access from within the guest, but I have difficulties mounting that partition. I can list it:
Code: Select all   Expand viewCollapse view
savage@tigger ~ > VBoxManage internalcommands listpartitions -rawdisk /dev/rdisk2
VirtualBox Command Line Management Interface Version 2.1.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

Number  Type   StartCHS       EndCHS      Size (MiB)  Start (Sect)
1       0xee  0   /0  /2   25  /127/14           200            1
2       0xaf  25  /127/15  1023/148/36         51200       409640
3       0x07  1023/229/38  1023/80 /23         43868    105529384

It's partition 3 that I would like to mount. But when I try to create the vmdk I get the following error:
Code: Select all   Expand viewCollapse view
savage@tigger ~ > VBoxManage internalcommands createrawvmdk -filename Library/VirtualBox/HardDisks/WinXPRaw.vmdk -rawdisk /dev/rdisk2 -partitions 3
VirtualBox Command Line Management Interface Version 2.1.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

File '/dev/rdisk2' is no block device
The raw disk vmdk file was not created

So.. uhm.. what am I doing wrong here?

Thanks heaps!
_savage
 
Posts: 1
Joined: 2. Apr 2009, 08:20
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win7, Ubuntu, WinXP, AROS

Re: Using a raw hard disk on Mac OS X

Postby jmanis2 » 27. Apr 2009, 19:35

JayMcB74 wrote:A Step By Step Walk Thru On How To Make A Raw Disk Image On Mac OS X
Use at your own risk j;-)


Jay's tips above are dead on and work great so long as you are not looking to natively boot the bootcamp partition as a WinXP guest . You can do as he says and get a working VirtualBox WinXP but the windows installer reformats the partition and makes it unreadable by MacOS.

Jeff
jmanis2
 
Posts: 3
Joined: 27. Apr 2009, 19:31
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: WinXP

Re: Using a raw hard disk on Mac OS X

Postby baf » 27. Apr 2009, 20:07

_savage wrote:Hello,
savage@tigger ~ > VBoxManage internalcommands listpartitions -rawdisk /dev/rdisk2
[code]
savage@tigger ~ > VBoxManage internalcommands createrawvmdk -filename Library/VirtualBox/HardDisks/WinXPRaw.vmdk -rawdisk /dev/rdisk2 -partitions 3


Try using /dev/disk2 instead
Some say: "You learn as long as you live".
My way: "You live as long as you learn".
baf
Volunteer
 
Posts: 829
Joined: 27. Sep 2008, 06:18
Location: Luleå or Skellefteå, Sweden
Primary OS: Mac OS X Leopard
VBox Version: PUEL
Guest OSses: linux,xp,win7

Re: Using a raw hard disk on Mac OS X

Postby OSX@Linux » 27. Apr 2009, 23:44

OSX@Linux
 
Posts: 28
Joined: 13. Apr 2009, 01:37
Location: San Diego, CA
Primary OS: Mac OS X Leopard
VBox Version: PUEL
Guest OSses: Windows XP

Re: Using a raw hard disk on Mac OS X

Postby v01d.cmd » 29. Aug 2009, 20:52

_savage wrote:Hello,

I guess this thread comes closest to my problem. I'm running VirtualBox on a 10.4.11 host, with Win7 as a guest. Works great. Now I got an old XP installation on an external USB drive which I would like to access from within the guest, but I have difficulties mounting that partition. I can list it:
Code: Select all   Expand viewCollapse view
savage@tigger ~ > VBoxManage internalcommands listpartitions -rawdisk /dev/rdisk2
VirtualBox Command Line Management Interface Version 2.1.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

Number  Type   StartCHS       EndCHS      Size (MiB)  Start (Sect)
1       0xee  0   /0  /2   25  /127/14           200            1
2       0xaf  25  /127/15  1023/148/36         51200       409640
3       0x07  1023/229/38  1023/80 /23         43868    105529384

It's partition 3 that I would like to mount. But when I try to create the vmdk I get the following error:
Code: Select all   Expand viewCollapse view
savage@tigger ~ > VBoxManage internalcommands createrawvmdk -filename Library/VirtualBox/HardDisks/WinXPRaw.vmdk -rawdisk /dev/rdisk2 -partitions 3
VirtualBox Command Line Management Interface Version 2.1.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

File '/dev/rdisk2' is no block device
The raw disk vmdk file was not created

So.. uhm.. what am I doing wrong here?

Thanks heaps!

I think you need to umount out of Mac OS X system.

Hi! Beforehand, I would like to say "Sorry for my English". (My Russian is much better ; )

So, I have purpose "Make LiveCD on my pen-USB (USB flash drive)" and I found grub4dos.
Finally, I need a platform for some experiments. I found that my lovely VB can't boot by an USB device.
Usually, the Google is The Universal Troubleshooter. I found this article: http://agnipulse.com/2009/07/boot-your- ... irtualbox/
and I found that 'VBoxManage' file sore in '/Applications/VirtualBox.app/Contents/MacOS/VBoxManage'. Let's start.
1) We need to demount storage right way and we need know what is name of my pen-usb
In Terminal:
Code: Select all   Expand viewCollapse view
v01dBook:~ v01d$ df
Filesystem    512-blocks      Used Available Capacity  Mounted on
/dev/disk0s2   311909984 254598528  56799456    82%    /
devfs                215       215         0   100%    /dev
fdesc                  2         2         0   100%    /dev
map -hosts             0         0         0   100%    /net
map auto_home          0         0         0   100%    /home
/dev/disk1s1     7842760      1688   7841072     1%    /Volumes/V01DFLASH

2) My pen-usb is "/Volumes/V01DFLASH". We will detach usb-pen:
In Terminal:
Code: Select all   Expand viewCollapse view
v01dBook:~ v01d$ sudo umount -f /Volumes/V01DFLASH
Password:

3) we going to make RAW
Code: Select all   Expand viewCollapse view
v01dBook:~ v01d$ cd /Applications/VirtualBox.app/Contents/MacOS/
v01dBook:MacOS v01d$
v01dBook:MacOS v01d$ VBoxManage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/disk1s1 -register
VirtualBox Command Line Management Interface Version 2.2.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

RAW host disk access VMDK file /Users/v01d/usb.vmdk created successfully.

4) Finally, I trying to load VB amchine with using "usb.vmdk" as IDE Primary Master Hard drive, but Machine trying to load (and pen-usb working) and not booting.

So if any one can help me by Skype or TeamViewer. Or anyone have ideas?
v01d.cmd
 
Posts: 1
Joined: 29. Aug 2009, 20:04
Primary OS: Mac OS X Leopard
VBox Version: PUEL
Guest OSses: WinXP SP3 Eng

Next

Return to VirtualBox on Mac OS X Hosts

Who is online

Users browsing this forum: Google [Bot] and 9 guests