Page 1 of 1

Win8 : Unable to use raw disk. Prob. permission error

Posted: 18. Jan 2013, 20:39
by r0k
Hi. i have a computer with dual-boot Win8 and Ubuntu. I'm trying to "virtualize" this dual boot so i can use both OSs at the same time. My most resource-hungry applications being in windows i decided to use Win8 as the host. However, my disk is already partitionned for dual-boot and i'd like to keep the ability to boot directly to Ubuntu if i need to, so i decided i would try and use VirtualBox ability to "map" an existing partition as a virtual drive.
So i followed the manual and (using PowerShell because i can customize the size, but i get the same output with cmd.exe)

Code: Select all

PS C:\Users\Roland> VBoxManage internalcommands listpartitions -rawdisk \\.\PhysicalDrive0
VBoxManage.exe: error: Cannot open the raw disk: VERR_ACCESS_DENIED
After several attempts, i started PowerShell as administrator and it worked immediately. So i created the vmdk (still in admin shell)

Code: Select all

VBoxManage internalcommands createrawvmdk -filename C:\VirtualBox\Ubuntu.vmdk -rawdisk \\.\PhysicalDrive0 -partitions "5,6"
I installed VirtualBox outside the Programs folder so Windows UAC wouldn't be an annoyance if i had to change something manually. I had to put the partition numbers in quotes to get them both as a single parameter.
It worked immediately and created 2 vmdk files : Ubuntu.vmdk and Ubuntu-pt.vmdk. I suppose it's the expected behaviour.
However, when i tried to add the vmdk to my virtual machine (using the GUI), i got an error po-up. So i started PowerShell again (in normal user mode) and

Code: Select all

PS C:\Users\Roland> VBoxManage storageattach VB_Ubuntu --storagectl "Contrôleur SATA" --port 0 --device 0 --type hdd --medium C:\VirtualBox\Ubuntu.vmdk
VBoxManage.exe: error: Permission problem accessing the file for the medium 'C:\VirtualBox\Ubuntu.vmdk' (VERR_ACCESS_DENIED)
VBoxManage.exe: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component Medium, interface IMedium, callee IUnknown
VBoxManage.exe: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 178 of file VBoxManageDisk.cpp
VBoxManage.exe: error: Invalid UUID or filename "C:\VirtualBox\Ubuntu.vmdk"
Back to admin mode, i was able to attach the vmdk, but then when i start VirtualBox (the GUI), i get an error message about the disk image being inaccessible, and i can't start the VM.
If i run VirtualBox as admin, i don't have any error and i can start the VM (ubuntu doesn't boot correctly, but that's another point, the VM itself does work). However, i don't like running applications as admin. This is probably caused by me also using Linux where everyone tells you to never get an application running as the superuser by default.

Does anyone have an idea how i can get VirtualBox to accept the vmdk i created as admin. I tried changing the permissions, setting every user to full access and changing owner from admin to my user account, but that didn't help.

Re: Win8 : Unable to use raw disk. Prob. permission error

Posted: 19. Jan 2013, 15:58
by r0k
Not sure what keywords i used for the search yesterday but they only returned threads from the Linux Host sub forum. Today i found other similar : threads here in the windows host sub-forum :oops:

Looks like this has to do with windows blocking access to the Partitions, however, those Linux partitions are ext3 format and NOT visible under windows, so i'm not sure why Win would lock them. :?
Seems like most people "solved" this by running VirtualBox in admin mode, so this should be an issue with authorisations right? Now how would i give VBox permissions to my partitions without running it as admin ... I tried giving "System" full access to my vmdk files (as System is the owner of VBox) but this didn't help either.

Re: Win8 : Unable to use raw disk. Prob. permission error

Posted: 19. Jan 2013, 16:17
by noteirak
Edit : missread this for a linux host problem
See mpack's reply.

Re: Win8 : Unable to use raw disk. Prob. permission error

Posted: 20. Jan 2013, 11:57
by mpack
Actually, a Windows host will not be aware of permission flags in foreign filesystems. Sector level access to the drive is the problem here, and that requires admin rights. It also requires a user who really knows what he's doing, if he doesn't want to wipe what's in those partitions.

