Physical drive + Admin rights = VERR_FILE_NOT_FOUND

Discussions related to using VirtualBox on Windows hosts.
Post Reply
vooyeQ
Posts: 4
Joined: 4. Mar 2022, 22:26

Physical drive + Admin rights = VERR_FILE_NOT_FOUND

Post by vooyeQ »

Hi there,

Struggling to mount physical drive on VM.
Any clues appreciated.

Host: Windows 10.
Guest: Linux.

Disk changed to offline in Disk Management.
All commands as well as VirtualBox itself executed in PowerShell with administrator rights.

Disk is fine, able to boot using real hardware.

PowerShell:

Code: Select all

PS C:\Program Files\Oracle\VirtualBox> ./VBoxManage internalcommands createrawvmdk -filename "i:/gentoo_physical.vmdk" -rawdisk //./PhysicalDrive3
RAW host disk access VMDK file i:/gentoo_physical.vmdk created successfully.

PS C:\Program Files\Oracle\VirtualBox> ./VirtualBox.exe
Tried to add file using Virtual Media Manager, error:

Code: Select all

Failed to open the disk image file I:\gentoo_physical.vmdk.

Could not find file for the medium 'I:\gentoo_physical.vmdk' (VERR_FILE_NOT_FOUND).

Result Code: VBOX_E_FILE_ERROR (0x80BB0004)
Component: MediumWrap
Interface: IMedium {ad47ad09-787b-44ab-b343-a082a3f2dfb1}
Callee: IVirtualBox {d0a0163f-e254-4e5b-a1f2-011cf991c38d}
Callee RC: VBOX_E_OBJECT_NOT_FOUND (0x80BB0001)
gentoo_physical.vmdk contents:

Code: Select all

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

# Extent description
RW 78165360 FLAT "//./PhysicalDrive3" 0

# 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="b30bf6f0-6e2b-4714-b5af-b4256eaf7175"
ddb.uuid.parent="00000000-0000-0000-0000-000000000000"
ddb.uuid.modification="00000000-0000-0000-0000-000000000000"
ddb.uuid.parentmodification="00000000-0000-0000-0000-000000000000" 
Thanks,
vQ
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Physical drive + Admin rights = VERR_FILE_NOT_FOUND

Post by scottgus1 »

vooyeQ wrote:Could not find file for the medium 'I:\gentoo_physical.vmdk' (VERR_FILE_NOT_FOUND).
The .vmdk is in the root folder of the I: drive. Drive roots have special permissions in modern Windows. Try putting the .vmdk in a subfolder on the I: drive. Since the file is so small it could actually go in the folder that holds the VM's .vbox file, instead.
vooyeQ
Posts: 4
Joined: 4. Mar 2022, 22:26

Re: Physical drive + Admin rights = VERR_FILE_NOT_FOUND

Post by vooyeQ »

Same result.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Physical drive + Admin rights = VERR_FILE_NOT_FOUND

Post by scottgus1 »

When the result is the same, that should be backed up with some evidence, such as the error message that happened. Otherwise forum gurus might think the suggestion was not followed correctly. Which happens a surprisingly large portion of the time.

Especially when the suggestion was actually two suggestions: I: subfolder, and the VM folder.

Also, is the I drive a physical drive or partition in a physical drive, or is it a mounted shared folder? Running a program as Admin is known to not allow access to previously-accessible drive-letter-mounted network folders, because the mounting instructions are inherent to the account the mount was made under, and running as admin is actually a different account.
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: Physical drive + Admin rights = VERR_FILE_NOT_FOUND

Post by fth0 »

Try using "\\.\PhysicalDrive3" instead of "//./PhysicalDrive3".
vooyeQ
Posts: 4
Joined: 4. Mar 2022, 22:26

Re: Physical drive + Admin rights = VERR_FILE_NOT_FOUND

Post by vooyeQ »

fth0 wrote:Try using "\\.\PhysicalDrive3" instead of "//./PhysicalDrive3".
Thank You, that was it.
scottgus1 wrote:When the result is the same, that should be backed up with some evidence, such as the error message that happened. Otherwise forum gurus might think the suggestion was not followed correctly. Which happens a surprisingly large portion of the time.
Regarding lack of effort :mrgreen:, even tried to provide screenshots, but as a newcomer I wasn't allowed to ;)

