Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you force a CIFS connection to unmount

People also ask

How do I unmount cifs in AIX?

Try the command #fuser -cx this will show you what/who is utilizing the mounted filesystem. 2. If this is an exported filesystem unexport it. Gregssman, any form of NFS mount can become a tight knot to unravel/undo, but you grab the scissor called 'umount -f' and you cut it off.

How do you unmount a mount in CMD?

To unmount a mounted file system, use the umount command. Note that there is no “n” between the “u” and the “m”—the command is umount and not “unmount.” You must tell umount which file system you are unmounting.


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.)


umount -a -t cifs -l

worked like a charm for me on CentOS 6.3. It saved me a server reboot.


On RHEL 6 this worked:

umount -f -a -t cifs -l 

This works for me (Ubuntu 13.10 Desktop to an Ubuntu 14.04 Server) :-

 sudo umount -f /mnt/my_share

Mounted with

 sudo mount -t cifs -o username=me,password=mine //192.168.0.111/serv_share /mnt/my_share

where serv_share is that set up and pointed to in the smb.conf file.


I had this issue for a day until I found the real resolution. Instead of trying to force unmount an smb share that is hung, mount the share with the "soft" option. If a process attempts to connect to the share that is not available it will stop trying after a certain amount of time.

soft Make the mount soft. Fail file system calls after a number of seconds.

mount -t smbfs -o soft //username@server/share /users/username/smb/share

stat /users/username/smb/share/file
stat: /users/username/smb/share/file: stat: Operation timed out

May not be a real answer to your question but it is a solution to the problem


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