views:

3381

answers:

4

I have a CIFS share mounted on a Linux machine. The CIFS server is down, or the internet connection is down, and anything that touches the CIFS mount now takes several minutes to timeout, and is unkillable while you wait. I can't even run ls in my home directory because there is a symlink pointing inside the CIFS mount and ls tries to follow it to decide what color it should be. If I try to umount it (even with -fl), the umount process hangs just like ls does. Not even sudo kill -9 can kill it. How can I force the kernel to unmount?

A: 

There's a -f option to umount that you can try:

umount -f /mnt/fileshare

Are you specifying the '-t cifs' option to mount? Also make sure you're not specifying the 'hard' option to mount.

You may also want to consider fusesmb, since the filesystem will be running in userspace you can kill it just like any other process.

Chris AtLee
-f and -t don't help, the umount still hangs.
smoofra
have you rebooted since adding the '-t cifs' option to mount? I don't think there's anything you can do to fix your stuck mount point right now, your only hope is to try and mount it in a way that's more resistant to failure in the future.
Chris AtLee
A: 

Try umount -f /mnt/share. Works OK with NFS, never tried with cifs.

Also, take a look at autofs, it will mount the share only when accessed, and will unmount it afterworlds.

There is a good tutorial at www.howtoforge.net

Sunny
unfortunately -f doesn't work with CIFS. the umount still just hangs.
smoofra
+3  A: 

I use lazy unmount: umount -l (that's a lowercase L)

Lazy unmount. Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy anymore. (Requires kernel 2.4.11 or later.)

disq
+1  A: 

Similar: Force unmount of NFS-mounted directory

disq