Anyways, using fth0's tip tried 3 paths, all of them worked:
- root dir ( well VBoxManage was able to create VMDK file in root so "should" be able to read it )

Code: Select all

i:\gentoo_physical.vmdk
- root dir/subfolder:

Code: Select all

i:\subfolder\gentoo_physical.vmdk
- VM's folder with blanks/spaces and underscores in path:

Code: Select all

i:\_VBOX_\gentoo zlom new\gentoo_zlom\gentoo_physical.vmdk
I:\ is a physical drive.

--
Thanks.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Physical drive + Admin rights = VERR_FILE_NOT_FOUND

Post by scottgus1 »

vooyeQ wrote:tried to provide screenshots, but as a newcomer I wasn't allowed to
Pictures can be posted using the forum's Upload Attachment tab on the first day first post.

Text output of an error message like the error message you posted before counts as evidence:
vooyeQ wrote:

Code: Select all

Failed to open the disk image file I:\gentoo_physical.vmdk.

Could not find file for the medium 'I:\gentoo_physical.vmdk' (VERR_FILE_NOT_FOUND).
And no screenshot needed.
vooyeQ wrote:
fth0 wrote:Try using "\\.\PhysicalDrive3" instead of "//./PhysicalDrive3".
Thank You, that was it.
Ah yes, good ol' syntax error. Sounds like the VERR_FILE_NOT_FOUND was pointing at the failure to find the drive, not failing to find the drive file... Will have to remember that.

Good eye fth0!

Glad you're up and running, vooyeQ!
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: Physical drive + Admin rights = VERR_FILE_NOT_FOUND

Post by fth0 »

scottgus1 wrote:
vooyeQ wrote:
fth0 wrote:Try using "\\.\PhysicalDrive3" instead of "//./PhysicalDrive3".
Thank You, that was it.
Ah yes, good ol' syntax error. Sounds like the VERR_FILE_NOT_FOUND was pointing at the failure to find the drive, not failing to find the drive file... Will have to remember that.
Some additional details:

For compatibility with shells of other OSes (e.g. Linux), the Windows PowerShell accepts device names and file system paths written with the "\" and "/" separators. VirtualBox doesn't do that on Windows hosts (at least not consistently).
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: Physical drive + Admin rights = VERR_FILE_NOT_FOUND

Post by mpack »

fth0 wrote:VirtualBox doesn't do that on Windows hosts (at least not consistently).
As you say, not consistently, i.e. some parts do it and some don't. If you look at the media paths in pretty much any .vbox file you will very likely see a mix of path separators (though most are '/'). Because of this I would never have detected the above typo because I've been trained to regard the difference as unimportant! I'm still surprised that it is treated as an error... in fact it may be worth raising a BugTracker ticket for this.

It may have something to do with "\\.\" being regarded as a device name prefix, not a path.
vooyeQ
Posts: 4
Joined: 4. Mar 2022, 22:26

Re: Physical drive + Admin rights = VERR_FILE_NOT_FOUND

Post by vooyeQ »

Yup, looks like some inconsistency there.

VBoxManage accepts "//./" prefix while main app does not.
scottgus1 wrote:Pictures can be posted using the forum's Upload Attachment tab on the first day first post.
True, tried to insert links to images not the images themselves.
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: Physical drive + Admin rights = VERR_FILE_NOT_FOUND

Post by mpack »

vooyeQ wrote: VBoxManage accepts "//./" prefix while main app does not.
It looks to me like the other way around: the main app (VBoxManage) accepts "//./", it's the VMDK handler which does not. Possibly that code was donated by VMWare, or the devs used the VMWare SDK.

A simple fix btw would just have been to edit the teeny vmdk text descriptor to correct the device name of the raw extent.
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: Physical drive + Admin rights = VERR_FILE_NOT_FOUND

Post by fth0 »

FWIW, it's indeed in the VMDK handling code, see VMDK.cpp?rev=93115#L2916. The interesting part including some telltale comments begins in Line 2965 (RTPATH_SLASH is one of the host OS dependent constants).
Post Reply