![오래된 nfs 핸들을 해결하는 방법은 무엇입니까?](https://linux55.com/image/22362/%EC%98%A4%EB%9E%98%EB%90%9C%20nfs%20%ED%95%B8%EB%93%A4%EC%9D%84%20%ED%95%B4%EA%B2%B0%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95%EC%9D%80%20%EB%AC%B4%EC%97%87%EC%9E%85%EB%8B%88%EA%B9%8C%3F.png)
홈 서버를 종료하고 데스크탑이 NFS를 통해 연결되었을 때 홈 디렉토리에 들어갈 때 "Stale NFS Handle Warnings"가 계속 표시되어 찾고 있는 일부 프로그램에 문제가 있습니다. .
컴퓨터를 다시 시작하지 않고 이 문제를 해결하는 방법은 무엇입니까?
데비안 스퀴즈/Wheezy
답변1
Debian Squeeze/Wheezy에서:
로컬 마운트 강제 제거
umount -f /mnt/dir
그런 다음 nfs를 다시 시작하십시오.
/etc/init.d/nfs-common restart
답변2
이 쉘 스크립트를 사용해보십시오. 나에게 잘 맞는다:
#!/bin/bash
# Purpose:
# Detect Stale File handle and remove it
# Script created: July 29, 2015 by Birgit Ducarroz
# Last modification: --
#
# Detect Stale file handle and write output into a variable and then into a file
mounts=`df 2>&1 | grep 'Stale file handle' |awk '{print ""$2"" }' > NFS_stales.txt`
# Remove : ‘ and ’ characters from the output
sed -r -i 's/://' NFS_stales.txt && sed -r -i 's/‘//' NFS_stales.txt && sed -r -i 's/’//' NFS_stales.txt
# Not used: replace space by a new line
# stales=`cat NFS_stales.txt && sed -r -i ':a;N;$!ba;s/ /\n /g' NFS_stales.txt`
# read NFS_stales.txt output file line by line then unmount stale by stale.
# IFS='' (or IFS=) prevents leading/trailing whitespace from being trimmed.
# -r prevents backslash escapes from being interpreted.
# || [[ -n $line ]] prevents the last line from being ignored if it doesn't end with a \n (since read returns a non-zero exit code when it encounters EOF).
while IFS='' read -r line || [[ -n "$line" ]]; do
echo "Unmounting due to NFS Stale file handle: $line"
umount -fl $line
done < "NFS_stales.txt"
#EOF
답변3
나는 일반적으로 다음 명령을 실행합니다(예 root
: ).
service nis restart
service autofs restart
service nfs restart
service portmap restart
시스템 작동 방식에 따라 이러한 기능이 모두 필요하지 않을 수도 있습니다.