VM on RAW disk on Windows 7 host

Discussions related to using VirtualBox on Windows hosts.
Locked
beremour
Posts: 4
Joined: 12. Jan 2011, 07:32
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Windows XP

VM on RAW disk on Windows 7 host

Post 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)
Korkman
Posts: 4
Joined: 16. Feb 2011, 01:09
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Debian Linux

Re: VM on RAW disk on Windows 7 host

Post 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.
Korkman
Posts: 4
Joined: 16. Feb 2011, 01:09
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Debian Linux

Re: VM on RAW disk on Windows 7 host

Post 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
beremour
Posts: 4
Joined: 12. Jan 2011, 07:32
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Windows XP

Re: VM on RAW disk on Windows 7 host

Post by beremour »

Korkman wrote:Success!

4. ATTRIBUTES DISK CLEAR READONLY
Thank you very-very much!)) YAHOOOOO!)
bsod
Posts: 1
Joined: 14. Mar 2012, 15:16

Re: VM on RAW disk on Windows 7 host

Post 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
gmchenry
Posts: 3
Joined: 5. Oct 2010, 10:23
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: Windows XP, Open Solaris

Re: VM on RAW disk on Windows 7 host

Post 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 :-)
virtualbrax
Posts: 6
Joined: 4. Jun 2012, 22:28

Re: VM on RAW disk on Windows 7 host

Post by virtualbrax »

Could this be also the solution for my problem "Using encrypted Linux LVM partition fails"?

See: viewtopic.php?f=6&t=49850#p227041

I was able to "sucessfully" create a VMDK file without using DISKPART.
oatkinson
Posts: 1
Joined: 12. Jun 2012, 16:39

Re: VM on RAW disk on Windows 7 host

Post 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?
virtualbrax
Posts: 6
Joined: 4. Jun 2012, 22:28

Re: VM on RAW disk on Windows 7 host

Post 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 (viewtopic.php?f=6&t=49850#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.
angelcool.net
Posts: 1
Joined: 25. Apr 2013, 06:52

Re: VM on RAW disk on Windows 7 host

Post by angelcool.net »

Temporarily disabling User Account Control Settings (UAC) worked for me. My host is Windows 7 64b :)

enjoy!

angel
TaserShots
Posts: 5
Joined: 5. Apr 2014, 18:28

Re: VM on RAW disk on Windows 7 host

Post 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!
BillG
Volunteer
Posts: 5102
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: VM on RAW disk on Windows 7 host

Post 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.
Bill
jingking
Posts: 3
Joined: 21. Sep 2015, 19:19

Re: VM on RAW disk on Windows 7 host

Post by jingking »

Korkman wrote:Success!

...
4. ATTRIBUTES DISK CLEAR READONLY
...
Thanks. You save my day!
Locked