On 23 Jun 2005 11:14:47 -0700, knighttof3 RemoveThis @yahoo.com staggered into the
Black Sun and said:
> I cannot delete files created by 'mknod'. I used a subdir in my home
> directory (NFS mounted) as a staging area for Linux filesystem
> contents that were used as inputs to mkfs.* utilities.
NFS and device nodes are... interesting. You can create one, sure, but
trying to open() or read() or write() to it may not have the effect you
desire. The general rule is probably something like "don't bother to
have device nodes on NFS" except for weird cases like root-on-NFS.
> MYHOST ~/staging-area % ls -l dev
> crw------- 1 root root 5, 1 Jun 2 21:18 console
> crw-rw---- 1 root root 5, 64 Jun 2 21:18 cua0
[snip]
> MYHOST ~/staging-area % sudo rm -ri dev
> rm: remove character special file `dev/mem'? y
> rm: cannot remove `dev/mem': No such file or directory
....ah. How annoying. ssh in to the machine where the files live and
kill them there; that has a much higher probability of success.
> MYHOST ~/staging-area % sudo debugfs .
> debugfs 1.32 (09-Nov-2002)
> .: Attempt to read block from filesystem resulted in short read while
> opening filesystem
> debugfs: open dev
> dev: Attempt to read block from filesystem resulted in short read while
> opening filesystem
....? debugfs doesn't do NFS. If "dev" is loopback mounted (mount -o
loop /path/to/some/file /mnt/somewhere), no need to fiddle around with
all this, just umount the filesystem and rm /path/to/some/file if you're
done with it. Also, if dev is loopback mounted, debugfs will work
better if you umount the filesystem and run debugfs on the file.
> So, how do you remove files created by 'mknod'?
With rm. Works fine IME. I think NFS and possibly a loopback mount are
throwing monkey wrenches into the whole thing here, though. HTH anyway,
--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin / mail: TRAP + SPAN don't belong
http://www.brainbench.com / Hire me!
-----------------------------/
http://crow202.dyndns.org/~mhgraham/resume