Is sharing USB drive with host possible

Discussions related to using VirtualBox on Linux hosts.
Post Reply
MarkFoley
Posts: 155
Joined: 19. Aug 2016, 03:20

Is sharing USB drive with host possible

Post by MarkFoley »

I probably already know the answer to this, but ...

I have a Windows 7 guest on Linux Slackware 14.2. I have an external USB drive configured in guest > Settings > USB. That all works just fine.

The Manual, https://www.virtualbox.org/manual/ch03.html#idm1631, section 3.10.1. USB says, "Be careful with USB devices that are currently in use on the host! ... it will be disconnected from the host without a proper shutdown."

So here's my question. This external USB drive has 2 partitions: sdb1 is Ext4 and sdb2 is NTFS. I want to use only sdb2 for access by my Windows VM guest. However, when I configure the drive in VM Settings > USB, it snags the entire drive, at which point, as the manual alludes, the drive disappears from visibility on my Linux host. If I shut down the VM, I can once again see /dev/sdb.

Is there any way to have the VM only grab a specific partition from the USB device, and not snag the entire drive?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Is sharing USB drive with host possible

Post by mpack »

USB devices can only be plugged into one PC at a time. Their drives know nothing about being shared, so the simple answer to your question is - no.

However, it is usually trivially easy to let the host own the USB drive, and let the guest access it as a shared folder. The guest wouldn't need any USB knowledge.
MarkFoley
Posts: 155
Joined: 19. Aug 2016, 03:20

Re: Is sharing USB drive with host possible

Post by MarkFoley »

mpack wrote:USB devices can only be plugged into one PC at a time. Their drives know nothing about being shared, so the simple answer to your question is - no.
That what I suspected, but I was hoping someone might know a "trick".
However, it is usually trivially easy to let the host own the USB drive, and let the guest access it as a shared folder. The guest wouldn't need any USB knowledge.
Yes, I was able to do that, and the Windows VM guest did see the shared folder. However, the shared folders are shown as network drives, e.g. \\VBOXSRV(F:). Unfortunately my problem is that the Acronis backup software a) cannot create Acronis Secure Zones on network drives and b) most importantly, the Acronis software asks for "credentials" to access network drives from the VM -- and there are no credentials to give it. This latter issue is a known problem with Acronis. Therefore, my only choice is to access the backup drive as a VM USB, which means the Linux host will not be able to see it while the VM owns it.

I had intended to use half this 1G USB drive for backing up Linux and the other half for backing up the VM, but I guess the solution will have to be to have 2 distinct USB drives. Oh well, they're cheap!

Thanks!
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Is sharing USB drive with host possible

Post by mpack »

As always with VirtualBox, the trick to understanding what it can and can't do is to consider what the answer would be if you had two physically separate PCs.

Can a USB mass storage device be plugged into both PCs at the same time? No. However there are a couple of sharing options available: shared folders and remote USB. Your two USB drives idea certainly sounds simpler.
Post Reply