How do you force a CIFS connection to unmount

前端 未结 11 1926
借酒劲吻你
借酒劲吻你 2021-01-29 17:32

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

相关标签:
11条回答
  • 2021-01-29 18:20

    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.

    0 讨论(0)
  • 2021-01-29 18:26

    umount -a -t cifs -l

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

    0 讨论(0)
  • 2021-01-29 18:27

    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

    0 讨论(0)
  • 2021-01-29 18:28

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

    0 讨论(0)
  • 2021-01-29 18:28
    umount -f -t cifs -l /mnt &
    

    Be careful of &, let umount run in background. umount will detach filesystem first, so you will find nothing abount /mnt. If you run df command, then it will umount /mnt forcibly.

    0 讨论(0)
提交回复
热议问题