Unmounting Samba shares after network disconnect

Recently I had some issues with my network switch, and because of that my home server which has some shares from NAS mounted started to work funky. I could not use the mounted shares, the load skyrocketed because of the IO wait, and I couldn’t unmount the share. After a moment of tinkering it appeared that I needed to add -l flag to mount command. So, to unmount the network share when it’s not accessible you can use this command:

umount -l /path/to/share

This flag means that umount will work in lazy mode, when the filesystem is detached immediately, but all the cleanup will be done when possible.

You can also use the following command to unmount all CIFS/Samba shares.

umount -a -t cifs -l

Leave a Reply

Your email address will not be published.