How to create a shared folder between host Operating System and Guest Operating system?
This is the scenario that you run Windows as your host operating system and Ubuntu in a VirtualBox, and that you want to access a specific Windows folder from Ubuntu.
Share a folder between Host OS-> Windows and Guest OS ->Ubuntu(Virtual box)
Install install Guest Additions from VirtualBox’s menu go to Devices->Install Guest Additions
This will mount a virtual CD on your /media/cdrom. As root user Open this /media/cdrom added folder using Open with terminal option(Right click with mouse).
Run the program VBoxLinuxAdditions.run. When the program completes reboot your VirtualBox.
$ sudo ./VBoxLinuxAdditions.run
Create a shared folder. From Virtual menu go to Devices->Shared Folders then add a new folder in the list, this folder should be the one in windows which you want to share with Ubuntu(Guest OS).
Make this created folder auto-mount.
Example -> Make a folder on Desktop with name Ubuntushare and add this folder.
When done with you shared folder(s) specification, we mount folder from Ubuntu(Guest OS).
Create a mountpoint, this a directory in Ubuntu that will share files with the shared folder from Windows.
Run this to create a directory in Ubuntu
$ sudo mkdir ~/Desktop/windowsshare
With your mountpoint created you can now mount the shared folder.
Run this command to share the folder:
$ sudo mount -t vboxsf Ubuntushare ~/Desktop/windowsshare
Ubuntushare is the name of folder we add in VirtualBox Devices section this folder is in Windows(Host OS).
~/Desktop/windowsshare is the directory in Ubuntu(Guest OS)
Now you can share the files between Windows and Ubuntu. Try adding any file in windows(Host OS) Ubuntu share folder now check Ubuntu(Guest OS) windowsshare directory the file will be reflected.
This article is contributed by SHAURYA UPPAL. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.