Mount VirtualBox share folder

By xngo on February 21, 2019

Mount VirtualBox share folder

  1. Run your virtual machine.
  2. Run Devices->Insert Guest Addition CD image....
  3. Run the following commands:
# Install required packages
aptitude -y install bzip2
aptitude -y install dkms build-essential linux-headers-$(uname -r)
 
# Mount the CD-ROM(VBoxGuestAdditions.iso). Assuming that the device is located at /dev/sr0.
mount /dev/sr0 /media/cdrom
 
# Install VirtualBox additions.
cd /media/cdrom/
# If you don't have X Window installed, add --nox11
./VBoxLinuxAdditions.run
 
# Optional: Check if it is installed correctly. If it is, then the below command will show the version number.
modinfo vboxguest | grep ^version | tr -s ' '
 
# Mount share folder: <folderNameGiven> is the folder name that you set from your VirtualBox Manager.
mkdir /share
mount -t vboxsf folderNameGiven /share/

Auto mount VirtualBox share folder permanently

  1. From your VirtualBox Manager, go to your Shared Folders.
  2. Check Auto-mount and Make-permanent.

References

  • https://www.virtualbox.org/manual/ch04.html#sf_mount_manual
  • https://help.ubuntu.com/community/VirtualBox/SharedFolders
  • http://www.turnkeylinux.org/docs/virtualbox-guest-addons
  • linux-headers-$(uname -r) availables -> https://packages.debian.org/wheezy/kernel/

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.