jump to navigation

Share folders between Windows host and Linux guest in VirtualBox September 15, 2009

Posted by razasayed in Uncategorized.
Tags: , ,
1 comment so far

1. Start the Linux virtual machine. If you have Guest Additions installed go to step 5 directly.
2. Click on the Devices menu and choose Install Guest Additions…
3. Now, run the following commands as root at the terminal.

 cd /media/cdrom0
../VBoxLinuxAdditions.run 

Note: The VBoxLinuxAdditions.run file may be called VBoxLinuxAdditions-x86 or something similar on your system. So, please verify before you execute the file.
4. Reboot the virtual machine
5. From the Devices menu, choose Shared Folders… and add any folder or drive from your Windows host. Make sure that the Make Permanent checkbox is ticked . For example, add D:\VirtualBoxShared with the name VirtualBoxShared.
6. Now, on your Linux guest create the directory to mount your shared folder from Windows on. For example,say a user foo,wants to mount the shared folder from Windows on /home/foo/vbox_shared . So, on your Linux guest run the following command at the terminal.

mkdir /home/foo/vbox_shared

7. Now, we need to mount the shared folder from the Windows host i.e. D:\VirtualBoxShared on the folder in the Linux guest we created in the previous step i.e. /home/foo/vbox_shared . To do that run the following command as root on the terminal.

mount.vboxsf VirtualBoxShared /home/foo/vbox_shared

Note: mount and vboxsf are separated by a period.
8.But, there is a problem . If you now reboot the virtual machine, the shared folder wont be accessible, as the mount is valid only for the current session.So,to mount the shared folder every time your Linux guest boots, edit the file /etc/rc.local and put the following line at the start:

mount.vboxsf VirtualBoxShared /home/foo/vbox_shared

Voila !, you now have a folder shared between your Windows host and Linux guest with full read write access from each ! 🙂