Mount a NAS

Hello
First sorry for my bad english

I have a RPI2 with osmc and kodi. I’m installing also a plex server on it.

I have a NAS connected to my router

in /etc/fstab i’m adding this line

//192.168.1.19/Mymovies /mnt/plex cifs username=xxxxxxxxx,password=xxxxxxxxxx,uid=1000,gid=1000,iocharset=utf8 0 0

I creat new folder with this name: plex in /mnt/

i execute this commande : sudo mount -a

Then my folder /Mymovies/ in my
NAS was mounted as /mnt/plex

but after each reboot i must execute sudo mount -a !!!

how i can permanently mount it

Use the auto option. You may also want rw (read-write), and user.

//192.168.1.19/Mymovies /mnt/plex cifs username=xxxxxxxxx,password=xxxxxxxxxx,uid=1000,gid=1000,iocharset=utf8,rw,auto,user 0 0
1 Like

Add noauto,x-systemd.automount - this will mount the nas share first time it’s accessed.

This will even work if you turn on your NAS when Pi is already running.

1 Like

@bmillham
Thank you for your help
But did not slove my problem
cause after reboot i must use sudo mount -a again!

but what do you mean by user? is it the username of my bas?

best regards

@sew
Where i must add the line noauto,x-systemd.automount ? i dont kwon about linux

Thank you in advance

Do the fstab line just like I showed. user should be user

1 Like

user should be my nas user or just “user” ?

Just user

1 Like

if you want to use noauto,x-systemd.automount just add after your credentials:

//192.168.1.19/Mymovies /mnt/plex cifs username=xxxxxxxxx,password=xxxxxxxxxx,noauto,x-systemd.automount,uid=1000,gid=1000,iocharset=utf8 0 0

1 Like

I do it but after rebooting my rpi2 i must use the command again!

You might try sew’s suggestion and see if that works better for you. It seems like the mount is happening before the network it up.

If sew’s suggestion does not work, then you should post your log files (check the top link in the forum for info on doing that)

1 Like

The sew’s suggestion works for me

Thank you for your help, bmillham and sew.

Best regards

Good to know. I’ll update my sorta-positronic brain to remember sew’s suggestion :smile:

1 Like

As an afterthought, if you want write access to the drive, add the rw option.

How to add it? i’m 0 in linux :slightly_smiling:

Look at the fstab line I supplied, and compare it to what sew had you do. Notice the part of the fstab line that has a bunch of , separated stuff. That’s where you’d put it. Beginning, middle or end doesn’t matter.

So after utf8 just do ,rw

1 Like

This one:

//192.168.1.19/Mymovies /mnt/plex cifs username=xxxxxxxxx,password=xxxxxxxxxx,noauto,x-systemd.automount,uid=1000,gid=1000,iocharset=utf8 0 0,rw

or this one?

//192.168.1.19/Mymovies /mnt/plex cifs username=xxxxxxxxx,password=xxxxxxxxxx,noauto,x-systemd.automount,uid=1000,gid=1000,iocharset=utf8,rw 0 0

the bottom one rw before the 0 0
with a space before the 0 0

1 Like

OK
Thank you very much Dilligaf

@sew

if you want to use noauto,x-systemd.automount just add after your credentials:

//192.168.1.19/Mymovies /mnt/plex cifs username=xxxxxxxxx,password=xxxxxxxxxx,noauto,x-systemd.automount,uid=1000,gid=1000,iocharset=utf8 0 0

How would this look like if my NAS has no username. ie: //127.0.0.1/XXX /mnt/drive cifs guest 0 0

where do I add it then? I also checked this, but I am not wiser than before.