Page 1 of 1

VM on RAW disk on Windows 7 host

PostPosted: 11. Feb 2011, 10:20
by beremour
So, what is the verdict?) is it possible to fight (rc=VERR_ACCESS_DENIED) error in virtual machine, placed on RAW disk under WIndows7 host ? (as I can understand, error occurs when Windows7 host starts recognizing and protecting Partition created by VM on RAW disk)

Re: VM on RAW disk on Windows 7 host

PostPosted: 16. Feb 2011, 01:47
by Korkman
This problem bugs me alot, too. What's worse: In my case, on a particular partition, VirtualBox happily acknowledges all I/O to the guest OS and only *logs* VERR_ACCESS_DENIED on writes (reads work). My guest OS does not notice anything, but any changes are lost on reboot (or when page cache is gone).

Thus far, I have not been able to tell Windows 7 to "free" the drive properly.

* running virtualbox with administrative rights did make guest boot off a Linux-only filesystem (ext2, ext3 and XFS partitions seem to work OK), but the same disk contains a FAT32 partition, on which all changes are lost
* removing all drive letters did not change anything
* offlining the disk in disk management made the whole disk behave like the FAT32 partition: guest boots into my desktop, everything works, but all changes are lost and logged with VERR_ACCESS_DENIED

It's sad to see physical disk pass-through in such a half-working state (on Windows 7, I think Linux is a far better host where a root user has actual power over the operating system).

Maybe Microsoft sealed down direct write access to partitions housing filesystems to keep things secure, so there's not much VBox can do, but even so VERR_ACCESS_DENIED on write should halt the virtual machine (waving at VBox devs).

Some research while writing this revealed this thread in "the other camp", having the same issues:
http://communities.vmware.com/docs/DOC-10455

I have not yet tried "attribute disk clear readonly", which may be my solution.

Re: VM on RAW disk on Windows 7 host

PostPosted: 16. Feb 2011, 02:34
by Korkman
Success!

In summary:

To gain full hard drive access in a VBox guest on Win7 host

0. close all open programs or documents on any partition on the disk to pass-through
1. run DISKPART (command line utility)*
2. select hard drive carefully using SELECT DISK. disk numbering starts at zero. you can roughly verify your selection with LIST PARTITION if you know what your partitions should look like or LIST DISK to see disk sizes.
3. offline the disk using OFFLINE DISK. all volumes will disappear from windows explorer.
4. ATTRIBUTES DISK CLEAR READONLY
5. verify with ATTRIBUTES DISK
6. create VMDK file as shown in several howtos on the web
7. enjoy

As always with the dumb numeric representation of physical disks in windows: keep an eye on the ordering of your disks, especially removables, before booting the wrong one.

*administrative rights required for operating vbox and utilities but not for desktop

Re: VM on RAW disk on Windows 7 host

PostPosted: 21. Feb 2011, 18:49
by beremour
Korkman wrote:Success!

4. ATTRIBUTES DISK CLEAR READONLY



Thank you very-very much!)) YAHOOOOO!)

Re: VM on RAW disk on Windows 7 host

PostPosted: 14. Mar 2012, 15:28
by bsod
Hello,

just wanna add one thing: I had exactly the same error "VERR_ACCESS_DENIED" on starting the machine.
After some digging in the logfiles and installing various other versions of virtual box I found the line
00:00:00.436 VMSetError: D:\tinderbox\win-3.2\src\VBox\Devices\Storage\DrvVD.cpp(2054) drvvdConstruct; rc=VERR_VD_IMAGE_READ_ONLY

Just for testing I tried to recreate the raw file:
C:\Program Files\Oracle\VirtualBox>VBoxManage.exe internalcommands listpartition
s -rawdisk \\.\PhysicalDrive2
Oracle VM VirtualBox Command Line Management Interface Version 3.2.14
(C) 2005-2011 Oracle Corporation
All rights reserved.

Error opening the raw disk: VERR_SHARING_VIOLATION
(I got this error on every command)
So I searched via Process Explorer for the handle "Harddisk2" and found that OpenHardwareMonitor was accessing all Harddisk drives, after closing OpenHardwareMonitor VirtualBox is working fine now.

So it is also possible that other running programs are accessing the harddisks to trigger this error...
Im adding this just for reference (in case anybody is running into this issue).

reddragon

Re: VM on RAW disk on Windows 7 host

PostPosted: 17. Mar 2012, 07:55
by gmchenry
I can't quite find what I'm looking for, but I know the Linux equivelant.

With VBoxManage.exe, how do you list the -rawdisk flag? ie in Windows 7, what's equiv. to /dev/sda?

Can I do it by device ID? I have two 2TB hard drives mirrored in ZFS. I've installed Solaris 11 and I can't figure out how to access the pool.

Does the Windows Diskpart tell you device names/ID's?

I'll keep searching in the meantime, but if anyone's got the instant solution, let me know :-)

Re: VM on RAW disk on Windows 7 host

PostPosted: 10. Jun 2012, 23:26
by virtualbrax
Could this be also the solution for my problem "Using encrypted Linux LVM partition fails"?

See: https://forums.virtualbox.org/viewtopic ... 50#p227041

I was able to "sucessfully" create a VMDK file without using DISKPART.

Re: VM on RAW disk on Windows 7 host

PostPosted: 12. Jun 2012, 16:42
by oatkinson
What if the partitions you are after are on the save disk as your win7 partition? Is it still safe to OFFLINE the disk?

Re: VM on RAW disk on Windows 7 host

PostPosted: 12. Jun 2012, 20:34
by virtualbrax
oatkinson wrote:What if the partitions you are after are on the save disk as your win7 partition? Is it still safe to OFFLINE the disk?


I did think about that and did post it in the other thread linked above (https://forums.virtualbox.org/viewtopic ... 50#p227041)

virtualbrax wrote:RAW access seems to work for a whole physical disk using this tool:
http://reboot.pro/15069/

There seems to be a way to use partitions as well, but I did not fully understand how to do that and it seems to be not very save.

Re: VM on RAW disk on Windows 7 host

PostPosted: 25. Apr 2013, 06:56
by angelcool.net
Temporarily disabling User Account Control Settings (UAC) worked for me. My host is Windows 7 64b :)

enjoy!

angel

Re: VM on RAW disk on Windows 7 host

PostPosted: 5. Apr 2014, 18:41
by TaserShots
Sorry if this post is not appropriate, but I'm fairly new to VirtualBox and brand new to this forum.

I'm trying to set up SpinRite to run in VirtualBox but am having problems creating the virtual raw disk. I'm running the Windows 7 Ultimate 64-bit OS.

When I run the command from an Administrator command prompt, it times out (?) stating "Most likely, the VirtualBox COM server is not running or failed to start."

I had this problem in the past trying to convert a disk but solved it by running the command from a non-Administrator command prompt. When I try that here, however, I get the VERR_ACCESS_DENIED error.

I followed the DISKPART command sequence to disable the drive and remove the "readonly" attribute. I also tried reducing UAC to its minimal setting, but no joy in either case.

Any help is appreciated as is you patience.

Thanks!

Re: VM on RAW disk on Windows 7 host

PostPosted: 6. Apr 2014, 01:20
by BillG
Nothing to do with raw access at all. You will always get that if you run the command as Administrator. It should work if you run it with the user account.

Re: VM on RAW disk on Windows 7 host

PostPosted: 21. Sep 2015, 19:26
by jingking
Korkman wrote:Success!

...
4. ATTRIBUTES DISK CLEAR READONLY
...


Thanks. You save my day!