# unmounting network filesystem

## creaker

Hello!

How to unmount network filesystems (like samba) if server hangs or powered off?

The one solution I found is unmounting with 'lazy' and 'force' options:

```
echo "password" | sudo -S umount -f -l /media/share
```

This works but takes a lot of time (up to 50-60 secs). All this time filemanager is inaccessable (hangs).

Also, if I fogot to unmount network and trying to halt or reboot PC, system hangs on shutdown stage and should be reseted with hardware reset button.

Is there solution (or workaround) for fixing this problem?

----------

## Logicien

Hello,

you can create if not, an executable script like /etc/local.d/local.stop who the contain will be

```
#!/bin/bash

/bin/umount -a -t cifs
```

```
chmod +x etc/local.d/local.stop
```

That will ensure that Samba shares will be unmount at shutdown preventing long delay. 

I do not have any trick to unmount Samba shares remotely if the server hang or die before they can be umounted. Give a try to the command script should not give better result than the one you use.

----------

## creaker

Logicien, thanks for reply.

Yes, it works and I've added script into local.d directory.

But any way delay on shutdown is here.

Let it be temporary solution.

Also I tried to mount share with 'timeo' options in order to reduce umount timeout, but got an error:

```
echo "password" | sudo -S mount -t cifs //192.168.1.5/share /media/share -o timeo,workgroup=WORKGROUP,ip=192.168.1.5

Password: 

mount error(22): Invalid argument

Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
```

Looks like 'timeo' is not valid option for cifs.

----------

