CentOS Linux release 7.2.1511 (Core)
ide
使用strace df
命令對進程進行追蹤,結果以下:rest
... stat("/sys/fs/cgroup/cpu,cpuacct", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 stat("/sys/fs/cgroup/blkio", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 stat("/sys/fs/cgroup/hugetlb", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 stat("/sys/fs/cgroup/memory", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 stat("/sys/kernel/config", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 stat("/", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0 stat("/proc/sys/fs/binfmt_misc", #<== 發現卡在這一步了!
df 卡住問題在本質上仍是因爲 systemd 和 kernel 之間存在競爭而引發的, 致使其它程序訪問掛載點的時候出現 hang 住的現象。code
根據redhat bugzilla
的描述, 只要解決掉 mount 和 automount 過程當中可能產生的競爭便可, 咱們能夠經過關閉proc-sys-fs-binfmt_misc.automount
釋放已經存在的競爭來解決 df hang 住的問題。進程
根據上面的緣由說明,總體解決方式有三種:get
(1)systemctl restart proc-sys-fs-binfmt_misc.automount
;it
(2)升級到最新 systemd-219-57 版本;io
proc-sys-fs-binfmt_misc.automount
進行 mask 操做, 只進行靜態的 mount 操做;說明⚠️:通常使用第一種方式以後,df,find
等命令能夠正常使用了!class
通常是掛載了nas盤 nas裏面文件太多,數據讀寫操做不正常致使的返回卡住,這裏使用命令:strace df -h
來判斷是否df的進程卡在nas盤上。bug
相應的解決方法參考以下:程序
(1)耐心等待數據統計完成後返回;
(2)卸載 NFS 分區的掛載後從新統計;