1
0
Problem:
I created a bash
script for SSHFS mount/unmount using:
1| dir=$(mktemp -d)
2| sshfs user@server $dir
3| cd $dir
4| bash
5| fusermount -u $dir
6| rmdir $dir
Once these lines are executed, an error occurs on line 5 for fusermount -u $dir
and gives this message:
fusermount: failed to unmount /home/tmp/tmp.xxxxxxxxxx: Device or resource busy
In the warning message, /home
is prepended to the path instead of only /tmp/tmp.xxxxxxxxxx
. Interestingly, rmdir
then gives this message:
rmdir: failed to remove '/tmp/tmp.xxxxxxxxxx': Device or resource busy
... showing that $dir
still has the value of /tmp/tmp.xxxxxxxxxx
.
Question:
Why does fusermount
prepend /home
to the path when the resource is busy?
1Why are you starting
bash
on the Line 4? – None – 2019-10-20T15:15:07.7771So I can run commands in the directory. Once I exit this bash, then the unmounting and
rmdir
occurs. – Majal – 2019-10-20T15:23:04.937Maybe the "Device or resource busy" Error Message is appearing just because of the "
cd $dir
" Command. The Directory referenced through the$dir
Variable is still in use. Try adding a "cd ..
" Command just before the "fusermount -u $dir
" Command and try again. – None – 2019-10-20T15:34:43.0771Hi @DOBRESCU_Mihai! It worked! Thanks for the tip! :-) – Majal – 2019-10-20T22:55:35.483
For Great Success, @Majal. I shall add now an Exquisite Answer to this Question so that the whole Planet will be able to rejoice in ecstasy forever. – None – 2019-10-21T11:00:34.743
Interesting. I totally missed the fact that the shell is in the working directory. My attention was on the fact that the message had a prepended
/home
. I'll check withfusermount
if this is a bug or something. – Majal – 2019-10-22T00:27:57.597There is no
fusermount
Bug. It displays that Error Message because it attempts to work inside the$dir
Directory. The same thing happens to thermdir $dir
Command. If they are run outside of it, then they are working. Either with mycd ..
addition or with @Tom Yan's(cd $dir;bash)
Trick, you are avoiding running them inside of it. – None – 2019-10-22T09:57:16.490