Passthrough Hard Drives?

Discussions related to using VirtualBox on Linux hosts.
Post Reply
amps2volts
Posts: 2
Joined: 30. Nov 2009, 08:50
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows XP Pro 32bit

Passthrough Hard Drives?

Post 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
MarkCranness
Volunteer
Posts: 875
Joined: 10. Oct 2009, 06:27
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Windows Server 2008 R2; Ubuntu 11.04; Windows 2000 Server; Windows XP

Re: Passthrough Hard Drives?

Post 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.
amps2volts
Posts: 2
Joined: 30. Nov 2009, 08:50
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows XP Pro 32bit

Re: Passthrough Hard Drives?

Post 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.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Passthrough Hard Drives?

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply