[SOLVED] How to permanently mount Osmc to Samba server?

hello, i have another one question - i am new to osmc and linux also, and my english is poor, so sorry for a noob style…

i need to have permanently mounted osmc (on rbpi2) to NAS using samba protocol because of some services in background. for example i need to mount it to media/myname.

i found, that it should be done by editing /etc/fstab but it does not work for me:

after searching i have generated this line:
//mysambaserver/mysambafolder/ /media/myname/ cifs noauto,x-systemd.automount,username=name,password=name,uid=1000,gid=1000,iocharset=utf8 0 0

but it does nothing. when i remove noauto,x-systemd.automount and run sudo mount -a it reports this error:
Couldn't chdir to /media/myname/: No such file or directory

so when i make by sudo mkdir /media/myname this directory and then running sudo mount -a it mounts my samba server and it works. BUT after reboot i have to do it manually again (making the directory and re-mount all).

but i want to be mounted it automatically, after every reboot. how to solve this? have i something wrong in /etc/fstab ? or should i start to search the web how to run scripts after booting (run the mkdir and mountcommands after boot?)

(ps: i know that using password in fstab is not safe, i use it just for simplicity, after solving the mounting itself, i will use the method with password in external file)

Did you read /media/README ?

Try using /mnt instead of /media.

1 Like

thank you so much! i am eating my humble pie - i was blind and readme file absolutely overlooked. sorry for messing these forums. but for noobs like me - here is the final and working solution:

  1. sudo nano /etc/fstab
    add this line, save and exit:
    //mysambaserver/mysambafolder/ /mnt/myname/ cifs noauto,x-systemd.automount,username=name,password=name,uid=1000,gid=1000,iocharset=utf8 0 0

  2. sudo mkdir /mnt/myname

  3. reboot…

3 Likes