Wednesday, March 2, 2011

HowTo: Using shared folders in virtualbox

This I think is how you mount

Postby Telcontar2k8 » 24. Feb 2008, 00:14
Edit March, 26th 2008: Ok, I've just installed a fresh Ubuntu 8.04 on my Virtualbox 1.5.6 with a Windows Vista Home Premium Host. I followed my own tutorial really step by step, and my shared folder are mounting on start-up.
Be aware that this tutorial is only working for Ubuntu, since other Linux distribution have different ways of loading modules and even dealing with fstab.
Maybe other users could write the files, which needed to be modified within other distributions, below.
I will now add some remarks with red in the text below to point out possible errors.
________________________________________________
Attention: As of March 30th 2008 this HowTo has to be seen as "Maybe working" since some users reported that after following this tutorial the shared folders still didn't work.
If you can figure out where the error is please give me a hint, so I can change this.
________________________________________________
Hey, I recently had a similar problem. I knew the right code lines, but they didn't seem to work. A friend of mine helped me then in finetuning everything. But before I start my how to, some general facts: I used this commands on a Windows Vista Home Premium Host and a Ubuntu 7.10 Guest. Maybe there are some little differences to other guests.
So here is my little how to include a shared folder in fstab:

This tutorial is about, how to mount windows-Folder into a Linux Folder of your current home directory, NOT about mounting a windows partition into a linux folder or mounting a windows partition into a new linux partition (as a new devise) within your guest.

1st step: Include the virtualbox Guest Additions as described in the Virtualbox Manual
2nd step: Shut down the virtual machine
3rd step: Create a Permanent Shared Folder
(In a deactivated machine go to Edit -> Shared Folder) --> make sure they are permanent (tick the checkbox), otherwise the guest won't find them after a reboot.
4th step: Start the virtual machine
5th step: Open a terminal
6th step: Check wether Guest Additions were installed successfully. After you have typed in the command "lsmod | grep vb" you should see the modules vboxvfs and vboxadd approximately like that:
vboxvfs 42048 0
vboxadd 25128 11 vboxvfs

If you don't see those modules you have to check your installation of the guest additions and restart with step 4. --> with Ubuntu 8.04 only Virtualbox 1.5.6 works so far
7th step: Create a folder within your virtual machine to which you want to mount your exchange folder. --> pay attention to the rights of this folder. You need to have read,write and execute rights. See the chmod manpage for further details about granting rights. If given everybody every right just to make sure it works
8th step: Go to the folder /etc
9th step: Use your favorite editor to open the file "modules" of this folder. Be sure you have root rights, otherwise you could maybe not be able to save it. You could for example use the command "sudo gedit modules".
10th step: After the last line you write now vboxvfs and in the next line vboxadd. Then save save and close this file.
11th step: Now open the file fstab which is contained in the same folder. Again open it with root-rights, so you are able to save your changes.
12th step: After the last line you write now:
NameOfTheSharedFolderInVirtualbox NameOfYourMountFolderInLinux vboxsf defaults 0 0
in my file it looks approximately like this:
exchange /home/someuser/someos vboxsf defaults 0 0

Instead of defaults you can use every kind of rights for your mount point as described in the man pages of mount (man mount)-->someuser is my own username, someos is the folder created in step 7, where the windows folder will be into. If this folder is empty in your host it will be empty in your guest, so I recommend to put an empty testfile in the host folder just to see whether the mount was successful

When now starting the virtual machine, the folder should me mounted automatically (it does in mine)


Btw: If you want to mount a shared folder manually, I usually used the command
mount -t vboxsf exchange /home/someuser/someos
till I got this working

No comments:

Post a Comment