Friday, November 7, 2008

Create a shared folder between a Windows Vista host and Ubuntu guest with Virtual Box 2.0.4

It can be useful to share some part of your host file system with your guest and Sun Virtual Box allows you to do that through Shared Folders. The documentation provided in the pdf is a good one but lack a step that can make you lose some of your precious time. So, I decided to blog the steps I used to create a shared folder between a Windows Vista host and a Ubuntu Hardy Heron guest.

1- If your guest is running, you can go to the Settings menu and choose Shared Folders. Otherwise, you click the Settings button in the xVM window. The following window appears:

2- Click the Add a New Shared Folder button in the top right corner of the window.




From the first field, you can add the path to the folder you want to share from your host system. Then, you have to specify a name for this sharing. This name will be recognized by Linux as a device name that you will have to mount.

3- In Linux, open a Terminal and create a new directory where you would like to put your shared folder content. It's important to create a specific folder for your shared folder.

4- Then type in the following command:

mount -t vboxsf devicename mountpoint

devicename is the name you specified earlier.

mountpoint is the path to the folder you have just created.

mount is a root command. As Unix system only have one root file system, this command allows you to attach the file system found in a device to the root file system.

My mistake was to put as the mountpoint an existing folder. The consequence was that Linux will attach the new file system to that mountpoint and hide all the other elements that already existed in that mountpoint.To cancel mount command, you can use:

sudo umount devicename

Now you should be good to go.

No comments: