Page 1 of 1

Passthrough Hard Drives?

Posted: 30. Nov 2009, 09:56
by amps2volts
I have been reading forums and have been trying to figure this out now for a while now. I'm a IT guy and love linux and been trying to use it do do everything. I have been using linux for a few years now but very new to virtualization and need some help. This is my goal

My host computer is running linux with virtualbox with a windows xp pro guest os in virtualbox. I want to be able to hook a sata or ide drive up to the host computer and run virus and data recovery software within windows xp the guest os.

It seem like you can only attach a slave host hard drive via the guest additions / shared folder in the guest OS. Some anti virus and malware programs can't scan on a shared / map drive and the ones that do they go very slow. Plus data recovery software does not work on a shared / map drives at all. I though maybe is there a way to get a sata or ide drive in linux show up as a usb drive or as a regular drive in the guess OS?

If any anybody has any ideas send me a reply I'm stuck.

Here is what I'm running.

Host computer:
-Ubuntu 9.10 Karmic Koala
-Kernel 2.6.31-15-generic
-Vertua lbox 3.0.12 r54655

Guess computer"
-Windows XP Pro with SP3

Re: Passthrough Hard Drives?

Posted: 30. Nov 2009, 10:49
by MarkCranness
You can attach a raw disk to a VM. See section 9.10 of the user manual. The VM will then see the actual disk or disk partition as a virtual disk.
Make sure you heed the Warnings in the manual about mounting the disk on the host while the VM is running.

Re: Passthrough Hard Drives?

Posted: 1. Dec 2009, 05:23
by amps2volts
Wow that is cool its built it already guess I should have read the manual. Does not seem to be working though :-( Here is what happens.

I run this in the terminal /dev/sda is a slave sata drive on my host computer.

Code: Select all

sudo VBoxManage internalcommands createrawvmdk -filename /home/daniel/Documents/test.vmdx -rawdisk /dev/sda
I get this returned

Code: Select all

VirtualBox Command Line Management Interface Version 3.0.12
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

RAW host disk access VMDK file /home/daniel/Documents/test.vmdx created successfully.
daniel@daniel-desktop:~$ 
I then change the permissions to the file to daniel who I'm logged in as with full read and write access.
I open virtual box up and go to "virtual Media Manager" and click add and get the following.

Code: Select all

VirtualBox - Error
Failed to open the hard disk /home/daniel/Documents/test.vmdx.
Could not open the hard disk '/home/daniel/Documents/test.vmdx'.
VD: error opening image file '/home/daniel/Documents/test.vmdx' (VERR_ACCESS_DENIED).

Details
Result Code: 
NS_ERROR_FAILURE (0x80004005)
Component: HardDisk
Interface: IHardDisk {62551115-83b8-4d20-925f-79e9d3c00f96}
Callee: IVirtualBox {3f4ab53a-199b-4526-a91a-93ff62e456b8}
Nothing works for me.

Re: Passthrough Hard Drives?

Posted: 1. Dec 2009, 11:46
by Sasquatch
It tries to access the full partition or drive in RAW mode, and that requires either the right permissions, or root access. Since you're (or the user that tries to use it) has neither, you need to modify the permissions for the block device itself in /dev. If the user is a member of the disk group, permissions don't need to be changed, but it's a dangerous privilege.