Raw Disk on macOS Ventura

Temporary forum to discuss issues and problems during a VirtualBox Beta or Release Candidate phase.
Post Reply
granada29
Volunteer
Posts: 730
Joined: 3. Mar 2015, 07:27
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Linux, macOS, Windows

Raw Disk on macOS Ventura

Post by granada29 »

I have installed and run VirtualBox 7.0 beta1 on macOS Ventura. Running a debian linux VM from a .vdi disk image works well, loading all devices (network etc) just as I hoped it would.

I then tried to create a raw disk vmdk and run a linux installation from an external disk.
Using 'VBoxManage createmedium disk' I am successfully creating a raw .vmdk image (see User Manual 9.7.1.2) and from what I see in the log, this .vmdk is being accepted as valid by VirtualBox.

When I attempt to run the VM, the uefi loader is unable to access the disk partitions and I am stuck in a uefi shell with no visible disks. This snippet (from the attached log) shows the disk errors and then falling back to loading the uefi shell.

Code: Select all

00:00:04.746193 ATA: LUN#0: EXECUTE DEVICE DIAGNOSTIC, status 50
00:00:04.747587 ATA: LUN#0: INITIALIZE DEVICE PARAMETERS: 63 sectors per track, 16 heads
00:00:04.753889 ATA: LUN#1: EXECUTE DEVICE DIAGNOSTIC, status 00
00:00:04.766235 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x2 cSectors=0x1)
00:00:04.767160 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x0 cSectors=0x1)
00:00:04.767574 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x0 cSectors=0x1)
00:00:04.767968 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x40 cSectors=0x4)
00:00:04.768362 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x40 cSectors=0x1)
00:00:04.768819 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x0 cSectors=0x1)
00:00:04.769232 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x0 cSectors=0x1)
00:00:04.769639 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x2 cSectors=0x1)
00:00:04.798272 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x2 cSectors=0x1)
00:00:04.798736 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x0 cSectors=0x1)
00:00:04.799162 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x0 cSectors=0x1)
00:00:04.799587 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x40 cSectors=0x4)
00:00:04.800008 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x40 cSectors=0x1)
00:00:04.800425 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x0 cSectors=0x1)
00:00:04.800873 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x0 cSectors=0x1)
00:00:04.801306 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x2 cSectors=0x1)
00:00:04.830747 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x2 cSectors=0x1)
00:00:04.831212 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x0 cSectors=0x1)
00:00:04.831653 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x2 cSectors=0x1)
00:00:04.832153 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x2 cSectors=0x1)
00:00:04.832583 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x0 cSectors=0x1)
00:00:04.833001 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x0 cSectors=0x1)
00:00:04.833995 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x40 cSectors=0x4)
00:00:04.834567 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x40 cSectors=0x1)
00:00:04.845040 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x0 cSectors=0x1)
00:00:04.845497 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x0 cSectors=0x1)
00:00:04.845935 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x2 cSectors=0x1)
00:00:04.846375 PIIX3 ATA: LUN#0: disk read error (rc=VERR_INVALID_PARAMETER iSector=0x0 cSectors=0x1)
00:00:04.852648 EFI: VBoxDbg> loadimage64 'Shell.efi' 0xddc10000 LB 0xdda60
I am not sure if this is a problem with the new .vmdk or is a quirk of macOS Ventura. I have granted fill disk access to VirtualBoxVM but this seems to have made no difference. All the /dev/disk* devices associated with the external disk are owned by me.

This same external disk (using the earlier command to create the .vmdk) works very well under VirtualBox 6.1 on macOS Monterey.
Attachments
VBox.log.zip
(36.2 KiB) Downloaded 530 times
granada29
Volunteer
Posts: 730
Joined: 3. Mar 2015, 07:27
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Linux, macOS, Windows

Re: Raw Disk on macOS Ventura

Post by granada29 »

Testing raw disk with VirtualBox 7.0 beta2 on both macOS Monterey and macOS Ventura is still failing, with no visible disks in the uefi shell. I have tested both whole disk access and specified partitions.

I have attached a session log, and associated .vbox and .vmdk files for partitioned access.
Attachments
Rawdisk.zip
(35.08 KiB) Downloaded 536 times
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Raw Disk on macOS Ventura

Post by fth0 »

