Create a shared folder between VirtualBox host and guest

shared folder in VM

(1) Configure a shared folder in VM settings

(2) Start VM box

(3) Click “Devices -> Insert Guest Additions CD Image”

(4) Log in to the VM

(5) Mount CD-ROM:

1
2
sudo mount /dev/cdrom /media/cdrom
cd /media/cdrom

(6) Install dependencies:

1
sudo apt-get install -y dkms build-essential linux-headers-generic linux-headers-$(uname -r)

(7)
Install Guest Additions

1
2
sudo su -
./VBoxLinuxAdditions.run

(8)
Check that kernel extensions are up and running:

1
sudo modprobe vboxsf

If cannot find vboxsf, run following commands:

1
2
3
/opt/VBoxGuestAdditions-4.3.30/init/vboxadd setup
sudo apt-get install virtualbox-guest-utils
sudo apt-get install virtualbox-guest-dkms

(9) When get vboxsf working,

1
2
sudo mkdir /mnt/rubysrc
mount -t vboxsf rubysrc /mnt/rubysrc

(10) To do auto mount, edit /etc/fstab and add:
SharedFolder /mnt/share vboxsf defaults 0 0

Share