You forgot to actually give the options to -o
. Because of that, mount
interprets "test.img
" as the options, and not as the disk/image to mount.
sudo mount -o loop test.img /mnt/disk
As mentioned in the comments, ls
in an NFS mount will result in two separate NFS calls, with a slight delay between them. If you suspect some process might be adding and removing entries in the directory I would definitely pursue that as an explanation. Here is how I would test that theory.
If the problem occurs some significant number of times you run ls
(i.e., it would be easy to reproduce by manually running ls
multiple times) you could simply:
{ ls;ls;ls; } 2>&1 | tee ls.out | grep 'No such file'
Re-run that command until you get the error, then inspect the ls.out
file, find which files it was complaining about, then see if those files 1) exist in the first 1/3 of the output and 2) don't exist in the last 1/3 of the output. Since the files were (presumably) deleted while one of the ls
commands was being run it shouldn't be too hard to figure out if they were there before and removed after.
If reproduction is significantly time-consuming you could write a script along the lines of (untested!):
#!/bin/bash
while /bin/true; do
/bin/ls -lc >ls1.out 2>&1
/bin/ls -lc >ls2.out 2>&1
/bin/ls -lc >ls3.out 2>&1
grep 'No such file' ls2.out >missing.out 2>&1
if (( $? != 0 )); then
echo "Found the error!"
break
fi
done
(Add sleep
s if you're worried about the performance impact of running this in an unbridled tight loop.)
Run this in a screen
session and check on it later. When the script exits reporting that it found the error, check missing.out
to see which files ls
couldn't find, then verify whether those files are listed in ls1.out
but not ls3.out
.
Don't forget to verify the ctime reported by ls
, in case this mystery process happens to delete the file, then recreate a new file with the same name just in time for the third ls
to list it. :)
If it turns out that for some reason the cause isn't that the process had deleted the file while ls
was running, report back here and we'll figure out what else to try.
Best Answer
Update: Your instructions have a typo; it's telling you to make a directory, so you should run mkdir instead of mdir.
"mdir" is an old tool for accessing DOS-formatted floppy disks without mounting the floppy. You probably don't want that. (It's part of the mtools package, which you are probably safe in uninstalling.)
Are you trying to
make a directory? Use mkdir
remove a directory? Use rmdir
move a directory? Use mv