VirtualBox: raw disk access on Windows 7 denied

8,890

Solution 1

[Edit: Doh, just noticed your situation is for one physical drive - you can take a volume offline with DISKPART instead of the whole disk. Can you run the OFFLINE VOLUME command in diskpart for your ArchLinux partition and use the "ATTRIBUTES VOLUME CLEAR READONLY" diskpart command afterward? I'm curious if this will work for you.]

Luckily, you can tell Windows to buzz off and let VirtualBox have raw disk access. Do the following:

  1. Offline the disk in disk management on the host.
  2. Using DISKPART, clear the read-only flag using the "ATTRIBUTES DISK CLEAR READONLY" command after selecting the affected disk.
  3. Boot the VM using the raw disk VMDK.

Note that Windows will yell at you if you're not running the VirtualBox management interface as administrator and using raw disk access VMDK's.

Solution 2

Have you tried creating a virtual hard drive (VHD)? It's basically one huge file when unmounted. But when a VHD is mounted that's where the magic can start since a VHD can act just like a completely different real hard drive. Better still, you can also use a VHD in Virtual Box instead of Virtual Box's default VDI. So if you happen to install a guest OS to a VHD you can still get at the data with Windows and no instance of Virtual Box either (also assuming the file system in use is FAT or NTFS since that's all Windows knows).

VHD's are natively supported by Windows from at least Windows XP to present. But VHD's can only be mounted in Windows using something like the Windows Disk Management tool (diskmgmt.msc). You also can't mount a VHD in Windows and then have access to it with Virtual Box either - that's the catch. But VHD's can be mounted (and used) as either primary boot devices or secondary storage devices in either system.

Therefore a potential solution might be to make a VHD with Virtual Box or with the Windows Disk Management tool. Then mount the VHD and use whatever drive imaging tool you like such as Symantec Ghost to "copy" one of your system's real partitions (which I assume has either Windows or Arch installed). When done, you should then be able to boot from the VHD with Virtual Box (assuming you also know how to configure Virtual Box correctly).

One other thing. I'm not sure if Linux can mount a VHD like Windows can. Although it wouldn't surprise me if it could. But even if Linux can't mount a VHD, you can still mount one in Virtual Box no matter what the host OS is.

Share:
8,890

Related videos on Youtube

fengshaun
Author by

fengshaun

Updated on September 18, 2022

Comments

  • fengshaun
    fengshaun over 1 year

    I'm currently dual-booting an Archlinux (where I do all of my work) and a Windows 7 install (where I play games). However, I'm getting tired of rebooting each time I want to play a quick game, and so decided to boot my Archlinux install from VirtualBox so I can work in Archlinux guest and play on Windows host. To do this, I followed the "Raw disk access" guide on VirtualBox's website.

    Now, when I get past the syslinux bootloader in VirtualBox and try to boot into Arch, I get all sorts of errors about disk access and fsck fails, throwing me into a boot shell! Please note that I have booted into Arch to make sure it works flawlessly when booted normally. It's only the VirtualBox booting that causes problems.

    I have looked all over the web and it seems like Windows 7 doesn't allow raw access to hard disks and almost all guides talk about offlining the HDD to allow VirtualBox access. However, since I only have 1 HDD, I can't offline it (I'm running both operating systems on this 1 HDD).

    Is there another way of allowing raw disk access to VirtualBox on Windows 7?

    EDIT: VBox.log (taken from Machine -> Show Log menu)

    • Canadian Luke
      Canadian Luke almost 12 years
      Welcome to SuperUser! If you feel that log files can help, simply post them. It saves extra edits, and with usually help more people. If they are not needed, they will just be skipped over automatically by people reading the question
  • fengshaun
    fengshaun almost 12 years
    Thanks! That was my initial choice, but I also want to occasionally boot into Arch and want the virtual machine and the physical installation synced together!
  • ElectroBit
    ElectroBit almost 8 years
    It yells at me even before I boot the machine. As soon as I run VirtualBox as administrator and try to add the VMDK, it works.