Virtualbox Use Physical Disk

Virtualbox: using physical harddisk Raw hard disk access, both for entire disks and individual partitions, is implemented as part of the VMDK image format support. As a result, you will need to create a special VMDK image file which defines where the data will be stored. Oct 31, 2017 Again I'm asking how to use physical disk - I know that for Windows 95, 98 and Me it is large space, but I see it not so big 'cause I have disk space 5,5 TB + 60GB. So, please tell me anybody how to use physical disk in VBox? I know that VMware it can, but I'm not so rich to buy it. If you have the new physical disk attached to the machine the VM virtual disk is on, you can convert VDI to physical without an intermediate conversion, probably saving a bunch of time & disk space. This is assuming your physical disk is the same or larger than the virtual disk's maximum size. If you have the new physical disk attached to the machine the VM virtual disk is on, you can convert VDI to physical without an intermediate conversion, probably saving a bunch of time & disk space. This is assuming your physical disk is the same or larger than the virtual disk's maximum size. About Press Copyright Contact us Creators Advertise Developers Terms Privacy Policy & Safety How YouTube works Test new features Press Copyright Contact us Creators.

Friday 9th November 2018

I recently acquired a computer with an OEM/factory-imaged Windows 10 disk inside. Straight away I took the disk out and replaced it with a Linux SSD, however since I don't own any other Windows systems, this will come in useful for testing my website for browser compatibility in Internet Explorer and Edge.

I have put the Windows 10 disk in a USB SATA drive enclosure, and configured VirtualBox to be able to boot the raw disk. Now I'm able to test my site in IE and Edge usng the virtual machine running on my system.

Skip to Section:

Identifying the Disk

Mounting the disk/partitions is not actually required for VirtualBox to be able to boot it, however you will need to identify the correct block device ID for the disk (e.g. /dev/sdb).

If you're using a modern desktop environment and file manager (e.g. XFCE with Thunar), the Windows 10 disk will probably be automatically mounted (if you get stuck at the error 'Windows is hibernated, refused to mount.', please see the troubleshooting here). In my case, the Windows and Recovery Image partitions were auto-mounted. Then, you can use lsblk (List Block Devices) to identify the correct device. For example:

From this, you can determine that /dev/sdb is the Windows 10 disk.

If your disk is not automatically mounted, you don't need to mount it. You can use lshw to determine the correct device. For example:

From this example output, you can see that /dev/sdb is the Windows 10 disk. This may differ for you though.

For the rest of this document, I will refer to the correct block device ID for your system as /dev/sdX. Make sure to substitute this with the correct one for your system in commands that you execute.

File System Permissions

In order to have full, unrestricted access to the Windows 10 disk without having to use sudo, you need to give your user account the appropriate permissions.

There are two main ways that this can be configured. The proper, higher-security method which is best for production/important systems, or the quicker, lower-security method which is suitable for test/disposable systems. You can choose which is best for you - you only need to complete one of them.

Higher-Security File System Permissions Configuration

If you are using a system where security is important, the best way to achieve this is to create a udev rule to match the Windows 10 disk and assign it to a particular group. Then, your non-privileged user account will have full read-write access to the disk(s) that match the rule, while the others remain protected.

First, create a new group to use for the Windows 10 disk:

Then add your own user to the group:

Next, you need to determine the UUID of the Windows 10 disk. You can do this using udevadm:

Physical

This should output the UUID of the Windows 10 disk. For example:

E: means that it's a device environment variable, and the variable could be ID_PART_TABLE_UUID, ID_FS_UUID or something else with a similar meaning.

If no UUID is outputted, try omitting the grep and looking for other variables that contain the UUID. If for some reason no UUID is returned, you may be able to use other attributes to uniquely identify the disk, however this may result in inaccuracies.

Take a copy of the variable name and UUID, and create a file in the udev rules directory, such as /etc/udev/rules.d/99-win10disk.rules. Edit the file and add the following content, adjusting the variable name, UUID and group as required:

Make sure to pay attention to the operators used in the rule. Like in most programming languages, is an equality check and = is an assignment, so make sure to get these the right way around in the rule. You want to be checking the UUID and assigning the group, not the other way around!