LinuxRawPartition.vmdk wrote:
ddb.geometry.cylinders="1"
ddb.geometry.heads="16"
ddb.geometry.sectors="63"
I didn't check the VMDK specification by now, but this number of cylinders is probably part of your problem ...

Just in case the information is needed, what's in partitions 1, 3 and 4?
granada29
Volunteer
Posts: 730
Joined: 3. Mar 2015, 07:27
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Linux, macOS, Windows

Re: Raw Disk on macOS Ventura

Post by granada29 »

fth0 wrote:
LinuxRawPartition.vmdk wrote:
ddb.geometry.cylinders="1"
ddb.geometry.heads="16"
ddb.geometry.sectors="63"
I didn't check the VMDK specification by now, but this number of cylinders is probably part of your problem ...

Just in case the information is needed, what's in partitions 1, 3 and 4?
Thanks for taking a look. I'll see how this .vmdk compares to the one generated by VirtualBox 6.1 - you may be on to something.

The partitions on the disk are:
1. EFI
2. macOS APFS container
3. Linux root
4. Linux swap
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Raw Disk on macOS Ventura

Post by fth0 »

In the meantime I checked a well-known unofficial VMDK specification (VMDK Handbook - Basics). Since your physical disk is larger than 8 GB, ddb.geometry.cylinders should be "16383". Additionally, the last extent specification is probably much too large (~18,000 TB ;)).
granada29
Volunteer
Posts: 730
Joined: 3. Mar 2015, 07:27
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Linux, macOS, Windows

Re: Raw Disk on macOS Ventura

Post by granada29 »

I tried using a .vmdk generated by VirtualBox 6.1 with VirtualBox 7.0-beta2. After fixing the /dev/disk* devices in the vmdk, it works perfectly, so the problem definitely lies with generating the .vmdk and not with the VirtualBox runtime.

The host OS is macOS Monterey 12.6 in both cases. Please ignore the reference to Ventura in the topic title.

The disk devices are different in the 2 cases but that is expected.

Hopefully one of the devs who frequent the forum will be able to take a look at this.

Edit: fixed VirtualBox-7 .vmdk listing, added partition table listing

Partition Table

Code: Select all

VBoxManage internalcommands listpartitions -rawdisk /dev/disk5
Number  Type   StartCHS       EndCHS      Size (MiB)  Start (Sect)
1       0x00  0   /0  /0   0   /0  /0            200           40
2       0x00  0   /0  /0   0   /0  /0         286102       409640
3       0x00  0   /0  /0   0   /0  /0        1590909    586347136
4       0x00  0   /0  /0   0   /0  /0          30517   3844529120
VMDK creation with VirtualBox 6.1

Code: Select all

09:51:52.076 /usr/local/bin/VBoxManage internalcommands createrawvmdk -filename /Volumes/VirtualBox/Virtualbox/Linux/LinuxRawPartition/LinuxRawPartition.vmdk -rawdisk /dev/disk5 -partitions 1,3,4
09:51:52.640 RAW host disk access VMDK file /Volumes/VirtualBox/Virtualbox/Linux/LinuxRawPartition/LinuxRawPartition.vmdk created successfully.

Code: Select all

# Disk DescriptorFile
version=1
CID=6123e700
parentCID=ffffffff
createType="partitionedDevice"

# Extent description
RW 40 FLAT "LinuxRawPartition-pt.vmdk" 0
RW 409600 FLAT "/dev/disk5s1" 0
RW 585937496 ZERO 
RW 3258181984 FLAT "/dev/disk5s3" 0
RW 62500008 FLAT "/dev/disk5s4" 0
RW 7 ZERO 
RW 33 FLAT "LinuxRawPartition-pt.vmdk" 40

# The disk Data Base 
#DDB

ddb.virtualHWVersion = "4"
ddb.adapterType="ide"
ddb.geometry.cylinders="16383"
ddb.geometry.heads="16"
ddb.geometry.sectors="63"
ddb.uuid.image="43f32279-5ecc-4738-9fb0-489b388a82b4"
ddb.uuid.parent="00000000-0000-0000-0000-000000000000"
ddb.uuid.modification="00000000-0000-0000-0000-000000000000"
ddb.uuid.parentmodification="00000000-0000-0000-0000-000000000000"

VMDK creation with VirtualBox 7.0.0-beta2

