Mount Windows share in fstab

Hi there,

Linux beginner here, running suse 11.1. I’ve found a ton of instructions and how to’s on mounting windows shares in linux. However i cant seem to get them mounting at boot after editing fstab.

My fstab currently looks like this:

/dev/disk/by-id/ata-ST9160821AS_5MA4FYMR-part1 swap swap defaults 0 0
/dev/disk/by-id/ata-ST9160821AS_5MA4FYMR-part2 / ext3 acl,user_xattr 1 1
/dev/disk/by-id/ata-ST9160821AS_5MA4FYMR-part3 /home ext3 acl,user_xattr 1 2
proc /proc proc defaults 0 0
sysfs /sys sysfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
usbfs /proc/bus/usb usbfs noauto 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
//192.168.1.107/Music /home/richard/music cifs username=server_user_name,password=server_password,_netdev,uid=richard,gid=users 0 0
//192.168.1.107/Videos /home/richard/videos cifs username=server_user_name,password=server_password,_netdev,uid=richard,gid=users 0 0

My shares run on Windows 2008 server. There have everyone full control permissions set. Im using the administrator account to access the shares.

It works fine when i mount manually using

mount -t cifs -o username=server_user,password=server_password //192.168.1.107/music /home/richard/music

any ideas?

No, and I’m sure this is a known bug with something. Google your issue and thousands of posts come up - I’ve tried all the fixes (using _netdev option, setting up a crontab with @reboot etc), nothing works.

Here’s the acid test. First, unmount your manual mount. Next, if you do this:

sudo mount -av

Do you get any errors, or is the share mounted? You may need to add a “domain=” option in, and fstab doesn’t like usernames with spaces in them.

But I have the same problem as you. I can do “mount -av” after a reboot, or use a manual mount command, and the share is mounted.

But no matter what, I can’t get it to mount automatically on reboot. Has to be a bug somewhere…

weigy104 wrote:
> Hi there,
>
> Linux beginner here, running suse 11.1. I’ve found a ton of
> instructions and how to’s on mounting windows shares in linux. However i
> cant seem to get them mounting at boot after editing fstab.
>
> My fstab currently looks like this:
>
…]
> It works fine when i mount manually using
>
> mount -t cifs -o username=server_user,password=server_password
> //192.168.1.107/music /home/richard/music
>
> any ideas?

Have a look at /etc/samba/smbfstab

Theo

Here’s a diagnostic test that will indicate whether the problem can be tweaked to work: Are the fstab cifs mounts working if you execute this command after booting has finished

sudo mount -a

If that will mount them then there is a workaround that will force them to mount automatically. So, does it work?

swerdna, that’s exactly what I posted :slight_smile:

What’s the workaround? I have this exact problem and can’t fix it.

Hi Blah99. It was your post that prompted me to throw in my 2 cents. I believe your problem is an error in your crontab entry involving @reboot. It should be a root cron entry and it’s syntax is like this:

@reboot sleep 10;mount -a

Notice that’s all on one line.

If it doesn’t work then take the sleep 10 to sleep 15 and then to 20, but 10 should work. If it still doesn’t work, check your crontab setup, including whether the daemon is running (Yast → System → Services Runlevels → cron). You can check the root crontab with this command in a console after you su to root:

crontab -e

Have you tried with uid=1000 instead of using the user name?

Sorry took so long to get back to you.

When i check services cron is running. When i type “sudo mount -a” everything mounts as it should.

When i type “crontab -e” as su it opens an empty file in what looks like vi editor. I take it i should add

@reboot sleep 10;mount -a

to this file? and the fact that it is empty is why im having these issues?

Edit: Nope using 1000 as uid didn’t make any difference either.

You can use either uid=name or uid=100x

Yes is the short answer.

If you can’t hack the vi editor you can change to a GUI editor of your choice. See this tutorial for that option:
Cron Tables (Crontab) in Suse / openSUSE [Event Scheduler for 10.x, 11.x]
Particularly the segment “Choosing your editor”. Focus on the file /etc/profile.local

Yep, I know you can but is there any difference at boot time?

Hello, everybody!
I have absolutely same problem: shared folder doesn’t mount automatically.

My system is Linux openSuse 11.1 x86. (Samba 3.2.4). I try to mount the WindowsXP shared folder //desktop/D$ to /home/d.jurin/D (0777). As a first step, I’ve tried to use //etc/samba/smbfstab configuration file.

//desktop/D$ /home/d.jurin/D cifs username=Administrator,password=*****

No results.

Hence, the manual mounting

mount –t cifs –o username=Administrator,password=***** //desktop/D$ /home/d.jurin/D

is fine, I tried to use the file systems table (fstab)

//desktop/D$ /home/d.jurin/D cifs username=Administrator,password=*****,_netdev,uid=d.jurin,gid=users 0 0

doesn’t work.

But if I remount this file manually,

mount -a

shared folder is successfully mounted to my mount point (/home/d.jurin/D), and everything ok.

Please help!

I don’t know (I never thought about it or tested it). Have you found that it helps?

No, not tested either.
But I thought that since it seems to work when the user is logged and not before that, the system might not be aware of that user existing… or something like that :slight_smile:

@djurin

If the server //desktop has a fixed IP, I’ve found that using the IP address rather than the netbios name can solve the issue for some client machines.

But if not, the crontab method will certainly work for you.

The problem is that the fstab mounts execute before the network is up. That’s the reason for the “_netdev” option. (_netdev stops the execution until the network is up). But obviously, _netdev doesn’t pause the mount for long enough for some computers – so that’s the bug. But what does work is the crontable entry:

@reboot sleep x;mount -a
because you can adjust x seconds up until it’s absolutely certain the network is up and then the fragment “mount -a” must work.

Odd, it must have been. I deleted my root crontab and created a new one, now it works!

Very strange…

Ah, ok, thanks swerdna.
I thought _netdev would’ve worked as expected :stuck_out_tongue:

Probably time for a bug report – it’s been a problem on and off for ppl since the cifs mount was introduced in place of smbfs in openSUSE. But it doesn’t strike everybody, just some.

2swerdna

yes, i have tried static IP, no results. About crontab method, it’s not clear for me, how exactly to place string “@reboot sleep 10;mount -a” to the cron table. Could you please explain me how to do it?

So, this propblem looks like the openSuse bug, doesn’t it?