RawDisk access issue

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
jonnybignote
Posts: 6
Joined: 12. Sep 2010, 07:01
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Ubuntu

RawDisk access issue

Post by jonnybignote »

Hey all

I have perused the various topics related to making this happen for a usb disk and have used the instructions on the virtual box support page. Has something been deprecated again, or is my syntax off? I can't get past the initial step of creating the vmdk file, getting an error. Drive isn't mounted and I don't even need it bootable - I'm just trying to get it accessible as raw so I can run testdisk on it to recover partitions and files.

$ VBoxManage createmedium disk --filename path-to-file.vmdk --format=VMDK
--variant RawDisk --property RawDrive=/dev/disk4s1

I get the error

VBoxManage: error: unknown option: -RawDisk

Running latest VirtualBox-7.0.14-161095-OSX

Thanks in advance
granada29
Volunteer
Posts: 711
Joined: 3. Mar 2015, 07:27
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Linux, macOS, Windows

Re: RawDisk access issue

Post by granada29 »

Your syntax seems to be correct. However, there are a few things to consider.

1. Does path-to-file.vmdk contain any spaces? You maybe need quote chars if there are any spaces.
2. Try using /dev/disk4 (i.e. the whole drive, not just the first partition)
3. Look at using --property Partitions=x,y,z ...
4. Do you have ownership of /dev/disk4* ? You made need to:

Code: Select all

sudo chown username /dev/disk4*
Rawdisk is tricky and the error messages can sometimes be misleading.
jonnybignote
Posts: 6
Joined: 12. Sep 2010, 07:01
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Ubuntu

Re: RawDisk access issue

Post by jonnybignote »

Thanks for that.

I ran chown to be sure of it.

I included the quotes and now don't get the previous error, just new ones :) Changed to just disk4 (there's only 1 partition)

Here's my updated command

VBoxManage createmedium disk --filename "/Users/me/VirtualBox\ VMs/usbdrive.vmdk" --format=VMDK
--variant RawDisk --property RawDrive=/dev/disk4

I get the following returned

VBoxManage: error: Parameter --size is required

Usage - Create a new medium:

VBoxManage createmedium [disk | dvd | floppy] <--filename=filename>
[--size=megabytes | --sizebyte=bytes] [--diffparent= UUID | filename ]
[--format= VDI | VMDK | VHD ]
[--variant Standard,Fixed,Split2G,Stream,ESX,Formatted,RawDisk]
--property name=value... --property-file name=/path/to/file/with/value...
zsh: command not found: --variant

Thanks again
granada29
Volunteer
Posts: 711
Joined: 3. Mar 2015, 07:27
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Linux, macOS, Windows

Re: RawDisk access issue

Post by granada29 »

jonnybignote wrote: 8. Mar 2024, 22:05 VBoxManage createmedium disk --filename "/Users/me/VirtualBox\ VMs/usbdrive.vmdk" --format=VMDK
--variant RawDisk --property RawDrive=/dev/disk4
Remove the "\" character after VirtualBox, but leave the quotes around the file name.
Also - make sure that you only send one line of input - looks as though you may have copy/pasted and ended up with 2 commands instead of just one (the zsh error indicates this)
jonnybignote
Posts: 6
Joined: 12. Sep 2010, 07:01
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Ubuntu

Re: RawDisk access issue

Post by jonnybignote »

OK The subfolder was VirtualBox VMs, so I think I needed the backslash for the space. In any case I got rid of it.

I worked from the folder in question to avoid the need for path (I assume I can do that)

Pasted directly from VirtualBox manual to ensure no more than one line of input

VBoxManage createmedium disk --filename usbdrive.vmdk --format=VMDK
--variant RawDisk --property RawDrive=/dev/sda

Same message

VBoxManage: error: Parameter --size is required

Usage - Create a new medium:

VBoxManage createmedium [disk | dvd | floppy] <--filename=filename>
[--size=megabytes | --sizebyte=bytes] [--diffparent= UUID | filename ]
[--format= VDI | VMDK | VHD ]
[--variant Standard,Fixed,Split2G,Stream,ESX,Formatted,RawDisk]
--property name=value... --property-file name=/path/to/file/with/value...
zsh: command not found: --variant

Pls note I'm on OS X 11.7.10
granada29
Volunteer
Posts: 711
Joined: 3. Mar 2015, 07:27
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Linux, macOS, Windows

Re: RawDisk access issue

Post by granada29 »

You're still sending 2 separate lines I can re-create your eaxact error message with
VBoxManage createmedium disk --filename usbdrive.vmdk --format=VMDK

i.e nothing after VMDK

You need to send:

Code: Select all

VBoxManage createmedium disk --filename "/Users/me/VirtualBox VMs/usbdrive.vmdk" --format=VMDK --variant RawDisk --property RawDrive=/dev/disk4
If you click SELECT ALL and then copy from this CODE box, you will get only one line to paste into your terminal.
jonnybignote
Posts: 6
Joined: 12. Sep 2010, 07:01
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Ubuntu

Re: RawDisk access issue

Post by jonnybignote »

You nailed it - sorry, I didn't have my terminal window open wide enough so I didn't see the line break in there...

All working now

Many thanks again
granada29
Volunteer
Posts: 711
Joined: 3. Mar 2015, 07:27
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Linux, macOS, Windows

Re: RawDisk access issue

Post by granada29 »

I'm happy to hear that you got it all sorted out. RawDisk is difficult and has many quirks.

You may be interested in looking at VBoxRawdisk
This software is designed to create a VMDK for a bootable drive, so not directly applicable to your needs but may be of some use.
Post Reply