突然有一天发现df执行卡住了,一直不显示结果。
$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda3 221G 100G 121G 46% / devtmpfs 16G 0 16G 0% /dev tmpfs 16G 0 16G 0% /dev/shm tmpfs 16G 1.6G 14G 11% /run tmpfs 16G 0 16G 0% /sys/fs/cgroup /dev/sda1 494M 204M 291M 42% /boot
已知情况是,我挂载了/dev/sdb到/mnt下,而df执行的时候一直卡住,/mnt也没显示,怀疑是/mnt卡住了。
解决方法:
umount -l -f /mnt
问题解决。
下面查看一下umount执行的参数
$ umount -h Usage: umount [-hV] umount -a [options] umount [options] <source> | <directory> Options: -a, --all unmount all filesystems -A, --all-targets unmount all mountpoins for the given device in the current namespace -c, --no-canonicalize don't canonicalize paths -d, --detach-loop if mounted loop device, also free this loop device --fake dry run; skip the umount(2) syscall -f, --force force unmount (in case of an unreachable NFS system) -i, --internal-only don't call the umount.<type> helpers -n, --no-mtab don't write to /etc/mtab -l, --lazy detach the filesystem now, and cleanup all later -O, --test-opts <list> limit the set of filesystems (use with -a) -R, --recursive recursively unmount a target with all its children -r, --read-only In case unmounting fails, try to remount read-only -t, --types <list> limit the set of filesystem types -v, --verbose say what is being done