Shared folders problem - fstab doesn't work

Discussions about using Linux guests in VirtualBox.
Post Reply
klippe
Posts: 14
Joined: 16. Dec 2008, 22:32

Shared folders problem - fstab doesn't work

Post by klippe »

Hi!

My setup: host - windows xp, guest - kubuntu.

I've configured a shared folder called shared_folder in my virtualbox (2.1). Now I can mount it using:

Code: Select all

mount -t vboxsf shared_folder /media/share
It works. The problem is when I try to use fstab to automount the above shared folder. I use the following entry in fstab:

Code: Select all

shared_folder /media/share vboxsf rw,uid=myuser,gid=mygroup 0 0
then after I call:

Code: Select all

sudo mount -a
I get an error:

Code: Select all

[mntent]: line 10 in /etc/fstab is bad
What is strange the same fstab entry works perfectly on my other machine. The only difference is that there I have a linux host and linux guest.
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Post by TerryE »

This has been discussed a number of times. The issue is that fstab is processed very early in the boot sequence and before the vboxsf device driver has been initialised. So your mount will fail. Put the mount in your rc.local (or equivalent for your distro). This is executed late in the boot sequence after the device drivers have been started.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
klippe
Posts: 14
Joined: 16. Dec 2008, 22:32

Post by klippe »

TerryE wrote:This has been discussed a number of times. The issue is that fstab is processed very early in the boot sequence and before the vboxsf device driver has been initialised. So your mount will fail.
So why it doesn't work even after the system is started (so the vbxsf has already been loaded) when I call mount -a?

What's more, as I said earlier, it works on my other system.
Put the mount in your rc.local (or equivalent for your distro). This is executed late in the boot sequence after the device drivers have been started.
Thanks for the hint.
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Post by TerryE »

klippe wrote:So why it doesn't work even after the system is started (so the vbxsf has already been loaded) when I call mount -a?
What is core to Linux is the kernel and a system API that enable programs / applications / utilities to be build to deployed on the OS platform. Details like how the bootstrap sequences is orchestrated varies for Debian derivatives, SuSE, Fedora, Redhat derivatives, etc.

If the vboxsf driver is loaded before the fstab is processed then putting it in the fstab will work, if not then it won't. In the case of Debian systems the fstab is processed before the relevant /etc/rcN.d is used to sequence the start from /etc/init.d. rc.local is processed last.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
klippe
Posts: 14
Joined: 16. Dec 2008, 22:32

Post by klippe »

TerryE wrote:
klippe wrote:So why it doesn't work even after the system is started (so the vbxsf has already been loaded) when I call mount -a?
What is core to Linux is the kernel and a system API that enable programs / applications / utilities to be build to deployed on the OS platform. Details like how the bootstrap sequences is orchestrated varies for Debian derivatives, SuSE, Fedora, Redhat derivatives, etc.

If the vboxsf driver is loaded before the fstab is processed then putting it in the fstab will work, if not then it won't. In the case of Debian systems the fstab is processed before the relevant /etc/rcN.d is used to sequence the start from /etc/init.d. rc.local is processed last.
Thanks for details but...
1. It is still strange - my second system, the working one that uses fstab to mount shared folders, is also Kubuntu (Kubuntu guest on Kubuntu host).

2. My question was about calling

Code: Select all

mount -a
which executes fstab. I call this command after my system __is fully loaded__ . At this time mount -a doesn't work whereas normal manual mount command works perfectly. IMHO boot sequence is not relevant here.
stephanecharette
Volunteer
Posts: 300
Joined: 10. Nov 2007, 22:03
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu-64bit, Windows
Location: Kelowna, British Columbia, Canada
Contact:

Re: Shared folders problem - fstab doesn't work

Post by stephanecharette »

klippe wrote:The problem is when I try to use fstab to automount the above shared folder. I use the following entry in fstab:

Code: Select all

shared_folder /media/share vboxsf rw,uid=myuser,gid=mygroup 0 0
I don't know why it doesn't work, but I do have the following to offer: When I look at my own fstab file, I see two differences:

Code: Select all

shared_folder   /home/stephanec/Desktop/shared_folder vboxsf rw,uid=1000,gid=1000
1) first difference is that I've used the numerics instead of the names for user & group

2) second difference is I don't have the trailing "0 0" at the end of the line for dump/check...though man fstab tells me that if not specified it defaults to zero.

On my Ubuntu 8.10 host & Debian Etch guest, this line in my guest fstab ensures the share is mounted every time I reboot. Like what you are trying to do, if I manually unmount it, then "sudo mount -a" will remount it as expected.

Stéphane
GeneRickyShaw
Posts: 1
Joined: 15. Mar 2013, 07:52

Re: Shared folders problem - fstab doesn't work

Post by GeneRickyShaw »

I had the same problem - not only would fstab not work, but mount -a wouldn't do the trick, either.

But since I put the command in /etc/rc.local, it works fine. That suits me just fine since putting it in /etc/fstab works on normal systems.

Odd flaw, but one that's livable.
Post Reply