How to configure a share folder with Linux Mint Guest

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Testing
Posts: 2
Joined: 20. Feb 2014, 04:32

How to configure a share folder with Linux Mint Guest

Post by Testing »

[I think this needs to be moved to "Guest Systems -> Linux Guests". Sorry.]

It took me quite a lot of time to nut this out so I thought I'd write it up and save others some time.
Software used:
Host: Windows 7
VirtualBox: v4.3.6
Guest: MintMATE 16
Instructions:

1) Create a folder on your host machine, I like to have mine on the Desktop, but you can have it wherever you want. I recommend creating a file in the folder so that you can tell if the share is working.

2) Start VirtualBox and open the settings for your Mint system.

Add a "Machine Folder" and select the folder you want to share (the one you created in step 1).

You will need to give it a name. Check the "Make Permanent" box so you don't have to repeat these steps.

You can then check "Auto-mount" if you want VirtualBox to automatically mount the share folder. If you do this it will be mounted in /media directory, along with the prefix "sf_". The other option is to manually set up where we want it to mount.

4) Start your virtual OS.

Option 1:

If you checked "Auto-mount" in step 2) the share folder will actually be mounted in /mdeia. The problem is that your user isn't a member of the vboxsf group (meanig you can't open it). We can fix this by adding our-self to the group:

Code: Select all

     sudo gpasswd -a <username> vboxsf
     sudo reboot

You should now be able to navigate to the folder:

Code: Select all

    cd /media/sf_<ShareName>/
Note: "In Linux guests, auto-mounted shared folders are mounted into the /media directory, along with the prefix "sf_". For example, the shared folder myfiles would be mounted to /media/sf_myfiles."

This isn't very convenient, so we can create a link to the mounted share:

Code: Select all

    rmdir Desktop/VirtualBoxShare/
    ln -s /media/sf_Share/ Desktop/
Option 2:
If you want to set up the mount point yourself you will need to continue with these steps.

5) We now need to create a folder where the shared folder will be "mounted". In terminal (CTRL + ALT + T):

Code: Select all

    mkdir Desktop/VirtualBoxShare
6) You can now try mounting the share to this folder:

Code: Select all

    sudo mount -t vboxsf Share Desktop/VirtualBoxShare/
7) If you go to the desktop and try and open this folder (or ls Desktop/VirtualBoxShare/), it will just hang... something is wrong.

From my understanding Guest Additions has not been configured for the current user. To rectify this we need to reinstall it.

From the "devices" menu select "Insert Guest Additions CD image...", this should automatically mount the CD on the desktop.

Then run the installer:

Code: Select all

    sudo /media/<username>/VBOXADDITIONS_4.3.6_91406/VBoxLinuxAdditions.run

Reboot the system:

Code: Select all

    sudo reboot
Now try remounting the share:

Code: Select all

    sudo mount -t vboxsf <ShareNmae> Desktop/VirtualBoxShare/
If you open the mount point, it should work.

8) The next thing you probably want to do is mount the share automatically when you start Mint.

I originally tried to edit the fstab file, which is what it says in the VirtualBox documentation, but this didn't work:

Code: Select all

     sudo gedit /etc/fstab (or use nano)
At the bottom of the file add a new line that reads:

Code: Select all

    Share /home/<username>/Desktop/VirtualBoxShare vboxsf defaults 0 0
        where: [<sharename - from step 3> <mountpoint> vboxsf defaults 0 0]
[/color]

Apparently fstab mounts the file system before vboxvfs has even been loaded. Luckily we can just put our mount command in the /etc/rc.local file:

Code: Select all

    sudo gedit /etc/rc.local
Before the"exit 0" command add the mount line from above (you don't need sudo anymore as rc.local will be executed as a superuser. You do however need to specify the full directory):

Code: Select all

    mount -t vboxsf Share /home/felix2/Desktop/VirtualBoxShare/
Save and reboot to try it out:

Code: Select all

     sudo reboot
If everything worked, you should now have the shared folder mounting automatically!

References:

<Can't post links>
Sandflea
Posts: 1
Joined: 14. Feb 2014, 04:32

Re: How to configure a share folder with Linux Mint Guest

Post by Sandflea »

Testing,

Thanks for the post. Your post is EXACTLY what I have been trying to do with my new computer. Your post allowed me to see the other OS (Win7) drives in my system. I had been searching for more than a week for a soultuon, as I am not versed in Linux to have navigated a solution on my own.

My reason for Win7 host with Mint as a guest is Linux will not recognize my network card when Linux is the host. To my surprise, after setting up Linux as a Guest within Win7, it is able to connect with the network.

Thanks again for your post.

Sandflea
keithterrill
Posts: 2
Joined: 25. Nov 2016, 18:25

Re: How to configure a share folder with Linux Mint Guest

Post by keithterrill »

Just need to say thank-you. This was one of the best how-to helps I have encountered in a long time. It was clear without being insulting, and it got the job done.

THANK-YOU
Will69
Posts: 1
Joined: 20. May 2019, 05:05

Re: How to configure a share folder with Linux Mint Guest

Post by Will69 »

I just followed these instructions with VirtualBox v.6, and it worked as you described. Why does VBox give plain, straight-forward instructions on doing this stuff? Thanks for you clear steps!
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: How to configure a share folder with Linux Mint Guest

Post by mpack »

I assume there's a "not" missing in that sentence.

Is your question: why does the VirtualBox manual not give detailed step-by-step tuition for Linux? I would think you already know the answer.
Post Reply