Raw disk support?

Discussions about using Mac OS X guests (on Apple hardware) in VirtualBox.
Post Reply
FabrizioR
Posts: 1
Joined: 3. Jun 2019, 17:56

Raw disk support?

Post by FabrizioR »

Does the mac version of Virtualbox support raw disks? I tried v6.x and v7.0.6 with same probvlem.

Wanted to use a dedicated disk on my mac pro for a windows 10 VM, once I got it configured and replaced the .vdi file-based disk in the configuration with a "rawvmsssd.vmdk" placeholder file, the VM won't POST and times-out complaining about being unable to access the raw disk device. There error is:

Code: Select all

VD: error VERR_TIMEOUT opening image file '/Volumes/FRP Master/Virtual Machines/Win10VM/rawvmsssd.vmdk' (VERR_TIMEOUT).
Failed to open image '/Volumes/FRP Master/Virtual Machines/Win10VM/rawvmsssd.vmdk' in read-write mode (VERR_TIMEOUT).
AHCI: Failed to attach drive to Port0 (VERR_TIMEOUT).
There are log entries as follows:

Code: Select all

00:00:01.759710 VirtualBox VM 7.0.6 r155176 darwin.amd64 (Jan 11 2023 17:40:04) release log
...
00:00:01.771213 Guest OS type: 'Windows10_64'
00:00:01.775240 fHMForced=true - No raw-mode support in this build!
...
00:00:02.026580 NEM: NEMR3Init: Turtle execution mode is active!
00:00:02.026580 NEM: Note! VirtualBox is not able to run at its full potential in this execution mode.
00:00:02.026581 NEM:
00:00:02.026720 CPUM: No hardware-virtualization capability detected
00:00:02.027048 CPUM: fXStateHostMask=0x7; initial: 0x7; host XCR0=0x7
00:00:02.028953 CPUM: Matched host CPU INTEL 0x6/0x3e/0x4 Intel_Core7_IvyBridge with CPU DB entry 'Intel Core i5-3570' (INTEL 0x6/0x3a/0x9 Intel_Core7_IvyBridge)
...
00:00:11.669508 VD: VDInit finished with VINF_SUCCESS
00:00:11.670151 AIOMgr: Endpoint for file '/Volumes/FRP Master/Virtual Machines/Win10VM/rawvmsssd.vmdk' (flags 00040723) created successfully
00:02:11.673222 VMSetError: /Users/vbox/tinderbox/mac-rel/src/VBox/Storage/VD.cpp(5614) int VDOpen(PVDISK, const char *, const char *, unsigned int, PVDINTERFACE); rc=VERR_TIMEOUT
00:02:11.673229 VMSetError: VD: error VERR_TIMEOUT opening image file '/Volumes/FRP Master/Virtual Machines/Win10VM/rawvmsssd.vmdk'
00:02:11.673332 VMSetError: /Users/vbox/tinderbox/mac-rel/src/VBox/Devices/Storage/DrvVD.cpp(5331) int drvvdConstruct(PPDMDRVINS, PCFGMNODE, uint32_t); rc=VERR_TIMEOUT
00:02:11.673334 VMSetError: Failed to open image '/Volumes/FRP Master/Virtual Machines/Win10VM/rawvmsssd.vmdk' in read-write mode
00:02:11.673419 VD: Opening the disk took 120004419252 ns
00:02:11.674493 VMSetError: /Users/vbox/tinderbox/mac-rel/src/VBox/Devices/Storage/DevAHCI.cpp(6039) int ahciR3Construct(PPDMDEVINS, int, PCFGMNODE); rc=VERR_TIMEOUT
00:02:11.674496 VMSetError: AHCI: Failed to attach drive to Port0
00:02:11.674582 PDM: Failed to construct 'ahci'/0! VERR_TIMEOUT (-40) - Timeout.
00:02:11.694556 GIM: HyperV: Resetting MMIO2 regions and MSRs
00:02:11.701001 NEM: hv_vm_destroy() failed with 0xfae94001
00:02:11.878346 ERROR [COM]: aRC=NS_ERROR_FAILURE (0x80004005) aIID={6ac83d89-6ee7-4e33-8ae6-b257b2e81be8} aComponent={ConsoleWrap} aText={VD: error VERR_TIMEOUT opening image file '/Volumes/FRP Master/Virtual Machines/Win10VM/rawvmsssd.vmdk' (VERR_TIMEOUT).
00:02:11.878352 Failed to open image '/Volumes/FRP Master/Virtual Machines/Win10VM/rawvmsssd.vmdk' in read-write mode (VERR_TIMEOUT).
00:02:11.878352 AHCI: Failed to attach drive to Port0 (VERR_TIMEOUT)}, preserve=false aResultDetail=-40
00:02:11.878571 Console: Machine state changed to 'PoweredOff'
00:02:11.881384 Power up failed (vrc=VERR_TIMEOUT, rc=NS_ERROR_FAILURE (0X80004005))
00:02:12.156188 GUI: UIMachineViewNormal::resendSizeHint: Restoring guest size-hint for screen 0 to 1920x1080
00:02:12.156234 ERROR [COM]: aRC=E_ACCESSDENIED (0x80070005) aIID={4680b2de-8690-11e9-b83d-5719e53cf1de} aComponent={DisplayWrap} aText={The console is not powered up (setVideoModeHint)}, preserve=false aResultDetail=0
00:02:12.156280 GUI: Aborting startup due to power up progress issue detected...
00:02:12.173502 GUI: UICommon: Handling aboutToQuit request..
00:02:12.836312 GUI: UICommon: aboutToQuit request handled!
Built the raw disk device for a Thunderbolt-attached SSD as follows:

