# [Solved] Cifs shares not unmounting at shutdown...

## grooveman

Hello.  I feel like a bit of a noob with this one, but for some reason, I cannot get a fix.

Gentoo Linux is my primary OS.  However, I have a win7 box because I need to use creative suite for my photos.  I have set up the win7 box to be my "server", because it has more resources than my linux box, and a better motherboard (and it has more hard drive bays in the case).  

Since nearly all my data is on the win7 box, I frequently need to mount a share from it.  I have this in my /etc/fstab:

```
/10.99.99.199/grooveman            /home/grooveman/win7 cifs   user,_netdev,noperm,uid=grooveman,noauto,soft,user=grooveman,dir_mode=0700,file_mode=0700,credentials=/etc/secret,rsize=130048,wsize=57344 1 2
```

It works great, but the problem is that whenever I forget to unmount it and go for shutdown, it always hangs on "Unmounting network filesystems".  Many times have I walked away after shutdown, only to come back hours later to find that my system is hung.

I have tried all manner of options for my mount command, and it doesn't seem to matter if I use the fstab, or execute it from the command line.  If I don't remember to execute an unmount, the share will not unmount at shutdown.

The interesting thing is that I set up a friend with Ubuntu, and it has the same exact problem.

What is the best way to address this?

Thank you for your help!

-G

----------

## toralf

Just a shot in the dark, but what happens if you remove "_netdev" from the options ? I could bet, the problem is related to the network services already shutdowned, or ?

----------

## grooveman

 *toralf wrote:*   

> Just a shot in the dark, but what happens if you remove "_netdev" from the options ? I could bet, the problem is related to the network services already shutdowned, or ?

 

Actually, I added that in an attempt to fix this problem, but obviously, it didn't help.  I added it because I found this:

 *Quote:*   

> (2) The option _netdev is always recommended for cifs mounts in fstab.

 

----------

## grooveman

Hmm... just found this.  Maybe I'll give that a shot in the morning.  It is for Ubuntu/gnome, and of course I use gentoo/kde, but I think it should work...

----------

## Logicien

I think it would be simpler to create a script named as example cifs.stop in /etc/local.d/ with the contain

```
#!/bin/bash

export PATH=/bin:/sbin:/usr/bin:/usr/sbin

umount -a -t cifs

exit 0
```

and make it executable. Then CIFS will be unmount before any reboot and shutdown process.

----------

## grooveman

Thanks Logicien,

That certainly did the trick, and also tipped me off to the change of using local.d.  Seems like init scripts are ever-a-changin'.

The question is, why isn't something like this included in the standard shutdown scripts for unmounting network volumes?  Seems benign enough to include, and would certainly be useful in enough cases...

Thanks again.

G

----------

