在 Debian 里“mount 卡住(hang)”是非常常见的问题,通常不是 mount 命令本身坏了,而是它在等某个资源永远不返回。下面按「最常见 → 较少见」给你一个排错清单。
表现
mount -t nfs server:/share /mnt
# 或
mount -t cifs //host/share /mnt
直接卡死,Ctrl+C 可能都无效。
原因
解决办法
# NFS:加超时和软挂载
mount -t nfs -o soft,timeo=10,retry=0 server:/share /mnt
# CIFS
mount -t cifs //host/share /mnt -o username=x,password=y,vers=3.0
排查
ping server
telnet server 2049
showmount -e server
表现
mounting /mnt/xxx解决办法
server:/share /mnt nfs defaults,noauto,x-systemd.automount 0 0
或:
server:/share /mnt nfs _netdev,soft 0 0
表现
mount /dev/sdb1 /mnt
卡住
可能原因
排查
dmesg | tail
lsblk
smartctl -a /dev/sdb
表现
mount 命令卡systemctl status mnt-xxx.mount 也是 activating强制解除
systemctl stop mnt-xxx.mount
umount -l /mnt/xxx
表现
ps aux | grep fsck
mount /dev/mapper/crypt /mnt
如果 cryptsetup 没 open,会直接挂住。
验证
uname -a
dmesg | grep -i error
# 1. 看是不是网络挂载
mount | grep nfs
mount | grep cifs
# 2. 看 dmesg
dmesg -T | tail -n 50
# 3. 看进程状态
ps aux | grep mount
# 4. 看是否 D 状态(不可中断)
ps -eo pid,stat,cmd | awk '$2 ~ /D/'
你可以直接贴:
mount 命令或 /etc/fstab我可以直接告诉你是哪一行导致的、怎么改。