Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Automount SMB netwok drive

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
billgreenwood
Posts: 4
Joined: 2018-11-17 19:01

Automount SMB netwok drive

#1 Post by billgreenwood »

Hi

I've installed Debian 9 and for the life of me I cannot get this OS to automatically mount a network volume on restart.

The Volume is an SMB Share. I spent a good few hours yesterday googling this and well I give up and need help!

I can mount this manually via command line.
mount -t cifs "//192.168.0.2/TEST" -o username=TEST,password=TEST,domain=<WORKGROUP,vers=3\.0 /home/me/TEST

So my server IP is 192.168.0.2
The Username is TEST
Password is TEST

As you'll guess this is my first time with Debian and linux as a whole

Help VM appreciated.


Cheers Bill

User avatar
4D696B65
Site admin
Site admin
Posts: 2696
Joined: 2009-06-28 06:09
Been thanked: 86 times

Re: Automount SMB netwok drive

#2 Post by 4D696B65 »


billgreenwood
Posts: 4
Joined: 2018-11-17 19:01

Re: Automount SMB netwok drive

#3 Post by billgreenwood »

Thanks :)

billgreenwood
Posts: 4
Joined: 2018-11-17 19:01

Re: Automount SMB netwok drive

#4 Post by billgreenwood »

Hi Debian community


Oh well. This didnt work.

The file system i'm trying to log on to is read only, which is correct. and it's set for guest access.

Is this fstab approach the only way?


TIA


Bill

CwF
Global Moderator
Global Moderator
Posts: 2709
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 201 times

Re: Automount SMB netwok drive

#5 Post by CwF »


billgreenwood
Posts: 4
Joined: 2018-11-17 19:01

Re: Automount SMB netwok drive

#6 Post by billgreenwood »

Hi
Me again, this is driving me a bit nuts now! I tried other options and it seems fstab is the only way to go. As long as I get an automounted on reboot smb share I really don't care.

On the Debian this is just not happening for me consistently. Sometimes when I reboot it may mount, sometimes it will not. More not then often!

The server is a freenas box with a folder called HI_RES set to smb share as read only. I can connect to this share from my mac with no issues.
I enter the user and password in the dialogue box and it mounts.

This is my fstab entry
//192.168.1.200/HI_RES /home/bill/HI_RES cifs credentials=/home/bill/.HI_RES_credentials,uid=1000,gid=1000,users,vers=3.0,iocharset=utf8,sec=ntlm 0 0

My .HI_RES_credentials text file is
username=username
password=password



Can anyone see what I am doing wrong?

Please?

cheers

Bill

User avatar
thatguychuck
Posts: 52
Joined: 2013-03-25 00:49
Been thanked: 2 times

Re: Automount SMB netwok drive

#7 Post by thatguychuck »

I'm not exactly an expert on these things, but I've been using the same setup for a long while now and can't recall any issues with it.
My fstab:

Code: Select all

//192.168.1.101/server_storage_a /lan.mnt/server_storage_a cifs noauto,users,credentials=/home/charles/.credentials/.server_storage,workgroup=WORKGROUP 0       0

kevinthefixer
Posts: 190
Joined: 2018-05-05 22:30

Re: Automount SMB netwok drive

#8 Post by kevinthefixer »

I have had similar problems. Here are a couple things to check: first, if you read up on fstab (enter "man fstab" in terminal) it points out that the order of drives in the table does make a difference! Place your samba share just after your internal drive mounts and before any other removeable drives (CD, DVD, floppy etc). Second, and I'm guessing this is your stumbling block, samba or any other network share can't mount if your network isn't up yet. So add the "noauto" and "users" options to the fstab entry, (I see you have users), then mount it with a simple script. The "noauto" keeps it from trying to mount early in the boot process, the "users" allows a normal user to mount it later. I put my script in /usr/local/sbin and call it from XFCE's "Session and Startup" utility. It should read something like

Code: Select all

mount HI_RES &
exit 0
The ampersand allows other stuff to happen while the mount is being executed; the exit 0 (that's a zero) may help with a slow-shutdown problem. It is two lines, two commands in the script. Save the script anywhere, really, with a .sh extension, and don't forget to make it executable:

Code: Select all

chmod +x sambamount.sh
in terminal if sambamount.sh is the name of your script.

This works for me consistently (well, except when I forget to boot the server box first).

Post Reply