Login

Login
  • Register
  • VectorDesign blog

    Testing Automation and general Tech Geek stuff

    mount a shared folder in Virtual Box Linux Guest

    Posted in linux on 9 March 2015 by vectordesign

    Start up your guest OS in VirtualBox. In the window for the running virtual machine, select Devices->Shared Folders… Click the icon to Add a New Shared Folder. Select the Folder Path drop-down and click Other. Navigate to your shared folder and click Choose.

    VirtualBox Add Share

    Click OK twice. That was the easy part.

    Go into your guest OS and open a terminal window.

    Create a new directory where you’ll mount the shared folder.

    mkdir ~/share

    Enter the id command and look at the output. You should see something like:

    id

    uid=1000(user) gid=1000(user) groups=4(adm),20(dialout),24(cdrom),46(plugdev),106(lpadmin),121(admin),122(sambashare),1000(user)

    It’s the uid and gid parts that are important. Now you will mount the shared folder from the host to the guest OS.  From a terminal in the guest OS:

    sudo mount -t vboxsf -o uid=1000,gid=1000 vbox /home

    Make sure to make the proper substitutions for uid and gid as well as the host and guest folder names (vbox and /home/user/share respectively).

    You should now be able to share files between your guest and host.

     

    Make the Mounted Share Permanent

    You can make the shared folder mount automatically each time you start the virtual machine by making an entry in /etc/fstab. From the guest:

    sudo gedit /etc/fstab

    Add a line at the bottom that looks like this:

    vbox /home/user/share vboxsf rw,uid=1000,gid=1000 0 0

    Again, make the appropriate changes for your folder names and user/group ids.

    Leave a Reply