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.
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.
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.
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.
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.
[…] also attached my USB flash drive (formatted as FAT32) to my PC and later redirected it into this […]
LikeLike
[…] the USB device from the host to the VirtualBox guest. I already described this mechanism in this post. However, we have here a few more […]
LikeLike
[…] USB drive into the port of my laptop. When Windows recognised it and added to Windows Explorer, I redirected it to my […]
LikeLike
I would like to redirect a USB stick to Virtualbox, which is plugged into a remote computer. I found an article which describes how to connect a usb drive to Virtualbox https://www.eltima.com/article/virtualbox-usb-drive-passthrough/
Have you got any experience with such tool?
LikeLike
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
LikeLike
[…] booted, I plugged the USB drive into the port on my laptop, waited for Windows to recognize it and redirected it to my VM. Yes, redirection works with all VMs, regardless of the operating system. However, don’t […]
LikeLike