Code: Select all

frpmacpro:~ frizzo$ diskutil eject /dev/disk5

frpmacpro:~ frizzo$ diskutil apfs deleteContainer /dev/disk5

frpmacpro:~ frizzo$ diskutil list
...
/dev/disk4 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *160.0 GB   disk4
   1:                        EFI ⁨EFI⁩                     209.7 MB   disk4s1
                    (free space)                         159.8 GB   -


frpmacpro:~ frizzo$ diskutil eraseDisk FAT32 WINDOWS MBR /dev/disk4

frpmacpro:~ frizzo$ diskutil list
/dev/disk4 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *160.0 GB   disk4
   1:                 DOS_FAT_32 ⁨WINDOWS⁩                 160.0 GB   disk4s1

frpmacpro:~ frizzo$ vifs
LABEL=WINDOWS none  msdos  rw,noauto 0 0

frpmacpro:~ frizzo$ diskutil unmountDisk /dev/disk4

frpmacpro:~ frizzo$  sudo chown root:admin /dev/disk4*
frpmacpro:~ frizzo$  sudo chmod 660 /dev/disk4*

frpmacpro:~ frizzo$  VBoxManage internalcommands createrawvmdk -filename "/Volumes/FRP Master/Virtual Machines/Win10VM/rawvmsssd.vmdk" -rawdisk /dev/disk4

RAW host disk access VMDK file /Volumes/FRP Master/Virtual Machines/Win10VM/rawvmsssd.vmdk created successfully.

I then cloned the working .vdi disk image to the ssd vmdk placeholder file for the raw disk device.

Code: Select all

frpmacpro:Win10VM frizzo$  VBoxManage clonemedium disk {d9002cc3-27ac-4838-b519-86c27a1ef48a}.vdi rawvmsssd.vmdk --existing
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone medium created in format 'VMDK'. UUID: f99dbd4e-97bf-49d1-b14c-abe52bff65f4
with that done, I went into the settings in the GUI and removed the vdi file as device 0 from the SATA controller, and added the "rawvmsssd.vmdk" as device 0 in it's place.

Restart the VM and poof. nada. timeout and crash.
granada29
Volunteer
Posts: 687
Joined: 3. Mar 2015, 07:27
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Linux, macOS, Windows

Re: Raw disk support?

Post by granada29 »

Rawdisk on macOS is quite fiddly. You could try the utility VBoxRawDisk

I have used this successfully for a USB Windows-10 VM using whole disk rather than selected partitions. I had difficulty in using anything other SATA Port 0 as the disk controller.

Also - the syntax for creating the VMDK with VirtualBox 7.x is completely different from that used with VirtualBox 6.x
Post Reply