General / Linux / Ubuntu / VirtualBox

Sharing Folders & Files Between Host and Guest OS in VirtualBox

VirtualBox  is a free and most popular virtualization software from Oracle. Oracle VM VirtualBox is installed on an existing host operating system as an application; this host application allows additional guest operating systems, each known as a Guest OS, to be loaded and run, each with its own virtual environment. Supported host operating systems include Linux, Mac OS X, Windows XP, Windows Vista, Windows 7, Windows 8, Solaris, and OpenSolaris; there is also a port to FreeBSD. Supported guest operating systems include versions and derivations of Windows, Linux, BSD, OS/2, Solaris and others Since release 3.2.0, VirtualBox also allows limited virtualization of Mac OS X guests on Apple hardware, though OSX86 can also be installed using VirtualBox

If you are using VMware, another virtualization software, you can copy files and folders directly from the host to Guest OS. But it is not so simple in VirtualBox.

In VirtualBox, you have to install guest additions in guest OS.

img guestaddition

 

 

You can do this by Going to   Devices –> Install Guest Additions in guest OS.

 

 

 

 

 

 

After installing VirtualBox Guest Additions, Reboot the Guest OS. Now your Guest OS is Ready to share the folders. Go to Devices –> Shared Folders and select the folders you want to share with Guest from Host OS.

 

Browse the folders you want to share by clicking ‘Add new shared folders’.

 

 

And give a ‘share name‘ in the ‘Folder Name’ box and remember that name. And you can make those files read-only and permanently shared, by checking corresponding check boxes.

 

 

 

These Steps are common for both Windows and Linux Guest OS.

 

 

 

 

 

 

 

Sharing in Windows Guest OS

In windows Guest you can access the shared folder instantly Using ‘Run’ program or you can mount permanently as Network Drives

Using Run

Use windows key + R  or select run from start menu. And Type “\\vboxsvr\sharename”  Replace ‘sharename’ by the name you given as ‘Folder Name’ in the previous Step.

 

 

 

 

 

 

 

Mount as a Network Drive

Open command prompt from Start menu or type ‘cmd’ in Run.

And Type the followin Command  ‘net use x: \\vboxsvr\sharename‘  (Replace ‘sharename’ with your actual shared folder’s name.). If you already use the drive-letter X:,  give an unused letter.

 

 

 

Then Go to explorer or My Computer ,there you can see a new network drive (X:) mounted and ready for access.

In Linux (Back Track 5,Ubuntu…etc)

1. Create a folder on Desktop or anywhere else you want mount the shared folder from the Host OS (eg: Create a folder SharedItems on Desktop of the Guest OS ).

2. Then,Open a new Terminal window (Applications -> Accessories -> Terminal) and execute the following command:

          sudo mount -t vboxsf  sharename  Desktop/SharedItems

where sharename is the name we given to the folder that we shared in the Host OS and   Desktop/SharedItems is the path where we created the folder ‘SharedItems‘ in which the shared folder to be mounted.

(Note: Most Linux OS’s are case-sensitive. So shareditems instead of SharedItems in terminal gives you an error message. Give absolute path instead of Desktop/SharedItems, if you are not in home folder i.e. /home/user/Desktop/SharedItems)

If you login as ‘root user’ you can avoid sudo in the above command.

 

 

 

 

 

 

 

 

 

Now you can access the shared folders and files from SharedItem folder from the Desktop.

 

Follow Mohammed Safeer On twitter.

Advertisements

9 thoughts on “Sharing Folders & Files Between Host and Guest OS in VirtualBox

    • welcome. it may due to incorrect or used drive letter or else. from ‘Run’ you didn’t have to give drive letters. thats why it works. try again using different drive letter.
      net use x: \\vboxsvr\shared (Replace ‘shared’ with your actual shared folder’s name, X: is the drive letter)
      i think you are trying to mount the shared folder permanently in windows. you can browse shared folder from computer-> Network
      Thanks!

  1. it is not working.. an error i displaying in run attempt to check the spelling.. please help me. I was stucked up with this problem since 4 months to data trransfer between host and guest ie windows 8 to XP.

    • i didn’t get your problem correctly. I think you are having problem when trying the command “\\vboxsvr\sharename“ in ‘Run’ window. Please use the folder name you shared instead of ‘sharename’ specified in the command. ie. if your shared folder name is share123, then use the command as “\\vboxsvr\share123“.
      In latest versions of virtualbox , drag and drop file sharing is there.
      Hope you get the answer. feel free to ask doubts.

  2. Pingback: Install and Configure VirtualBox | TechLog

  3. Hi Mr.SAFEER, good job, I tried it in Win8.1 and it works. I opened Explorer, clicked the Home Tab, and at the top clearly seen is “Paste CMD” along with the clipboard icon.
    When you use the “CUT CMD” the clipboad is active(not greyed out) along with the
    “PASTE CMD” and you can paste that in whatever location you choose.
    Thanks You Mohammad for the system level CMDs’ they work.

  4. well search all the web and use all the options to enable to transfer files from linux to virtual box but invane but finnally this helps me alot to do my valueable task. thanks buddy. i am very thankful to you for this important piece of information.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s