1

I am trying to run a VirtualBox machine from a physical disk.

I read that I have to run

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" internalcommands createrawvmdk -filename C:\PhysicalDrive2.vmdk -rawdisk \\.\PHYSICALDRIVE2

This worked once, but then I had to change disk (e.g. \\.\PhysicalDrive1), but after running the above command (changing PhysicalDrive2 to PhysicalDrive1) this is what I get:

The 'createrawvdk' subcommand is deprecated.  The equivalent functionality is
available using the 'VBoxManage createmedium' command and should be used
instead.  See 'VBoxManage help createmedium' for details.

0%...VBOX_E_FILE_ERROR
VBoxManage.exe: error: Failed to create medium
VBoxManage.exe: error: Could not create the medium storage unit 'C:\PhysicalDrive1.vmdk'.
VBoxManage.exe: error: VMDK: Image path: 'C:\PhysicalDrive1.vmdk'. Failed to open the raw drive '\\.\PHYSICALDRIVE1' for reading (VERR_ACCESS_DENIED) (VERR_ACCESS_DENIED).
VBoxManage.exe: error: VMDK: could not create raw descriptor for 'C:\PhysicalDrive1.vmdk' (VERR_ACCESS_DENIED)
VBoxManage.exe: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component MediumWrap, interface IMedium
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleCreateMedium(struct HandlerArg *)" at line 634 of file VBoxManageDisk.cpp

About that "subcommand deprecated" thing: I tried to use the createmedium command, but I haven't found a way to make it work with physical drives.

Note 1: after I got that error using PhysicalDrive1, I tried to create another medium using PhysicalDrive2 (thinking that I could switch the disk number somehow, maybe plugging the devices in different orders) but now it won't work either.

Note 2: I have already tried running commands in Admin cmd.exe.

Edit 1: I found something (it seems to be a more updated version on VirtualBox Manuals), but there is no reference to "accessing a physical disk"...

Edit 2: I belive this could be related to Windows Insiders. I had other problems related to virtualization when using a non-stable Windows release.

3
  • Well you can refer to the manual for the new syntax. I have no idea about the access denied error though.
    – Tom Yan
    Jan 2 at 9:41
  • Apparently, that website is down (or at least non available in my region - Europe) at the moment...
    – ciao1092
    Jan 2 at 9:42
  • Changed dns settings, and now it works... Btw, that was what I read I had to do, but it still does not work
    – ciao1092
    Jan 2 at 9:44

2 Answers 2

1

TLDR: You need to make sure that VboxSVC.exe runs as administratior - locate this file and set compatibility option - run as administrator.

Detailed:

In VirtualBox any work with registered virtual machines performed via VBoxSVC.exe, regardless of what you use - Command Line Interface VboxManage.exe or Graphical User Interface VirtualBox.exe.

This VboxSVC.exe launches as regular, non elevated user even when, for example, Graphical User Interface VirtualBox.exe is launched elevated (as administrator).

Any other operations runs direcly in relevant applications - VBoxManage createmedium command runs directly via VboxManage.exe.

This results in a joke situation, when you can create VMDK for physical drive with elevated VboxManage just fine, but in no way can attach it to virtual machine via same elevated VboxManage or even via elevated GUI, because disk attachment handled via non-elevated VboxSVC.exe.

So, you need to make sure that VboxSVC.exe runs as administratior:

  1. Locate VBoxSVC.exe file ("%PROGRAMFILES%\Oracle\VirtualBox\VBoxSVC.exe") by default.
  2. Right click it.
  3. Click Properties.
  4. Click Compatibility tab.
  5. Either check Run this program as administrator or click Change settings for all users and click Run this program as administrator in opened window.
  6. Click OK.
1
  • This worked for me in 2023 / Windows 10 22H2. Could not create raw vmdk and after doing this it worked fine in an administrator cmd. Aug 30 at 19:43
0

I was having the same problem with createmedium command (createrawvmdk is depreciated so avoid using it). I was using a USB flash drive and command worked only first time. While troubleshooting and trying again and again, I did a blind guess that maybe device is in use and locked.

Turns out it was a lucky guess. I ejected the flash drive from context menu in Windows Explorer, and removed the flash drive. After a few minutes of sleep, I woke up and inserted the flash drive again, ran the command I used first time and it worked!

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" createmedium disk --filename=slax-pendrive.vmdk --format=VMDK --variant RawDisk --property RawDrive=\\.\PHYSICALDRIVE2

Do not know if it helped or not but during troubleshooting, I had also removed the old vmdk files and the links within Virtual Box (from VM Settings > Storage, and Tools > Hard Disks).

Update: While the VMDK was created, it was still corrupt. But that is another issue. I am still trying to fix it.

Update: I faced this issue again and eject didn't work either. So this time, I checked for running virtual box instances in task manager.

task manger

I ended these two tasks namely VirtualBox Interface and VirtualBox Global Interface. After that tried running the command again. The command worked this time without eject, and I was able to attach and use the disk file by running Virtual box as administrator too.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .