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.
First, under VirtualBox Settings > Shared Folders, select the driver and set them to be shared. You can also rename them like below.
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.
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
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.
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
/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.