Linux virtualbox mount usb

How to Access External USB Flash Drives from VirtualBox on Ubuntu Linux

Over a few months, we’ve shown students and new users how to install, configure and use VirtualBox virtualization software on Windows and Ubuntu Linux systems.

If you have followed our previous posts, you should know how to install, configure and use VirtualBox on Windows and Linux systems (Ubuntu).

This tutorial shows students and new users how to mount or insert an external USB flash/thumb drive into a VirtualBox guest machine running Windows or Ubuntu Linux VMs. In addition, it will allow you to access physical USB content from the guest’s Machine.

You won’t be able to access external USB devices from your VirtualBox guest machines without installing its guest additions tool. We’ve also discussed how to install that after installing the host software.

To get started with using external USB devices from VirtualBox guest machines, follow the steps below:

Install VirtualBox Guest Additions on the VM

When you create or install a new guest machine, your first task should be to install its guest addition tool in the VM. The tool contains a suite of utilities that enhance the virtual Machine’s operating systems and improves the management of the Machine…

Without the tool installed, the guest machine will not perform as expected.

To install the guest tools on Ubuntu / Windows guest machines, read the post below:

Note : Windows VMs need only mount the guest addition tool CD and install the executable. No need to install additional software or packages

Grant Ubuntu User Account Rights to Mount

After installing the VirtualBox guest addition tool on the VM, open the command terminal on the Ubuntu guest machine. This only works on Ubuntu, and run the commands below:

You should see the output below:

Output: Adding user `richrd' to group `vboxsf' . Adding user richrd to group vboxsf Done.

Or run the commands below if the above fails.

sudo usermod -aG vboxsf $USER

After that, shut down the guest’s Machine.

Mount External USB Drives

Now that you’ve installed the VirtualBox guest addition tool and have added your user account to the VirtualBox service group, follow the steps below to mount your external flash/thumb drives.

Читайте также:  Как показать скрытые папки linux

Shut down the guest machine, then insert the external USB into the host machine.

From the guest machine panel, select Settings or click Machine –> Settings.

Then go to USB on the left navigation panel. There, USB 2.0 (ECCI) Controller should automatically be selected. Most USB 3.0 devices are backward compatible with 2.0.

If your device is USB 3.0, then select that. If not, 2.0 should be perfect!

You will find the add USB button to the right. Click the second button below. Add an attached USB stick. Pick the device from the list. (generally called Generic Mass Storage)

Once the device is mounted, turn on the guest machine and log on.

You should then see the USB device mounted and shown on your desktop. Your device should show up automatically in the guest VM, and you can use it the same way you would be able to on the host operating system.

Access the device and the content it contains.

Congratulations! You have learned how to install VirtualBox guest addition tools and mounted an external USB thumb drive to the guest machine.

You may also like the post below:

Richard W

I love computers; maybe way too much. What I learned I try to share at geekrewind.com.

Источник

How to Access USB from VirtualBox Guest OS

There are times when you need to access USB from VirtualBox. For instance, you installed Kali Linux in VirtualBox and a USB wireless network adapter is required to do penetration testing. This simple tutorial will show you how to easily access your USB thumb drive, USB hard disk, or USB wireless network adapter in your Virtualbox guest OS.

It’s assumed that you have already set up VirtualBox on your host OS.

Step 1: Install Virtualbox Extension Pack

VirtualBox by default only supports USB 1.x devices. VirtualBox extension pack includes support for USB 2.0 and USB 3.0 devices, VirtualBox RDP and PXE boot for Intel cards. You must install the extension pack with the same version as your installed version of VirtualBox.

To check the version of your VirtualBox, open VirtualBox manager, then go to Help > About VirtualBox . Once you know the version number, go to http://download.virtualbox.org/virtualbox/ in your web browser to download VirtualBox extension pack which ends with .vbox-extpack extension.

install VirtualBox extension pack

Once downloaded, in VirtualBox manager go to File > Preferences > Extensions. Click the add button to add VirtualBox extensions pack from your hard disk.

virtualbox extensions pack usb 2.0 usb 3.0

Once you choose the extension pack, click Install button to install it. You can see what functionalities it adds to your virtual machine in the description.

Oracle VM VirtualBox extension pack

Then click Agree to accept VirtualBox license.

VirtualBox License

So now Virtualbox USB support is enhanced.

Step 2: Add Your User to vboxusers Group

In order for VirtualBox to see your USB devices, your user must be in the vboxusers group. Open up a terminal window (Ctrl+Alt+T), then run the following command. Replace your-username with your real username. (I assume your host OS is a Linux distro such as Ubuntu, instead of Windows).

sudo gpasswd -a your-username vboxusers

