How-to share a folder between the host and guest operating systems using Virtual Box.

Virtual Box

VirtualBox is a free and open-source hypervisor for x86 computers currently being developed by Oracle Corporation. http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html

Context

The host OS is Windows 10 and the guest OS is Ubuntu. The guest OS is working normally. You have already created a folder on the host that you would like to share with the guest. Sharing folders between the host and guest OS is often helpful.

Sharing the Folder

  • Log into the guest OS

  • Insert the Guest Additions CD image vb guest cd

  • Allow the script to run and install new capabilities

  • Shutdown the guest OS

  • From the VirtualBox Manager, select the Settings snd then the Shared Folders for your VM vb shared folders

  • Click Add new shared folder

    • Folder Path is the location on your host OS

    • Folder Name is the name for your guest OS

    • Check Auto-mount and Make Permanent

Verify the Share

  • Start your guest OS

  • Start a terminal

  • Enter ls /media

    • Should display a listing that includes the folder name you provided prefixed with sf_

  • If your shared folder is not shown or you received and error such as VBoxClient (seamless): failed to start. Stage: Setting guest IRQ filter mask Error: VERR_INTERNAL_ERROR, please see Reinstalling the Guest Additions CD

Permissions on the Share

By default, guest OS general users do not have permission to view the share. The share is available to users in the vboxsf group. Add your username to this group.

  • sudo usermod -aG vboxsf username

  • Log out

  • Log in

  • Verify that you can now view files within your shared folder

Reinstalling the Guest Additions CD

If you had problems viewing the shared folder inside your guest OS and all other settings are correct, perhaps the Guest Additions did not properly install.

  • Open a terminal on the guest OS

  • sudo apt-get install gcc make perl

  • Insert the Guest Additions CD image vb guest cd

  • Allow the script to run and install new capabilities

  • Reboot

References