Automount SMB netwok drive

New to Debian (Or Linux in general)? Ask your questions here!

Automount SMB netwok drive

Postby billgreenwood » 2018-11-17 19:24

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
billgreenwood
 
Posts: 4
Joined: 2018-11-17 19:01

Re: Automount SMB netwok drive

Postby 4D696B65 » 2018-11-17 19:49

User avatar
4D696B65
 
Posts: 2220
Joined: 2009-06-28 06:09

Re: Automount SMB netwok drive

Postby billgreenwood » 2018-11-17 21:00

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

Re: Automount SMB netwok drive

Postby billgreenwood » 2018-11-17 22:48

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
billgreenwood
 
Posts: 4
Joined: 2018-11-17 19:01


Re: Automount SMB netwok drive

Postby billgreenwood » 2018-11-21 21:22

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
billgreenwood
 
Posts: 4
Joined: 2018-11-17 19:01

Re: Automount SMB netwok drive

Postby thatguychuck » 2018-11-22 01:30

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
User avatar
thatguychuck
 
Posts: 44
Joined: 2013-03-25 00:49

Re: Automount SMB netwok drive

Postby kevinthefixer » 2018-11-22 02:12

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).
kevinthefixer
 
Posts: 107
Joined: 2018-05-05 22:30


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 7 guests

fashionable