Accessing physical drive form Linux guest

Discussions related to using VirtualBox on Windows hosts.
Berjozkin
Posts: 65
Joined: 14. Nov 2007, 14:54
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: Slackware 64 bit

Accessing physical drive form Linux guest

Post by Berjozkin »

Hi!

I know about the vmdk way, which has some serious limit - the requirement to run VirtualBox in admin mode.

Does some other way exist how it could be possible to access host's physical disk (specific partition or using direct addressing of disk space)? May be some other way exists which could not require VBox running in elevated mode?

I have to admit, I have suspicion that it is impossible without root/admin level rights, but the hope dies the last.

Janis
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Accessing physical drive form Linux guest

Post by scottgus1 »

'Fraid that hope has to die. On a Windows host, Run as Admin is required for raw disk access.

On the other hand you might see if you can re-think another solution that doesn't require raw disk access. Shared folders?
Berjozkin
Posts: 65
Joined: 14. Nov 2007, 14:54
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: Slackware 64 bit

[Closed] Accessing physical drive form Linux guest

Post by Berjozkin »

No, shared folder is also not an option - the idea was to make the guest to be able to directly write data (not files) on the host's physical disk (specific area without partitions).

So, the idea died. On Linux it is not possible also - I recalled how I replicated the linux server installed and configured as virtual machine to the physical disk - it also required vbox run as root.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Accessing physical drive form Linux guest

Post by scottgus1 »

Howz about a USB-connected drive? USB3 is rather fast, and the Virtualbox USB filters can pump that drive directly into the guest so the host doesn't even see it. No Run-as-Admin required.
Berjozkin
Posts: 65
Joined: 14. Nov 2007, 14:54
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: Slackware 64 bit

Re: Accessing physical drive form Linux guest

Post by Berjozkin »

scottgus1 wrote:Howz about a USB-connected drive? USB3 is rather fast, and the Virtualbox USB filters can pump that drive directly into the guest so the host doesn't even see it. No Run-as-Admin required.
hmmm... did not event thought about it... yes, that could be the answer :D Just need to find thumb drive as reliable as SSD.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Accessing physical drive form Linux guest

Post by scottgus1 »