Now log out and log back in so the changes can take effect. To check which groups your user account belongs to, run:

Читайте также:  Linux win 10 theme

If you still aren’t in the vboxuser group, then restart your computer.

Step 3: Enable USB Controller and Add New USB filter

Click settings for your virtual machine.

Access USB devices in virtualbox

Select USB on the left pane. Then choose USB 2.0 controller or USB 3.0 controller. Note that you can only enable one type of controller. Next, insert your USB device to your host machine and click the add button to add new USB filter.

virtualbox add new usb filter

Choose your USB device and Click OK.

Selection_009

Step 4: Access USB from VirtualBox

Now boot up your virtual machine and you will see your USB device in the guest OS. It should be noted that your host OS won’t be able to see the USB device while it’s being used by VirtualBox.

To unmount USB device from guest OS, select devices > USB and uncheck your USB device.

access USB drive in virtualbox guest os

To mount USB in VirtualBox again, simply select your USB drive in the list.

How to Boot VM From USB Stick

Let’s say you created a bootable USB stick and you want to boot your VirtualBox VM from the USB stick. Virtualbox allows your VM to access raw hard disk, by creating a special VMDK image. I assume your host OS is Linux.

First, find the device name of your USB stick.

Mine is /dev/sdb . Then run the following command to create a VMDK image file /tmp/usb.vmdk .

sudo VBoxManage internalcommands createrawvmdk -filename /tmp/usb.vmdk -rawdisk /dev/sdb

Change the ownership of this file. Replace username with your real username.

sudo chown username:vboxusers /tmp/usb.vmdk -R

Then add your user account to the disk group, so you can access raw hard disk.

sudo adduser username disk

Log out and log back in for the changes to take effect. Then open Virtualbox and attach the raw disk ( /tmp/usb.vmdk ) to your VM.

Wrapping Up

Does this post helped you access USB drive in VirtualBox guest OS? Let me know in the comments section below. As always, if you found this post useful, subscribe to our free newsletter or follow us on Google+, Twitter or like our Facebook page.

Источник

Linux Commando

Initially a Linux command-line interface blog, it has evolved to cover increasingly more GUI app topics. Instead of just giving you information like some man page, I illustrate their usage in real-life scenarios.

Читайте также:  Чем раздать интернет linux mint

Search This Blog

Thursday, February 1, 2018

How to mount USB drives on VirtualBox

This is part 3 of the 4-part series on VirtualBox. This post shows you how to access, from your guest OS, a flash drive mounted on the Debian host. Parts 1, 2 and 4 demonstrate how to build a FreeBSD virtual machine using VirtualBox on a Debian host, perform post-installation tasks, and share folders.

Prerequisites

Configuring USB

Add user to vboxusers group.
VirtualBox access to the host’s USB drives is only granted to users of the vboxusers group. As root on the host, run the following command to add each VirtualBox user (e.g., peter ) to the group.

 # usermod -aG vboxusers peter 

Power off VM.
VirtualBox defaults to using USB Controller 1.1 (OHCI). Modern hardware uses USB Controller 2.0(EHCI) and USB Controller 3.0(xHCI). Before you can change the USB controller protocol, the virtual machine must be powered off.

Specify USB Controller.
Select either USB 2.0 (EHCI) Controller or USB 3.0 (xHCI) Controller according to your actual hardware.

Note that you can add USB Device Filters to define the types of USB drives which will be automatically made visible to the guest OS. Be forewarned that the USB drive, once made visible to the guest OS, will no longer be available to the host. More on the use of device filters in the next section.

Accessing USB drive

Unmount the flash drive (if it is auto-mounted on your host).
Making it available to the guest will automatically and instantly unmount it from the host. To avoid any data loss due to pending writes to the drive, it is a good practice to explicitly unmount the drive prior to handing control to the guest.

Assign USB drive to guest OS.

Open the virtual system console, and right click the USB drive icon.

Click to select your USB drive.

Note that this is a 1-time assignment only. Please see instructions at the end of the section on how to automatically assign this particular USB drive for all subsequent sessions.

Login to FreeBSD, and mount the drive.
You can mount a MS-DOS based flash drive by running the following commands as root. Replace /dev/da0s1 with the proper device identifier for your USB drive. (You can find out the exact device ID by first running dmesg to identify the device name, e.g. da0 , and fdisk to reveal the disk partition structure, e.g., s1 .)

 # mkdir -p /media/usb # mount -t msdosfs /dev/da0s1 /media/usb 

To always automatically assign a particular USB drive to the guest OS, open the VirtualBox Manager , click Settings , and then USB .

Finally, click Add USB device filter (with the + sign) icon, and select the USB drive that is currently inserted in the host.

Источник

Оцените статью
Adblock
detector