
問題:
bash
以下を使用して SSHFS マウント/アンマウント用のスクリプトを作成しました:
1| dir=$(mktemp -d)
2| sshfs user@server $dir
3| cd $dir
4| bash
5| fusermount -u $dir
6| rmdir $dir
これらの行が実行されると、5 行目でエラーが発生しfusermount -u $dir
、次のメッセージが表示されます。
fusermount: failed to unmount /home/tmp/tmp.xxxxxxxxxx: Device or resource busy
警告メッセージでは、/home
だけではなく がパスの先頭に追加されます/tmp/tmp.xxxxxxxxxx
。興味深いことに、rmdir
は次のメッセージを表示します。
rmdir: failed to remove '/tmp/tmp.xxxxxxxxxx': Device or resource busy
... は$dir
依然として の値を持つことを示しています/tmp/tmp.xxxxxxxxxx
。
質問:
リソースがビジー状態のときにパスの先頭にfusermount
追加されるのはなぜですか?/home
答え1
どうやら、これがこの問題を解決した正しいバージョンです:
1| dir=$(mktemp -d)
2| sshfs user@server $dir
3| cd $dir
4| bash
5| cd ..
6| fusermount -u $dir
7| rmdir $dir