You can put a platter or SSD drive inside a USB enclosure.
You can get them preassembled (see http://www.newegg.com/External-SSDs/Sub ... ?Tid=11694
http://www.newegg.com/Hard-Drive-Enclos ... gory/ID-92)
Probably would work much better than a USB stick.
Berjozkin
Posts: 65
Joined: 14. Nov 2007, 14:54
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: Slackware 64 bit

Re: Accessing physical drive form Linux guest

Post by Berjozkin »

Here is a problem, if not a bug:

if I try to use partitioned thumb-drive, having FAT32 as the first and etx4 as the second partition, it is impossible to attach such device to the guest.
I know that windows is crippled in that regard being not able to comprehend correctly thumb-drives with more than 1 partition, while allowing to use the first one. But it is definitely impossible to use such device with VBox, not even on the level of the first partition.

The next question - would it possible to use _unpartitioned_ thumb-drive on windows host with linux guest?
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Accessing physical drive form Linux guest

Post by scottgus1 »

It is possible to use USB devices, for which the host OS has no drivers and can't use, in a Virtualbox guest using the filters. Any USB device that is filtered into a guest appears to be a Virtualbox device to the host and the host doesn't interact with it.

So if you put a dual-partitioned or no-partitioned USB stick into a guest via a USB filter, the host should have no idea what it is or what the guest is doing with it.
Berjozkin
Posts: 65
Joined: 14. Nov 2007, 14:54
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: Slackware 64 bit

Re: Accessing physical drive form Linux guest

Post by Berjozkin »

The problem is that such dual partitioned device does not show up in the guest - evrth ends up with VBox trying to get the control over it for eternity (according to err msg if the request is repeated). With single-partitioned - no problem.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Accessing physical drive form Linux guest

Post by scottgus1 »

Hmmm. with single partition it shows in the guest fine, but with double partition it does not? Interesting.

Socratis is better at this USB stuff than I am, but I'll take a shot.

First, unplug the drive with the two partitions, then reboot your host to get a clean environment.
With no Virtualbox windows open, open your command prompt and run this command:

Code: Select all

C:\Program Files\Oracle\VirtualBox\VBoxManage.exe list usbhost
(I am assuming a Windows host OS, since this is in the Windows Hosts forum, and that your Virtualbox was installed in the default folder the installer wanted to use.)
Post the output in a text file here on the forum.

Now insert the USB stick and run the above command again, posting that output in another text file.

Then in a third text file, post the output of this command:

Code: Select all

C:\Program Files\Oracle\VirtualBox\VBoxManage.exe list usbfilters
Berjozkin
Posts: 65
Joined: 14. Nov 2007, 14:54
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: Slackware 64 bit

Re: Accessing physical drive form Linux guest

Post by Berjozkin »

Yes, you are right - it is about Win host and Linux guest.
Do I understand correctly - all operations must be performed without trying to bind device to the guest, isn't it?
Berjozkin
Posts: 65
Joined: 14. Nov 2007, 14:54
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: Slackware 64 bit

Re: Accessing physical drive form Linux guest

Post by Berjozkin »

Hi!

the results (on Win10-64 Pro)
Attachments
step3.txt
(40 Bytes) Downloaded 19 times
step2.txt
(2.27 KiB) Downloaded 18 times
step1.txt
(1.86 KiB) Downloaded 100 times
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Accessing physical drive form Linux guest

Post by scottgus1 »

Thanks for the files! OK, the step 1 and 2 show that the USB stick (Kingston DataTraveler 3.0) is the only new device that appears when the USB stick is plugged in. I was wanting to confirm that it showed up as just one device.

I made a mistake with the step 3 command, it doesn't do what I thought it did, sorry about that. Could you please do this:
Right-click the guest in the main Virtualbox window. Choose "Show In Explorer". The guest folder will open. Please right-click the guest's .vbox file and choose Send To, Compressed (zipped) folder. A zip file containing the .vbox file will appear. Please attach this zip like you did the text files. This will help see your USB filter. (If you don't see a .vbox file and the files in the window mostly don't show extensions, please set your computer to show known extensions.)
Berjozkin
Posts: 65
Joined: 14. Nov 2007, 14:54
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: Slackware 64 bit

Re: Accessing physical drive form Linux guest

Post by Berjozkin »

Hi!

here is the vbox file. I edited out encryption and shared folders sections
Attachments
Slack14.2.vbox.bz2
(2.35 KiB) Downloaded 5 times
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Accessing physical drive form Linux guest

Post by scottgus1 »

It appears your guest has no USB filters set. Here's the USB section out of your guest's .vbox file:

Code: Select all

      <USB>
        <Controllers>
          <Controller name="OHCI" type="OHCI"/>
          <Controller name="EHCI" type="EHCI"/>
        </Controllers>
      </USB>
Here's the USB section out of a guest I put a filter in:

Code: Select all

      <USB>
        <Controllers>
          <Controller name="OHCI" type="OHCI"/>
          <Controller name="EHCI" type="EHCI"/>
        </Controllers>
        <DeviceFilters>
          <DeviceFilter name="Logitech USB Receiver [1310]" active="true" vendorId="046d" productId="c504" revision="1310" manufacturer="Logitech" product="USB Receiver" remote="0"/>
        </DeviceFilters>
      </USB>
See the 'Device Filters' section? Your guest doesn't have one. No filters, no USB device in the guest. QED :lol:

PS how did you get a bz2 out of "right-click the guest's .vbox file and choose Send To, Compressed (zipped) folder"? Good thing I had 7zip lying around. Windows can't open bz2's thus the instructions I gave.
Post Reply