Raw Disk Access in Windows 8.1

Discussions related to using VirtualBox on Windows hosts.
Post Reply
TechMedicNYC
Posts: 2
Joined: 29. Nov 2013, 03:57

Raw Disk Access in Windows 8.1

Post by TechMedicNYC »

Hi,

Is it not possible to access raw disks from Windows 8.1 x64 Host?

I'm trying to access a 3TB GPT SATA disk.

There are two problems I'm experiencing.

#1) createrawvmdk does not appear to work for sata drives in Windows 8.1 (it did work for a USB Flash drive).
Flash drive success:

Code: Select all

c:\Program Files\Oracle\VirtualBox>VBoxManage.exe internalcommands createrawvmdk -filename "c:\Users\Admin\Documents\USBDrive.vmdk" -rawdisk "\\.\PhysicalDrive3"
RAW host disk access VMDK file c:\Users\Admin\Documents\test.vmdk created successfully.
SATA drive failure:

Code: Select all

c:\Program Files\Oracle\VirtualBox>VBoxManage.exe internalcommands createrawvmdk -filename "c:\Users\Admin\Documents\PhysicalDrive.vmdk" -rawdisk "\\.\PhysicalDrive0"
VBoxManage.exe: error: Cannot open the raw disk '\\.\PhysicalDrive0': VERR_SHARING_VIOLATION
VBoxManage.exe: error: The raw disk vmdk file was not created
The SATA drive has been offlined, so I don't understand where the sharing violation error is coming from. Besides, the flash drive is actually ONLINE and it had no problem.

Code: Select all

c:\Program Files\Oracle\VirtualBox>diskpart

Microsoft DiskPart version 6.3.9600

Copyright (C) 1999-2013 Microsoft Corporation.
On computer: TEST

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Offline        2794 GB      0 B        *
  Disk 3    Online         7640 MB  7168 KB

DISKPART>
I did create a vmdk file from linux, and modified the contents to point to the Windows Physical Disk.
Modified file contents of test.vmdk:

Code: Select all

# Disk DescriptorFile
version=1
CID=xxxxxxx
parentCID=ffffffff
createType="fullDevice"

# Extent description
RW 5860533168 FLAT "\\.\PhysicalDrive0" 0

# The disk Data Base 
#DDB

ddb.virtualHWVersion = "4"
ddb.adapterType="sata"
ddb.geometry.cylinders="16383"
ddb.geometry.heads="16"
ddb.geometry.sectors="63"
ddb.uuid.image="xxxxxxxxxxxxx"
ddb.uuid.parent="00000000-0000-0000-0000-000000000000"
ddb.uuid.modification="00000000-0000-0000-0000-000000000000"
ddb.uuid.parentmodification="00000000-0000-0000-0000-000000000000"

#2) VirtualBox believes the raw disk is set to read-only.
Using the Linux created vmdk, VirtualBox thinks the disk is read-only...
However, this is not true. Again, looking at disk part:

Code: Select all

DISKPART> attribute disk
Current Read-only State : No
Read-only  : No
Boot Disk  : No
Pagefile Disk  : No
Hibernation File Disk  : No
Crashdump Disk  : No
Clustered Disk  : No
When I look at the storage properties of the guest, I can select the raw disk and the information panel shows the correct drive metadata such as Virtual Size, Actual Size (2.73 TB). So it is looking at the right disk. However, when I try to start the VM, it returns the error:

Code: Select all

Failed to open a session for the virtual machine
Failed to open image 'C:\Users\Admin\Documents\PhysicalDisk.vmdk' for writing due to wrong permissions (VERR_VD_IMAGE_READ_ONLY).
Failed to attach driver below us! Image is read-only. (VERR_VD_IMAGE_READ_ONLY).
AHCI: Failed to attach drive to Port1 (VERR_VD_IMAGE_READ_ONLY).
How do I get this to work?

Thanks in advance.
TechMedicNYC
Posts: 2
Joined: 29. Nov 2013, 03:57

Re: Raw Disk Access in Windows 8.1

Post by TechMedicNYC »

After digging around for some time I came across this post:
viewtopic.php?f=6&t=38914#p175089

Where user bsod, mentions processes that are attached to the disk. I didn't expect anything to be reading the disk, but it turns out that Intel Desktop Utilities (iduServ.exe, FSCAppServ.exe) has a process handle to monitor the hard drive temperature.

Thus, the solution is to use Process Explorer 64 (Run as Administrator). Go to Find -> Find Handle or DLL (CTRL-F). On the next dialog search for the offending handle to the physical drive; e.g., search for "Harddisk0" for PhysicalDisk0. Kill the process or close the handles. I opted to kill the process, since PE64 warned closing handles could lead to crashes.

I was able to start the VM with full R/W access to the physical disk after this.
Post Reply