Re: Win8 : Unable to use raw disk. Prob. permission error

Posted: 20. Jan 2013, 12:57
by r0k
Well, i'm not a computer expert but most of the time i'm able to understand what i'm trying to do and do it if it's doable (even though i can use bad key-words for the search :wink: ). However, i'm new to (modern) virtualization.
If i must always run VBox as admin, it's an annoyance. Why can't win has easy to use/set permissions like Linux, oh well, it wouldn't be windows if we could configure it the way we want rather than the way MS wants :roll:

Is there another way to have a Linux OS that i can boot directly or within VBox than using direct pertitions? Is there some way to boot linux from some virtual drive like Win can? Or is it possible to use an LVM volume as a VBox virtual disk? Would it help if i move Win to another disk (i'll probably move it to an SSD sooner or later)?

Re: Win8 : Unable to use raw disk. Prob. permission error

Posted: 20. Jan 2013, 15:12
by mpack
Sorry, but there's not really two sides to this. Sector level access obviously allows an application to bypass all security features, so there simply aint no way a modern OS is going to allow that as a non-privileged operation, or at least not by default. But no, there is no other way that I know of to let a Linux VM access real Linux partitions on a Windows host. Personally I would have two separate Linux installations, one pure VM and one native boot. In fact I'm not primarily a Linux user, so I wouldn't bother with the dual boot installation.

Re: Win8 : Unable to use raw disk. Prob. permission error

Posted: 20. Jan 2013, 16:02
by r0k
mpack wrote:Personally I would have two separate Linux installations, one pure VM and one native boot.
Thanks. That's probably what i'll end up doing, but at least i need a way to share my home folder between those. Well back to the search engine then.

Re: Win8 : Unable to use raw disk. Prob. permission error

Posted: 20. Jan 2013, 17:10
by mpack
Sharing your native Linux home folder will likely raise permissions issues and anyway probably just isn't a good idea. However sharing a folder in all three operating modes should be quite easy.

Native Windows: direct access.
Native Linux: direct access to NTFS partition.
VM Linux: network shared folder access.

Re: Win8 : Unable to use raw disk. Prob. permission error

Posted: 8. Sep 2015, 19:05
by heheman3000
Just wanted to add that on a Windows 10 host with VirtualBox 5.0.3, I also have to run as administrator in order to use raw disks.

Since it seems there's no way to get around this with user permissions on Windows hosts (i.e., can't add a user to the disks group like on Linux), it would probably be nice to throw up a more descriptive error than just "access denied".

Re: Win8 : Unable to use raw disk. Prob. permission error

Posted: 8. Sep 2015, 23:53
by mpack
"access denied" seems to me to accurately and completely describe the problem. It's a stock phrase whose meaning is well known for decades. What alternative (and impossible to misunderstand) wording did you have in mind?

Re: Win8 : Unable to use raw disk. Prob. permission error

Posted: 9. Sep 2015, 02:58
by heheman3000
mpack wrote:"access denied" seems to me to accurately and completely describe the problem. It's a stock phrase whose meaning is well known for decades. What alternative (and impossible to misunderstand) wording did you have in mind?
It's the access to the raw disk that is denied, not the .vmdk file. This could be confusing to users. It would be more informative to warn about trying to use raw disk vmdk without elevated privileges.

Re: Win8 : Unable to use raw disk. Prob. permission error

Posted: 9. Sep 2015, 10:44
by mpack
Access to the file is denied. The underlying cause, as always, has to be investigated by the user. The user will get this error every time on certain hosts, so it's not like the answer should be subtle.

Re: Win8 : Unable to use raw disk. Prob. permission error

Posted: 9. Sep 2015, 13:45
by Perryg
It's the access to the raw disk that is denied, not the .vmdk file. This could be confusing to users. It would be more informative to warn about trying to use raw disk vmdk without elevated privileges.
All of this is explained in detail in the users manual. http://www.virtualbox.org/manual/ch09.html#rawdisk No need to carry on about it. Expert requirement assumes you know what and why.