Code: Select all

09:32:58.905 /usr/local/bin/VBoxManage createmedium disk --filename /Volumes/VirtualBox/Virtualbox/Linux/LinuxRawPartition/LinuxRawPartition.vmdk --format=VMDK --variant RawDisk --property RawDrive=/dev/disk7 --property Partitions=1,3,4
09:34:07.509 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
09:34:07.510 Medium created. UUID: c1876190-87a6-4b1d-86a0-2a7c92e46b2d

Code: Select all

# Disk DescriptorFile
version=1
CID=ab0445c9
parentCID=ffffffff
createType="partitionedDevice"

# Extent description
RW 1 FLAT "LinuxRawPartition-pt.vmdk" 0
RW 39 FLAT "LinuxRawPartition-pt.vmdk" 1
RW 409600 FLAT "/dev/disk7s1" 0
RW 585937496 ZERO 
RW 3258181984 FLAT "/dev/disk7s3" 0
RW 62500008 FLAT "/dev/disk7s4" 0
RW 36028793111934840 ZERO 

# The disk Data Base 
#DDB

ddb.virtualHWVersion = "4"
ddb.adapterType="ide"
ddb.uuid.image="aecb9406-41e9-4c5d-a681-4dd00e3a9abf"
ddb.uuid.parent="00000000-0000-0000-0000-000000000000"
ddb.uuid.modification="00000000-0000-0000-0000-000000000000"
ddb.uuid.parentmodification="00000000-0000-0000-0000-000000000000"
ddb.geometry.cylinders="1"
ddb.geometry.heads="16"
ddb.geometry.sectors="63"
Last edited by granada29 on 15. Sep 2022, 05:03, edited 1 time in total.
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Raw Disk on macOS Ventura

Post by fth0 »

FWIW, a VirtualBox developer might be interested in seeing the original partition table. ;)
granada29
Volunteer
Posts: 730
Joined: 3. Mar 2015, 07:27
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Linux, macOS, Windows

Re: Raw Disk on macOS Ventura

Post by granada29 »

fth0 wrote:FWIW, a VirtualBox developer might be interested in seeing the original partition table. ;)
Thanks. I've added the partition table.
granada29
Volunteer
Posts: 730
Joined: 3. Mar 2015, 07:27
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Linux, macOS, Windows

Re: Raw Disk on macOS Ventura

Post by granada29 »

Still not working with BETA3 - the vmdk was generated using the same command as detailed above for BETA2.

Code: Select all

# Disk DescriptorFile
version=1
CID=bbd938a5
parentCID=ffffffff
createType="partitionedDevice"

# Extent description
RW 1 FLAT "LinuxRawPartition-pt.vmdk" 0
RW 39 FLAT "LinuxRawPartition-pt.vmdk" 1
RW 409600 FLAT "/dev/disk7s1" 0
RW 585937496 ZERO 
RW 3258181984 FLAT "/dev/disk7s3" 0
RW 62500008 FLAT "/dev/disk7s4" 0
RW 36028793111934840 ZERO 

# The disk Data Base 
#DDB

ddb.virtualHWVersion = "4"
ddb.adapterType="ide"
ddb.uuid.image="1b5c2c14-c712-4d92-8462-a30a72021aa0"
ddb.uuid.parent="00000000-0000-0000-0000-000000000000"
ddb.uuid.modification="00000000-0000-0000-0000-000000000000"
ddb.uuid.parentmodification="00000000-0000-0000-0000-000000000000"
ddb.geometry.cylinders="1"
ddb.geometry.heads="16"
ddb.geometry.sectors="63"
granada29
Volunteer
Posts: 730
Joined: 3. Mar 2015, 07:27
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Linux, macOS, Windows

Re: Raw Disk on macOS Ventura

Post by granada29 »

I have raised bug report at https://www.virtualbox.org/ticket/21125
paulson
Oracle Corporation
Posts: 28
Joined: 6. Jun 2019, 20:16

Re: Raw Disk on macOS Ventura

Post by paulson »

I have raised bug report at https://www.virtualbox.org/ticket/21125
This issue has been resolved in VirtualBox 7.0.4 which was just released
(today, November 18th, 2022) and is available for download from
https://www.virtualbox.org/wiki/Downloads.
Post Reply