Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have Ubuntu installed on my PC. I have also installed Virtual Box in which I have installed windows XP.

I've given only 30 GB of space for my data (photos, music and videos) in the home folder of Ubuntu. I want to share that data (Folder) to XP so that I can play songs in XP too.

Please give any solution to make it possible.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

From a Howto in the VirtualBox forums:

After installing the Guest Additions, you can use the Shared Folders Functionality. To access them, you have to define at least one in the VM settings. Open the VM Settings and go to Shared Folders. You can define them there. Click on the Add button and browse for a folder you want to share. Make sure that the name of the share doesn't contain any illegal characters like white spaces. Keep the name as simple as possible. In this howto, I will use the name share.

Now that you have defined a SF, it's time to mount it. Boot the Guest and open a terminal. Create a folder where you will mount it on. E.g. in your home folder. I will use ~/host for the mount point. Now mount it with the following command:

sudo mount -t vboxsf share ~/host

Note that with this, the default mount options are used and all files are owned by root. This can be changed by adding some mount options. Options are passed on with the -o parameter. You can use multiple options with one parameter, seperate the values with a comma. See the man page of mount for more info on which options you can use. The User Manual also notes the options compatible with the Shared Folders. To mount the SF so that you are the owner of the files, use this command:

sudo mount -t vboxsf -o uid=1000,gid=1000 share ~/host

If you want to have it mount automatically upon each boot, put the mount command in /etc/rc.local (Debian based distro's), or whatever script is run at the end of the boot process. The Shared Folders service should mount them automatically, but that doesn't always happen. Using /etc/fstab has little effect, because that file is processed before the SF module is loaded and will fail to mount the share. Sometimes, the share does get mounted because the GA check for it when they are loaded upon boot, but it's very flaky, meaning it doesn't work most of the time. You're better of with the first option. When you put the mount command in /etc/rc.local, so it's mounted at startup, you can't use the short notation for your home folder. During startup, everything is done through the root user, so using ~ for home, means it's the home folder of Root (/root). Change it to the full path. For example:

mount -t vboxsf share /home/<username>/host
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.