Recently, I had a hard drive start to go bad and Windows couldn't read some of the data on it. So, I wanted to mount the raw drive (750GB) connected via USB 3.0 to a virtual machine in VirtualBox to run some linux disk utilities on the drive. There were plenty of tutorials and instructions scattered across the web that I found to do this. However, I was forced to find multiple blogs and comment posts to fix the issues that came up while I was attempting this. I am posting this article really for my sake (in the case I ever need to do it again) but hopefully you find it helpful too.
Although my hard drive is connected via USB 3.0, I'm certain this works with drives connected internally.
Find your disk number
After you have connected your drive, you need to find out which drive number it is. In Windows, run the Disk Management tool and locate your drive's number:
Prepare the drive using a VirtualBox command-line tool
The first step to making a drive accessible to VirtualBox is to create a virtual hard disk file that points to the real drive.
Open windows command line (with administrator access) and run this: Note: You will need to change the filename to match your location, and the drive number to match your drive's number. This was my case.
VBoxManage internalcommands createrawvmdk -filename "C:\Users\Mark\VirtualBox VMs\VHDs\mydrive.vmdk" -rawdisk \\.\PhysicalDrive2
Adding the drive to VirtualBox
You must run VirtualBox as administrator in Windows; otherwise, the drive won't be accessible to the virtual machine.
Open VirtualBox and go into settings for the VM you want to add your hard drive to.
Click Storage, then Controller: IDE, then click the harddrive (+) icon.
Locate your file from the above step. Then it will be listed as another drive.
If you see the warning icon like the one in the above image next to NewVirtualDisk1.vdi that means you need to complete the next step and make sure you're running VirtualBox as administrator.
Taking the drive offline for full access
Finally, open Window's command-line running as Administrator.
Then to enter the diskpart utility, run:
Select the drive you are using (from the previous step, in my case 2)
DISKPART> select disk 2
Clear the read only attributes
DISKPART> attributes disk clear readonly
Start your Virtual Machine
You can start your virtual machine (VirtualBox running as administrator) and you can setup your virtual machine to mount an .iso image of your favorite linux tools for disk repair. E.g. SystemRescueCD