CIFS Samba mount hangs for several minutes


Add a network share folder in /etc/fstab

//windows-server/shared /mnt/shared cifs  iocharset=utf8,credentials=/root/.naspasswd,dir_mode=0750,file_mode=0750  0 0

Most time it works well. But every few days or weeks, the connection or the mount point seems to go dead or hang, such that any process that tries to access the mount point gets stuck in D state (disk, or I/O wait). those processed become impervious to TERM and KILL signals. The frozen state lasts for 5+ minutes.


Add a cron job in /etc/crontab to access the newwork shared folder every minite.

* * * * *   root    touch /mnt/shared/keepalive

Force umount hung network shared folder

sudo umount -f -a -t cifs -l /mnt/shared


Written on June 14, 2017