How to mount host share directory in Virtualbox Linux system
It's quite easy to install Virtual Box Additions under Windows.
You just mount the .iso file and double click on the drive under
My Computer. It gets installed and once you set up shared
directory in VirtualBox for the choosen virtual a new drive
appears under My Computer. Boom done.
But under Linux it's not that easy. Sometimes you don't even
have a graphical environment installed (yet) and you just want
to access your host filesystem. I couldn't find any official
guide but I figured that out. Here is what made the trick for
me.
To prepare the virtual
- select the virtual you want to modify on the left side.
- right click -> Settings.
- click Shared Folders and then the tiny directory icon
with green plus to add a new shared directory - set following:
- Folder Path: "/"
- Folder Name: ROOT (should get filled in automatically)
- Make Permanent: check
- hit OK button.
- start the virtual.
To prepare the machine
- switch to root user with
su
command. - run
mkdir /media/root
. - run
apt update
. - run
apt install linux-headers-$(uname -r) gcc make bzip2
.
To install the additions
- in the running Virtual window hit Devices on the top then
Insert Guest Additions CD Image - run
mount /media/cdrom
- run
cd /media/cdrom
- run
sh VBoxLinuxAdditions.run
- run
mount -t vboxsf ROOT /media/root
Your host /
path is now mounted under /media/root
inside your
virtual.
Congratulations @n1-cz! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!