Redirecting your USB drive to the VirtualBox VM

Although VMs are not real machines, they are computers, too. Today, in everyday work, we need to exchange some information between computers. Often, we will need to copy some information, maybe configuration data or files between our host computer and VMs.

While we can copy information and even files using the features Shared clipboard and Drag and drop, we don’t always want to duplicate data. This is even more important if you’re using an SSD drive in your computer.

Additionally, we don’t want to use the network for such access, as it will be slow. Even the virtual network is still slower than the direct disk access. The best solution would be if we can use the data from the local disk, but inside the VM.

Oracle VirtualBox (VBox) has this cool feature. We can redirect a USB disk to the VM. After the redirection, this disk will be the local VM disk, which we can use like any other disk.

 

Using a USB stick as the local disk

When we connect the USB pen drive (or USB flash drive) to the host system, its operating system will recognize this device and enable it for usage. So, you can access that drive and work with it.

Let us assume that we want to install some specific software onto the VM. We don’t want to spare 2-3 GB of the precious disk space on our SSD drive, even the virtual HDD (or VHD in short) is the file on that same disk.

You can redirect the USB device only if the guest OS supports the USB connections. Most new OS’s will support USB. By the way; VBox will emulate all USB standards for your VM – 1.1/2.0/3.0.

01

While your VM is running, choose the option USB from the menu Devices. From the newly opened drop-down menu, find your USB disk. In my example, this is the one named Generic Mass Storage. Be careful here not to choose your keyboard or mouse or you will effectively lock yourself!

In this moment, VBox will activate the USB integration process. You can see the info balloon near the system clock mentioning a new VirtualBox USB device. That’s fine. Just be patient.

clip_image003

During this process, VBox will disable this device on the level of the host OS. That means that you can’t no longer see this disk as the local drive in My Computer. Moreover, one USB disk can never attached to two computers simultaneously.

02

When this process is finished, the USB disk will become a new drive in the My Computer of your VM. You can use it without restrictions.

 

The USB disk is removable in the VM, too

This new device is actually the USB disk. If it’s treated as the removable USB device on the host, it will be treated in the same way in the VM.

05 - USB disk

You will have the option of Eject in the context menu of this disk. I recommend that you always eject the USB disk in the VM in the same way as on the physical computer. When you see the message that you can disconnect your USB device, use the same Devices > USB menu to disconnect the device from the VM.

When this process is finished, your host OS will prompt you that a new device is connected to the system. This new device is just the released USB disk. It’s again accessible from the host OS. This can be used to exchange large volumes of data between the host and the VM.

There is also the possibility of accessing the data from the host’s local disk, but this is another story to tell.

Stay tuned.

Advertisement

6 thoughts on “Redirecting your USB drive to the VirtualBox VM

    • Hi,

      You can use any local disk through the RDP connection. You have an option to expose any local drive to the remote computer. I often use this option.

      There are also the software solutions that work as client/server system. I personally never needed them. In general, such solution have a server part, installed on the computer with attached USB device, and a client part, installed on the remote machine. They communicate over the TCP protocol. Additionally, you can use similar solution for the serial (COM) devices.

      Hope I helped you.

      Regards,
      Srdjan

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.