Setup File Mount Between Ubuntu in VirtualBox and Windows Host – The Definitive Guide

If you Google “Linux Windows Share” or “Ubuntu VirtualBox Windows Share” or similar topics along the line you will find thousands of articles on how to configure various ways to mount and share folders and files between Windows and Linux. Heck, I even wrote one post years ago. That said, many methods to enable different file share between Linux and Windows might have worked, but you might not get it working on the first try. Too many guides out there telling you one over the other, the lack of consistency makes people scratch their heads. I’m here try to solve you a headache by giving you just THE solution that works for Linux running under VirtualBox that has Windows as it’s host.

How To Mount Windows Share In Ubuntu under VirtualBox

Let’s say we have couple hard drive some are local and some are network attached hard drive that we want to access in Linux. Here is how to do it.

2016-05-25_0835_001

First, under VirtualBox Settings > Shared Folders, select the driver and set them to be shared. You can also rename them like below.

2016-05-25_0834

An example of a network shared, you can simply find the Folder Path as root, in this case, P drive. Be sure to check Make Permanent and click OK.

2016-05-25_0835

Now go inside your Linux, in my case I’m running Xubuntu, a light GUI version of Ubuntu, run the command below in terminal.

sudo vim /etct/fstab

2016-05-25_0842

We are leverage this tool called fstab to automatically mount a partition that’s exposed by VirtualBox when setting up the shared folder in the previous step. When you ran the command in the above step, you should see something like below.

2016-05-25_0842_001

p_drive /media/p_drive vboxsf _netdev,uid=1000,gid=1000    0    1

Substitute my p_drive to the driver of your choice be sure to make it the same as the one you have named when first enable Shared Folder in VirtualBox settings. Notice I did NOT create a folder named p_drive under /media that’s because it’s not necessary. What’s needed are the rights and settings that get carried over correctly.

Once done with the change, save the configuration in vim, by pressing ESC, and SHIFT + : , type wq

Now restart your Linux, after the restart you will successfully mount partitions on your VirtualBox host. If that doesn’t work, try to toggle between “Auto-mount” under the VirtualBox Shared Folder setting of a particular folder.

Jonathan Hu

Programming by day, Web Development, Canucks & Movies for spare time!
Co-founder of Next of Windows and a cool geek 🙂

Last updated: 05/26/2016

Posted in: How to
Discover more: , ,