Save the file, then power cycle the Windows 10 disk (disconnect and reconnect, reboot, etc).

Then, check that the rule worked by listing the block device file and checking the group:

This should output similar to the following:

The key attribute to check is that the group is win10disk. If it is, then the file system permissions are configured correctly and you can proceed to the next section.

Lower-Security File System Permissions Configuration

On the other hand, if you're using a system where security is less important (such as a disposable test machine), there is a quicker method. First, determine the group that has access to the drive:

This will output something like the following:

From this, you can determine that the group is disk, and that this group has read and write access to the block device (brw-rw----).

Virtualbox Use Physical Disk Partitioning

The group name and permissions may differ for you, however in many cases it will be as above.

Next, add your user to the group. Please be aware of the potential security implications of this, as you will probably be giving your user account full read-write access to some or all storage devices. If the group is something else such as root, you should consider the higher-security setup instead.

Virtualbox Use Physical Drive

VirtualBox Raw Host Access VMDK File

In order for VirtualBox to be able to boot the physical Windows 10 disk, you need to a create a special VMDK (Virtual Machine Disk) file that represents the physical disk.

These raw host disk access VMDK files do not actually contain any data from the physical disk, they are just a pointer that VirtualBox can use to access it.

You can create a VirtualBox raw disk image using VBoxManage. You can specify a location in the -filename argument:

This should output something similar to the following:

The raw host disk access VMDK file only contains ASCII test, so you can cat or less it and have a look!

Creating and Configuring the Virtual Machine

Now that the raw host disk access VMDK has been created, you need to create a new VM and boot from it.

Just set up a virtual machine as you normally would. Make sure to choose the correct type and version.

When you get to the 'Hard disk' section, select 'Use an existing virtual hard disk file', and choose the VMDK file that you created in the previous step.

Raw

Once you have completed the initial setup wizard, open the settings for the virtual machine, give it some extra CPU cores if possible, then set the boot order to 'Hard Disk' first, with all other options disabled.

If the Windows 10 install on the disk is an EFI install, make sure to tick the 'Enable EFI' box.

Save the settings, and then boot the virtual machine. If everything has worked, Windows 10 should boot up successfully.

Logical Disk

If this is the first time you've booted the drive (it was for me), you'll have to go through the initial Windows 10 setup process where you choose the region, language, keyboard layout, etc. Cortana started speaking to me during the setup process so watch out for that!

Once you're all done with setup, Windows 10 should boot to the desktop successfully.

If you want to be able to make Windows 10 full screen, etc, install the VirtualBox Guest Additions using Devices -> Insert Guest Additions CD image..., then run the installer in the virtual machine.

Once this is complete, reboot the virtual machine and Windows should automatically display in full screen. If not, you should be able to manually set your resolution using the display settings in Windows.

Virtualbox Use Physical Disk

When it comes to Windows Product Activation, I'm not really able to advise. I've heard that Windows will often become unactivated when changing hardware, however in my case the activation remained. This may be because I never actually fully booted the Windows 10 disk when it was in the original desktop machine.

Troubleshooting: Windows is Hibernated, Refused to Mount

When mounting the Windows 10 disk, you may see the following error:

This can occur if Windows 10 is hibernated, or was otherwise not correctly shut down.

In order to fix this you need to remove the hibernation file. This can be done using mount.

In the command examples below, make sure to change N in /dev/sdXN to the partition number of the main Windows partition. Also change the X to the correct block device ID as usual.

Please be aware that this will permanently erase the hibernation file, so any data not properly saved will be lost.

Conclusion

Virtualbox Use Physical Disk In Computer

I'm pleasantly surprised that this worked - I was expecting Windows to fail to boot or at least have serious problems due to the drastic change in hardware from the original machine, but it seems to work fine.

Virtualbox Use Physical Disk Problems

I'm going to use this VM to test my website for compatibility in Internet Explorer and Edge, in order to make sure that everything is presented as best as it can be.

On a side note, look how much bloatware came pre-installed on this. It's just a standard Windows 10 disk pulled from a shop-bought HP desktop machine... unbelievable!

Virtualbox Use Physical Disk Games

Luckily this is in a VM on my segregated test machine. I wouldn't want to be exposing all that to my network!