Virtualbox shared folder
Posted: 2012-06-25 Filed under: system | Tags: share, virtualbox Leave a commentProblem: I have to use a virtual machine running Slackware32 to test build the scripts I maintain at SlackBuilds.org. Therefore I need an easy way to transfer the scripts and other files between the host and guest machines.
Solution: I use VirtualBox installed from the All distributions AMD64 binary. The host is running pure Slackware64 and the guest additions are installed in the Slackware32 guest. So:
– Create a shared folder, following the instructions from the virtualbox forums. I keep my virtual machines on a dedicated partition mounted at /vbox
, so let’s create the shared folder there: /vbox/vshare
.
– In the host, specify /vbox/vshare
from Settings > Shared Folders:
– I also double clicked on the entry and checked the Auto-mount and Make Permanent boxes.
– Fire up the virtual machine and create the shared folder, say just in the top of the root tree: /vshare
. To make it mount on boot, add the following in /etc/rc.d/rc.local
of the guest. I put just below the vboxadd
, vboxadd-service
and vboxadd-x11
guest additions services.
#!/bin/sh # # /etc/rc.d/rc.local: Local system initialization script. # # Put any local startup commands in here. Also, if you have # anything that needs to be run at shutdown time you can # make an /etc/rc.d/rc.local_shutdown script and put those # commands in there. # Start vboxadd # If you do not wish this to be executed here then comment it out, # and the installer will skip it next time. if [ -x /etc/rc.d/rc.vboxadd ]; then /etc/rc.d/rc.vboxadd start fi # Start vboxadd-service # If you do not wish this to be executed here then comment it out, # and the installer will skip it next time. if [ -x /etc/rc.d/rc.vboxadd-service ]; then /etc/rc.d/rc.vboxadd-service start fi # Start vboxadd-x11 # If you do not wish this to be executed here then comment it out, # and the installer will skip it next time. if [ -x /etc/rc.d/rc.vboxadd-x11 ]; then /etc/rc.d/rc.vboxadd-x11 start fi # Mount the shared folder mount -t vboxsf -o uid=1000,gid=1000 vshare /vshare
Reboot and it should work. That’s it!
EDIT (14 June 2015): I made the rc.local
example more clear, by pasting the contents of the whole file.