Best option to work with network folders with automatic mount and no manual unmount?


New Member
Hi I'm new to the forum.
I use linux in various distros for some years now as a main OS. Now I have OpenSuse Leap running with KDE.

I played around with a Raspi as NAS but switched to Synology for ease of use and better performance.

That is I'm able to mount network folders with SAMBA and NFS.

I ran into a few issues (folders mounted via fstab):
1. If a folder is mounted and the drive is unavailable, Dolphin (and other things) get stuck until I force an unmount
2. I a folder is mounted and I want do power off or reboot, I get "a stop job is running..." for the mounted folders

Both is annoying and I don't know how to overcome the issues. I read various instructions and how to's on how to mount a network folder but I did not find any solution to these issues. Maybe I did not understand all the different options correctly and that is one question I want to ask here.

In KDE Dolphin can open remote folders without the need to mount them (KIO-Slave). While this might be a solution to browse through files, there are limitations because not all applications are supported.

The questions are:
What is the best way to mount a network folder for me?
How can I work around the freezing issue when a folder is unavailabe (without the need to manually unmount the folder)?
How can I skip the stop job if a machine with mounted network folders is powered down?



Well-Known Member
I wouldn't put them in my fstab if they weren't always available.
I would either manually mount them, or possibly create a cron script
that checks to see if they are mounted, if not, try to mount.

Also it's not a good idea to just unmount a filesystem that a process is attached to.
This can cause file system corruption, hung processes (as you've discovered) and
locked memory that can't be used.


New Member
OK, if I mount manually or crate a cron job, then the folders are mounted.
If the folder becomes unavailable, I assume to have the same issue regarding stop process and hung applications?

About the unmount. I'd like to have this automatic as well. In case the folder is unavailabe I'd like the OS to maybe try for a while and then just "accept the fact" and maybe unmount it.


New Member
With your hint to a cron script, I managed do mount folders.

The mount script in the users home folder:
if ! grep -q '//' /proc/mounts; then
   if ping -c 2 "" >/dev/null; then
      mount -t cifs -o credentials='/home/caramba/.smbcredentials',users,_netdev // /home/caramba/Share
exit 0
The sudo cronjob:

# Shell variable for cron
# PATH variable for cron
#M   S     T M W   Befehl
@reboot /home/caramba/  > /dev/null 2>&1
*/5 * * * * /home/caramba/  > /dev/null 2>&1
That is the mount script is executed as super user.
Despite the option "users", I need super user permission when I want to write.
If there is an entry in fstab (also with the "users" option), I can read and write to the mounted folders as a regular user.

Why is it so?

Do I understand correctly: cron has a time @reboot which is when the OS has booted. There is no time for power off or sleep?

I think it would be good to unmount the folders when powering down, maybe also when the machine is going into sleep mode.

Another Idea: With the ping, I check if the server is present. In case it is not but the folder is mounted, could I just unmount?


New Member
I noticed an issue with the above.
The files and folders still were owned by root.

No I have an entry in fstab
//         /home/caramba/Share     cifs    uid=caramba,gid=users,file_mode=0664,dir_mode=0775,credentials='/home/caramba/.smbcredentials',noauto,users 0       0
For some reason I cannot set gid=caramba.
It seems _netdev is not available für CIFS?

The mount command in the mountscript is reduced to
mount /home/caramba/Share
After reboot the script gets executed before the network connection is established.
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online

Latest posts