Monday, October 11, 2010

Set Up A Virtualbox Shared Folder For A Linux Virtual Machine

VirtualBox Shared Folder


Sun VirtualBox is an excellent free virtual machine manager, capable of running nearly any operating system on the market. What many who are new to running virtual machines using VirtualBox don't realize is that their guest machine doesn't have to be isolated from their host machine. This will allow you to use the files that you have on your Linux machine from your Windows box. Configuring a VirtualBox shared folder is actually quite simple. In this article I will be showing you configure a shared folder between a Xubuntu Linux guest machine and a Windows XP host machine.


Instructions


1. Create a shared folder on your Windows machine. In this example, I'll make folder called "xubuntushare" on my desktop. Just right-click, select "New", select "Folder", and type the name of the folder you'd like to create.


2. Start Virtualbox, if you haven't already, select your Linux virtual machine from the list, click "Settings" from the top menu, select "Shared Folders" from the left-hand pane, and click the "Add New Shared Folder" button. Choose your folder from the "Folder Path" field (in my case I just navigated to my desktop and selected "xubuntushare". Finally, name your folder, choose read-only if needed, and click "OK" twice.


3. Fire up your Lunix virtual machine from VirtualBox. Once you've logged in, select "Devices" from the top menu, and click "Install Guest Additions" if you haven't already. Guest Additions is needed in order to allow the shared folders feature and several others to function correctly. This automatically mounts a virtual installation CD into the machine. If the Linux version you are using has auto-run enabled, simply allow the installation to continue. If it does not, just manually start the installation CD. Allow Guest Additions a moment or two to finish installing, and restart your virtual machine when prompted.


4. Once the machine comes back up, create a new folder on the Linux guest in the location of your liking. In this example, I just stuck to my desktop again, and created a folder called "share".


5. Open a Terminal Window on your Linux guest. Many Linux machines open the terminal by combining CTRL+ALT+F1 (F2, F3...). If you're using GNOME (like Ubuntu) go "Applications" > "Accessories" > "Terminal", or in Xfce (like Xubuntu) go "Applications" > "System" > "Terminal".


6. In the terminal run "sudo mount -t vboxsf sharename mountpoint" where "sharename" is what you called the folder in VirtualBox settings manager (in my case, "xubuntushare"), and "mountpoint" is where you are placing the share on the Linux host machine (in my case, ~/Desktop/share). Enter you password if prompted and continue.


7. That's all there is to it. Now you can easily share files between your host and guest machine.







Tags: Guest Additions, guest machine, host machine, Linux guest, machine from