Having a virtual machine installed on a personal computer offers many uses. One use is the ability to try a new operating system before it is released, such as Windows 7.
Once you’ve installed a virtual operating system, you might want to access files that are stored on the host operating system. VirtualBox offers a feature called ‘Shared Folders’ which will allow you to share files between the host and guest operating systems.
Linux Host with Windows Guest
Steps performed in host (Linux)
- Verify that the guest virtual machine has been shut down.
- Open the terminal from Applications > System Tools > Terminal
- Enter the following, substituting the virtual machine name, shared folder name, and the path to files on the host.
- Start the guest operating system.
VBoxManage sharedfolder add “virtual machine name here” -name “shared folder name” -hostpath “/path/to/files/here“
Steps performed in guest (Windows)
- Start the guest operating system from the host.
- Install Guest Additions from Devices > Install Guest Additions. Note: You will need to restart.
- Open the command prompt from Start > Run… > cmd.
- Enter the following into the command prompt, substituting the shared folder name entered in step 3 above.
- Adding the /PERSISTENT:YES to the command will mount the share at every boot.
- You can also change the drive letter from p: to any other you wish.
net use p: \\vboxsvr\shared folder name /PERSISTENT:YES
Windows Host with Linux Guest
Steps performed in guest (Linux)
- Start the guest operating system from the host.
- Before Guest Additions can be installed, some dependencies need to be installed using the command below.
- After the dependencies have been installed, you can install Guest Additions from Devices > Install Guest Additions.
- Open the terminal and enter the following line
- When the guest has restarted, open Shared Folders from Devices > Shared Folders… from the guest window.
- Click the Add New Shared Folder icon on the right of the window, or press the Insert button on your keyboard.
- At the Add Share window, select Other… from the Folder Path drop down and select the path of the folder on the host that you wish to share with the virtual guest.
- In the Folder Name enter a name of the shared folder, such as MyShare.
- Click the Make Permanent checkbox if you wish to keep the changes and click Ok to close the dialog.
- Open the terminal and enter the following command to mount the shared folder.
- The above command will not keep the shared folder mounted after restarting the system. To mount when starting the system, you will need to edit your fstab as shown below.
- Your shared folder will now be mounted at boot.
sudo yum install kernel-headers kernel-devel gcc
sudo cd /media/VBOXADDITIONS_(VirtualBox Version Number)
Once the guest additions have been installed, you will need to restart the guest OS.
sudo mount -t vboxsf sharename mountpoint
Eg. sudo mount -t vboxsf MyShare /home/dustin/Desktop/Shared
sudo nano /etc/fstab
sharedname mountpoint vboxsf defaults 0 0
eg. MyShare /home/dustin/Desktop/Shared vboxsf defaults 0 0
Once the above steps are completed, you will now be able to access files on your host operating system from your VirtualBox guest operating system.
Leave a Reply
You must be logged in to post a comment.