Stephen Beynon <stephen@askone.demon.co.uk> writes:
> I have a ext2 partion that corrupted due to a hardware fault (since
> rectified :) - but I am left with a file that has been corrupted so that
> it looks like a symbolic link.
>
> rm returns
> rm: /bin/red: Operation not permitted
>
> when I try to rm the file as root - should this be possible ?
Yes. This is a problem that often hits people who get disk corruption
--- the difficulty is that ext2fs provides a mechanism to prevent
*any* modifications to the file, even by root. If that property is
set on the file accidentally by disk corruption, then e2fsck won't
reset the permission because it's a perfectly valid state for the file
to be in.
Do a "man chattr" and "man lsattr" to find out about ext2fs file
attributes. From the chattr(1) man page:
A file with the `i' attribute cannot be modified: it can-
not be deleted or renamed, no link can be created to this
file and no data can be written to the file. Only the
superuser can set or clear this attribute.
Try doing a "chattr -i /bin/red" and see if you can delete the file
now.
Cheers,
Stephen.