How do I delete a corrupt file?

How do I delete a corrupt file?

Post by matthew konto » Fri, 07 Jul 1995 04:00:00



I have a directory entry that I have been unable to delete (as root).
it looks like this after ls -l
?-rwxrwxrwx  255   255   255     filename

I've tried to rename it with mv. I've tried to chmod to 0777 then rm
I've tried rm -fd to get it deleted. It is clearly garbage that should
be removed.  Any Ideas?

Matt Kontoff

 
 
 

How do I delete a corrupt file?

Post by Zenon Fortu » Fri, 07 Jul 1995 04:00:00




>I have a directory entry that I have been unable to delete (as root).
>it looks like this after ls -l
>?-rwxrwxrwx  255   255   255     filename

>I've tried to rename it with mv. I've tried to chmod to 0777 then rm
>I've tried rm -fd to get it deleted. It is clearly garbage that should
>be removed.  Any Ideas?

>Matt Kontoff


1.
First of all run fsck on the partition where the "filename" is located.
(for this purpose either boot from the root/boot installation floppies or mount
the partition read-only).
If you are lucky, the "filename" will be either corrected or removed.

or, 2.
When 1. does not help (and probably will not due to the Murphy law),
try to unlink the file first.
Under other *NIX systems there exists a system utility "unlink" suitable
for this purpose. Under Linux exists only a system call unlink(2) -- which
manual page refers to unlink(8) -- so you can prepare a dedicated program:

        main()
        {
            unlink( "filename" ) ;
        }

Compile/link and use it. If the "filename" disappears from the directory
listing, use the fsck again.

or, 3.
When 2. does not help, and the "filename" is on the ext2fs type of the
filesystem, use the debugfs(8).

The debugfs has options like "kill_file" or "clri" which should do the jobs.

Then run the fsck to ensure that your filesystem is clean (!).

        Zenon

 
 
 

1. How do I delete a corrupt file?

This is on a RS/6000 7011-250 running AIX 3.2.5.
I was installing a new program (emacs) into /usr/local when
the system crashed - it locked up all consoles and required
a power off/on cycle to get going. A "fsck /dev/hd2" showed
the /usr filesystem to be in bad shape. I did a maintenance
boot off of tape and from the maintenance shell did a
"getrootfs hdisk0 sh" and a "fsck /dev/hd2". I accepted all
the defaults as fsck did it's thing. I then did a normal boot
and "rm -r /usr/local" to insure it was clean. I checked
/usr/lost+found and there were many files in it. I deleted
all but one of the files. Whenever I try to delete this one
file with either a "rm 44577" or a "rm -r /usr/lost+found",
the system hangs with all consoles locked up, requiring
a power off/on. When the "rm 44577" is entered, the
three digit LED front panel display shows a Oc9 followed
by a flashing 888. Pushing the reset button cycles through
102 -> 700 -> 0c4 -> 888. A "ls -l" in /usr/lost+found shows
the crazy file to be
br-xrwS-wx  1  root  43144  0,  0  Apr  1  2029  44577

I would appreciate any help in getting out of this jam. I
am afraid that any program touching this file, like
mksysb, will crash the system...

--

Poughkeepsie, NY

2. Can't rm, ls, tar .. how do I dump?

3. Help deleting Unix corrupted file

4. kppp hangs before dialing

5. file system corrupted after doing a find

6. How to do the OLDS 4.0 upgrade?

7. Did I corrupt my DOS file system under Linux?

8. Looking for 3c589 PCMCIA driver

9. DOS File System Corrupted by LINUX???

10. Uninstall Linux: Deleted "non dos partition" with DOS fdisk -- Now what?!?

11. DOS can't delete files cp'ed to /dosc !?!

12. 'delete' command in ftp delete files in local hard disk ???

13. Help- How to delete a corrupted process?