You are not logged in.

#1 2016-12-06 12:59:54

CallMeRoot
Member
Registered: 2015-12-10
Posts: 5

Automount virtualbox shared folder

I using VirtualBox in Windows and I have installed Arch Linux on it.

I have set a shared folder that can be accessed by both Windows and Arch Linux. I want to set virtualbox shared folder /media/sf_www on /home/~/public_html.
So after boot make manualy this.

sudo mount -t vboxsf /media/www /home/petr/public_html

But i would like make automount on /home/~/public_html after boot, or after login on my virtual system.
So try this:

[Unit]
Description=My script

[Service]
Type=simple
ExecStart=/usr/bin/autoshare.service

#[Install]
#WantedBy=multi-user.target

and

#!/usr/bin/sh
cd /media/
mount -t vboxsf www /home/petr/public_html

If i try make this

systemctl enable autoshare.service

have a problem, because linux mounting virtualbox dev after my script, so i have error no device:(

If i start manualy

systemctl start autoshare.service

works perfect:)

So my question is, what is the right way to make this  automaticly? I trying found solution 3 weeks:(

Thanks

Offline

#2 2016-12-06 13:03:58

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Automount virtualbox shared folder

Why not just make a symlink in your home directory that points to the shares location?

ln -s /media/vboxsf /home/petr/public_html

No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2016-12-06 19:57:46

CallMeRoot
Member
Registered: 2015-12-10
Posts: 5

Re: Automount virtualbox shared folder

Hello, thank you for your respond. If i using symlink have problem with  file rights look here
[link]http://superuser.com/questions/640027/w … red-folder[/link]

slithery wrote:

Why not just make a symlink in your home directory that points to the shares location?

ln -s /media/vboxsf /home/petr/public_html

Offline

#4 2016-12-08 20:20:39

CallMeRoot
Member
Registered: 2015-12-10
Posts: 5

Re: Automount virtualbox shared folder

So i tried fstab too, but without success"(

Offline

#5 2016-12-13 08:52:51

CallMeRoot
Member
Registered: 2015-12-10
Posts: 5

Re: Automount virtualbox shared folder

Hello nobody who can help?

Offline

#6 2016-12-13 10:38:10

bryan.paradis
Member
Registered: 2016-10-22
Posts: 43

Re: Automount virtualbox shared folder

Are you sure that the folder is available/can be accessed when this is running on boot?

In your service script make it do a lsmod | grep -i vbox > /tmp/vboxshare.log to check to see if the vbox kernel module is actually already loaded when your service is running? You should be able to do this in fstab as well? If it's running before the kernel modules are loaded that are needed for vbox shared folders then it's not going to work.

Last edited by bryan.paradis (2016-12-13 10:42:16)

Offline

#7 2016-12-15 22:40:10

nodivbyzero
Member
Registered: 2016-12-15
Posts: 2

Re: Automount virtualbox shared folder

Try to add your shared folder in VM Settings (Settings -> Shared Folders -> Auto-mount=YES
Then you should see your shared folder in /media folder.

Offline

Board footer

Powered by FluxBB