Raw Disk Access -- Not Working in 4.1.4?

Discussions related to using VirtualBox on Linux hosts.
Post Reply
brandonkirsch
Posts: 12
Joined: 9. May 2011, 17:56
Primary OS: openSUSE
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win7

Raw Disk Access -- Not Working in 4.1.4?

Post by brandonkirsch »

Hi everyone. I'm a long time Linux and VMWare user, but I'm still somewhat new to VirtualBox. I dug through the manual today to find out how to create and enable "raw disk" access so that way my guest VM can have "native" access to one of my raw partitions on the host's physical drive.

I ran through the variations of "VBoxManage internalcommands createrawvmdk" that are listed in the manual. If I use my root account, I have no troubles creating a "raw disk" VMDK. It lets me create one for the whole disk (do NOT want!) as well as create one for just a single partition, with or without the -relative option, it all seems good.

However, once I create those VMDKs, I can't add them as storage to any of my VirtualBox VMs, whether I am running a user or as root. Both the GUI and `VboxManage storageattach` give me an error that says "Failed to open the hard disk [...]/RawSDA4.vmdk. The medium [...]/RawSDA4.vmdk can't be used as the requested device type." I've tried attaching to IDE, SATA and even added a SCSI, I just can't seem to load up a raw disk VMDK.

So, what's the deal? Is this a bug in VirtualBox? Here are some of my system details, and step-by-step to reproduce the issue:
# fdisk -l

Disk /dev/sda: 250.1 GB, 250059350016 bytes
...
Disk identifier: 0x08aa2b1d

Device Boot Start End Blocks Id System
/dev/sda1 2048 16771071 8384512 82 Linux swap / Solaris
/dev/sda2 * 16771072 121628671 52428800 83 Linux <-- HOST OS
/dev/sda3 121628672 226484223 52427776 7 HPFS/NTFS/exFAT
/dev/sda4 226484224 488397167 130956472 7 HPFS/NTFS/exFAT <-- Target for Raw Disk Access (not mounted by Host OS :lol: )
The last command I used to generate the raw disk VMDK:
Command (as root):
# VBoxManage internalcommands createrawvmdk -filename "/home/bkirsch/VirtualBox/Windows 7/RawSDA4.vmdk" -rawdisk /dev/sda -partitions 4

Output:
RAW host disk access VMDK file /home/bkirsch/VirtualBox/Windows 7/RawSDA4.vmdk created successfully.
When using the -partitions flag, I notice that two files are created: RawSDA4.vmdk and RawSDA4-pt.vmdk. I chown both of those to my own user account, since I ran the command as root. Next I'll borrow another command line from the manual to attach the storage to my VM:
Command (as user):
~ VBoxManage storageattach "Windows 7" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /home/bkirsch/VirtualBox/Windows\ 7/RawSDA4.vmdk

Output:
VBoxManage: error: The medium '/home/bkirsch/VirtualBox/Windows 7/RawSDA4.vmdk' can't be used as the requested device type
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component Medium, interface IMedium, callee nsISupports
Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, AccessMode_ReadWrite, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 210 of file VBoxManageDisk.cpp
VBoxManage: error: Invalid UUID or filename "/home/bkirsch/VirtualBox/Windows 7/RawSDA4.vmdk"
I know raw disk access is for experts, and I really do know what I'm doing here (I've used raw partition access in VMWare for years) but I think I've hit a bug in either documentation or VirtualBox itself.

Thanks in advance for any advice you can give me.
brandonkirsch
Posts: 12
Joined: 9. May 2011, 17:56
Primary OS: openSUSE
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win7

Re: Raw Disk Access -- Not Working in 4.1.4?

Post by brandonkirsch »

A Windows-host user who seems to know what he's doing is having trouble as well. He posted just last week.

Here is a link to his post, if anything this note will serve as a reminder to myself to send him a message once I get the issue resolved.
alun
Posts: 9
Joined: 11. Nov 2011, 07:05
Primary OS: openSUSE
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win7, Win2K3, Win2K8, openSUSE (varoius: for services and testing)

Re: Raw Disk Access -- Not Working in 4.1.4?

Post by alun »

I also having a similar problem with my Linux host, though I trying with LVM LV instead of physical HD partition. Here
UzliUgzli (Guy Dafny)
Posts: 1
Joined: 3. Apr 2012, 13:55

Re: Raw Disk Access -- Not Working in 4.1.4?

Post by UzliUgzli (Guy Dafny) »

I had similar problem using Windows7 as host, while trying to use USB memory card as guest.
the vmdk file was created with the command line:

Code: Select all

C:\Program Files\Oracle\VirtualBox>VBoxManage internalcommands createrawvmdk -filename "%USERPROFILE%"\.VirtualBox\usb.vmdk -rawdisk \\.\PhysicalDrive1
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Raw Disk Access -- Not Working in 4.1.4?

Post by mpack »

See this thread. In particular note Korkman's second post (overall third message) in that thread.

The problem is with Windows (Vista or later). It has nothing to do with VirtualBox, and certainly nothing to do with a particular VBox version.
Post Reply