Internet Windows Android

How to connect a USB flash drive in a virtual machine. How to configure USB ports in VirtualBox

I think many have already been puzzled by the question of how to configure USB on Virtualbox in their beloved Ubuntu. Sometimes it is necessary to connect a USB flash drive directly to Virtualbox, but instead you have to copy data from a flash drive to a shared folder and from this folder already use the data in the virtual system (note my article "Share XP guest folder under Ubuntu"). I also tried to solve this problem for a long time, but something didn't work out for me, and I didn't really need it then, but now I accidentally stumbled upon a video from youtube where it was shown how you can connect your devices. 1. So, first add yourself to the virtualbox group. To do this, run sudo gedit / etc / group and find the line vboxusers: x: 121: and add your username there. 2. Then write in the terminal getent group vboxusers and you will see in the output something like this vboxusers: x: 121 : user if you added the user to the group correctly in the previous step, then after the three-digit number there will be your login, in my case user. From this line we need to remember gid this is a three-digit number, in my case it is 123, I specially marked it in bold, you may have a completely different number. Attention: remember this number, it will be useful to us for the next step. 3. Open in a text editor fstab: sudo gedit / etc / fstab and insert the line there: none / sys / bus / usb / drivers usbfs devgid = XXX, devmode = 666 0 0 where XXX, the same qid that we memorized in the previous step. Save changes and restart your computer. 4. After rebooting, start Virtualbox and go to the properties of your virtual machine. Move to the USB section and there check the "enable USB" and "enable USB 2.0" options (I have a system in English, translated these names on the fly, maybe it won't be called so little in the Russian interface). Then start the system and to connect USB devices in the navigation window of your virtual machine go to "Devices - USB devices" and tick the necessary devices. You can also add that USB devices are connected automatically when the virtual OS starts. To do this, in the settings of the virtual machine, in the USB section, add the required device to the filter. From the sponsor: Italian furniture factories are famous for their products all over the world. Such furniture is created in accordance with the requirements of European quality standards and will serve its owner for a long time. In addition, Italian furniture factories use natural materials in their manufacturing process. Buying furniture from Italian manufacturers means getting a quality product with a beautiful design at an affordable price.

  1. How to connect a USB flash drive in VirtualBox? Hello everybody! I installed the latest operating system on a virtual machine and I want VirtualBox to see my flash drive and external USB hard drive, how can this be done?
  2. Hello site, help me solve the problem, the operating system installed on the VirtualBox virtual machine does not see the USB flash drive connected to the computer, and my portable USB hard drive is also not visible. In the settings of the virtual machine, I chose Devices-> USB Devices, then I select my USB flash drive and mark it with a tick, but the flash drive still does not appear in the Computer and Disk Management window.

How to connect a USB flash drive in VirtualBox

Hello friends. There are quite a few situations when you need to connect a flash drive with your files or an external USB hard drive to the operating system installed on a virtual machine. For example, you want to install a program in a virtual machine, and the installer of this program is on a USB flash drive, or vice versa, you need to transfer some files from the virtual machine to the main operating system, and create a shared folder for you, and it's not very convenient and fast , or maybe you even want to connect a printer to the virtual machine! I assure you, it is very easy to do all this.

Note: There are articles on VirtualBox on our site and they may be of interest to you

In this article, we will configure VirtualBox so that it can work with our external USB drive and flash drive.

First of all, we connect the USB flash drive to the computer and launch VirtualBox, then in the main window of the virtual machine, select the machine you need with the left mouse (if you have several of them) and click on the button Tune.

We mark the points Enable USB controller

Enable USB 2.0 Controller (EHCI)

In the window USB device filters, add a new USB filter, click on + and select our flash drive (in my case, Kingston DataTraveler 3.0, mark it with the left mouse.

that's all, two new USB filters in the form of our flash drive and an external hard drive have been added to the virtual machine, click OK

We load the operating system installed on VirtualBox, for example Windows 10, then in the main window Devices->USB devices I select my Kingston DataTraveler 3.0 flash drive and tick it, just as I tick my Western Digital My Passport USB portable hard drive.

Click to enlarge the image with the left mouse

Now both devices: a flash drive and a portable hard drive are available in the Computer window of the Windows 10 operating system and in Disk Management.

If you need a flash drive to appear in the main operating system, then in the main window Devices -> USB Devices, select your Kingston DataTraveler 3.0 flash drive and uncheck it

Click to enlarge the image with the left mouse

In this post I will tell you how to connect a USB disk to a virtual machine so that the guest system treats it like a regular hard disk.

This trick will allow not only booting from the installation USB - which, in my opinion, is rather pointless, since the ISO image is written to the USB flash drive, which is much easier to connect to a virtual computer in VirtualBox. If you connect a USB disk or flash drive to the guest system as a regular disk, then you can do such interesting things as:

  • boot from physical SATA disk via USB adapter
  • installing Windows on a USB disk or flash drive

If you do not have the ability to connect a SATA disk directly to a computer - for example, to a laptop - but you really need to boot into the operating system that is deployed on it, then the trick described here will help you do this: connect the SATA disk to the computer via a USB adapter, and then connect the USB disk to the virtual machine as a regular disk, as shown in this instruction.

Regarding the second point - installing Windows on a USB drive - if you want to install Linux on a USB flash drive (not to write a Live image, but to install a full-fledged system), then you do not have to do the trick shown here to install it - since Linux is perfectly installed on a portable media. But in Windows there is a prohibition for installation on USB disks and flash drives.

I will show you how to boot from USB on Windows and Linux. The principle is the same in both of these operating systems, but the commands differ slightly due to the specifics of the OS.

How to Boot into VirtualBox from USB on Windows

Connect a USB flash drive or disk to your computer. Then press Win + r and execute diskmgmt.msc.

Find your USB flash drive and remember the disk number:

For example, in my screenshot, the flash drive has the number 2.

Close all VirtualBox windows if they are open.

In the window that opens, enter:

Now go to the folder where you have VirtualBox installed. If this program is installed in the default directory, then the command to go:

Cd% programfiles% \ Oracle \ VirtualBox

If you chose a different location for VirtualBox, then edit the previous command accordingly.

Now on the command line, paste the following command, in which replace # to the disk number that we looked at just above, then press Enter:

VBoxManage internalcommands createrawvmdk -filename C: \ usb.vmdk -rawdisk \\. \ PhysicalDrive #

For example, I have this second drive, then the command looks like this:

VBoxManage internalcommands createrawvmdk -filename C: \ usb.vmdk -rawdisk \\. \ PhysicalDrive2

If everything went well, the following message should appear:

RAW host disk access VMDK file C: \ usb.vmdk created successfully.

Note that you can replace C: \ usb.vmdk to any file location you want.

This command creates a virtual machine disk file (VMDK) pointing to the physical disk you selected. When you load a VMDK file as a disk in VirtualBox, VirtualBox will actually have access to the physical disk.

Now open VirtualBox as administrator - this is a must, otherwise it will not work as it should. To do this, press the button Start, dial VirtualBox and select " Run as administrator»:

VirtualBox can only access raw disk devices with administrator privileges.

Now in VirtualBox create a new virtual machine, select the appropriate operating system and when it comes to choosing a hard disk, instead of creating a new one, select Use an existing virtual hard disk:

Now open the file C: \ usb.vmdk(or another if you saved it somewhere else or under a different name):

Boot your virtual machine, now it should see your USB flash drive as an ordinary hard drive. That is, if it is a correctly written boot disk or USB flash drive, then the system will boot from it.

Please note that the USB device must be the first hard drive in your VirtualBox virtual machine, otherwise it will not boot. If you are connecting a new USB disk to an existing machine, then try changing the order of the media in the settings of this machine, or select the appropriate disk at the beginning of the boot.

How to Boot into VirtualBox from USB in Linux

To understand the principle, read the previous section on Windows. On Linux, to find out the name of the USB drive, run the command:

Sudo fdisk -l

In my case, the disk has a name / dev / sdb.

To create a virtual disk file pointing to a real disk, run a command like this:

Sudo VBoxManage internalcommands createrawvmdk -filename /root/usb.vmdk -rawdisk / dev / sd #

Where instead of # enter the letter of the corresponding drive. An example for my conditions:

Sudo VBoxManage internalcommands createrawvmdk -filename /root/usb.vmdk -rawdisk / dev / sdb

In this command, you can replace /root/usb.vmdk with a different location of your choice.

To run VirtualBox as administrator, run the command:

Sudo VirtualBox

Everything else - creating a virtual machine and choosing an existing virtual disk as a hard disk - just like in Windows.

VirtualBox is able to pick up the usb port with the desired device at startup.

For example, we are using a usb printer (or want to use a flash drive) that only works under Windows XP. Let's take the port with the connected printer from the main PC (of course, the printer is physically connected to a real PC).

First, everything is manual.

We select in our virtual machine (control panel at the bottom) which port we want to connect (all external usb devices will be shown).

After capturing the usb device, hover the mouse over the desired device and see the details.

We need serial number 281208003422.

Launches USB setup.

We see the filters for USB devices and create a new one.

We indicate in the filter the serial number of the port, which we learned during the first manual connection. In this case, 281208003422. And we call this filter somehow.

That's all. Now, on startup, the VirtualBox virtual machine will automatically capture this usb device to itself.

VirtualBox (Oracle VM VirtualBox) is a virtualization system designed to create a virtual machine with hardware parameters of a real computer, on which you can run any operating system. Latest version 5.2. Company website www.virt ...

You need to run different platforms on one workstation. Nothing is easier than . What else is great about? But the fact that VirtualBox works well with USB devices and forwards ports from the host operating system. Everything is very transparent and convenient. With a little knack for manipulating USB devices, you'll love it. However, when using USB for the first time in VirtualBox, the extension pack is required (VirtualBox 4.2.12 Oracle VM VirtualBox Extension Pack ). Download it on the manufacturer's website (link to the manufacturer's website ). After that, you will be prompted to add the logins of all users to the group ‘ vboxusers‘.

USB Unable to Use Warnings

VirtualBox window about the request to add users to the 'vboxusers' group

Settings

To add yourself to the vboxusers group, run the command in the terminal, opening it with the keyboard shortcut CTRL + ALT + T, having previously replaced in the proposed version % username% to your username or to the user who needs to give permission to use USB devices in the virtual machine:

Sudo gpasswd --add% username% vboxusers

You can also install the graphical "Users and Groups" utility:

Sudo apt-get install gnome-system-tools

If you have any other ideas on this, write in the comments below.