[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Need to remove a ghost file, but can't because it doesn't exist [SOLVED]



On 2006-11-16 @ 08:56:14 (week 46) hendrik@topoi.pooq.com wrote:

> Rumours I have heard about reiserfsck suggest to me that taking a backup 
> is *highly* recommended before doing reiserfsck.

Right you are! I did, excluding the directory containing the troublesome
file.

> Some copying/backup programs have options to ignore specific files or 
> directories.  That might be applicable here.

Indeed: tar did it just fine.

> By the way, can you mv the file to a less in-the-way place?  I once 
> managed that for a nonexistent file on an ext2 filesystem.  With various 
> command-line options on tar I could back up around it.  I didn't manage 
> to actually get rid of it, though, except by reformatting the partition.

Nope, I had tried that already.

> Woould this be an application for and inode editor?

Don't know. Could be.

Here's what finally solved the problem (for the archives):

1] Stop all processes accessing the filesystem containing the error (in
this case /dev/hda9 mounted on /home). The output of 'lsof' helps
finding out what processes need to be stopped.

2] Remount the filesystem containing the error read-only

# umount /dev/hda9
# mount -r -t reiserfs /dev/hda9 /home

3] As root first run 'reiserfsck --check /dev/hda9' to find out if more
drastic measures are really needed. Here's what I got from that:

###########
reiserfsck --check started at Thu Nov 16 15:45:27 2006
###########
Filesystem seems mounted read-only. Skipping journal replay.
Checking internal tree../ 17 (of 114)/ 17 (of 157)bad_directory_item:
block 6522899: The directory item [8 7130 0x1 DIR (3)] has a not
properly hashed entry (27)
bad_leaf: block 6522899, item 3: The corrupted item found (8 7130 0x1
DIR (3), len 3744, location 256 entry count 44, fsck need 0, format old)
finished
Comparing bitmaps..finished
Fatal corruptions were found, Semantic pass skipped
1 found corruptions can be fixed only when running with --rebuild-tree
###########
reiserfsck finished at Thu Nov 16 15:45:44 2006
###########

4] BACKUP all files you want to keep! REPEAT: make sure you have copies
of all files you would hate to lose in case something goes wrong with the
next step.

5] Verify your backup is OK before proceeding

6] Run 'reiserfsck --rebuild-tree /dev/hda9'

Here's the output you can expect:

reiserfsck 3.6.19 (2003 www.namesys.com)

*************************************************************
** Do not  run  the  program  with  --rebuild-tree  unless **
** something is broken and MAKE A BACKUP  before using it. **
** If you have bad sectors on a drive  it is usually a bad **
** idea to continue using it. Then you probably should get **
** a working hard drive, copy the file system from the bad **
** drive  to the good one -- dd_rescue is  a good tool for **
** that -- and only then run this program.                 **
** If you are using the latest reiserfsprogs and  it fails **
** please  email bug reports to reiserfs-list@namesys.com, **
** providing  as  much  information  as  possible --  your **
** hardware,  kernel,  patches,  settings,  all reiserfsck **
** messages  (including version),  the reiserfsck logfile, **
** check  the  syslog file  for  any  related information. **
** If you would like advice on using this program, support **
** is available  for $25 at  www.namesys.com/support.html. **
*************************************************************

Will rebuild the filesystem (/dev/hda9) tree
Will put log info to 'stdout'

Do you want to run this program?[N/Yes] (note need to type Yes if you do):Yes
Filesystem seems mounted read-only. Skipping journal replay.
###########
reiserfsck --rebuild-tree started at Thu Nov 16 15:47:22 2006
###########

Pass 0:
####### Pass 0 #######
Loading on-disk bitmap .. ok, 455363 blocks marked used
Skipping 8434 blocks (super block, journal, bitmaps) 446929 blocks will be read
0%....20%....40%....60%....80%...pass0: block 6522899, item 8 7130 0x1 DIR (3), len 3744, location 256 entry count 44, fsck need 0, format old: 1 entries were deleted
.100%                       left 0, 11761 /sec
1 directory entries were hashed with not set hash.
44211 directory entries were hashed with "r5" hash.
        "r5" hash is selected
Flushing..finished
        Read blocks (but not data blocks) 446929
                Leaves among those 17357
                Objectids found 44214

Pass 1 (will try to insert 17357 leaves):
####### Pass 1 #######
Looking for allocable blocks .. finished
0%....20%....40%....60%....80%....100%                        left 0, 3471 /sec
Flushing..finished
        17357 leaves read
                17233 inserted
                124 not inserted
####### Pass 2 #######

Pass 2:
0%....20%....40%....60%....80%....100%                           left 0, 0 /sec
Flushing..finished
        Leaves inserted item by item 124
Pass 3 (semantic):
####### Pass 3 #########
/hdv/Maildir/.Applications.[vim]/curvpf-10650: The directory [8 7130] has the wrong size in the StatData (182704) - corrected to (182616)
Flushing..finished
        Files found: 43613
        Directories found: 592
        Symlinks found: 8
Pass 3a (looking for lost dir/files):
####### Pass 3a (lost+found pass) #########
Looking for lost directories:
Looking for lost files:0 /sec
Flushing..finishede 0, 0 /sec
        Objects without names 1
        Files linked to /lost+found 1
Pass 4 - finished  done 7021, 200 /sec
Flushing..finished

The partition is mounted ro. It is better to umount and mount it again.

Syncing..finished
###########
reiserfsck finished at Thu Nov 16 15:48:45 2006
###########

7] Remount the filesystem with its default settings (as defined in /etc/fstab):

# umount /dev/hda9
# mount /dev/hda9

8] Restart any stopped processes

There is one final catch: if the host in question is located on the other side
of the world (as is the case here) and you allow access through SSH only for
non-root accounts (as you should), then you cannot login as a normal user and
do 'su -', since that would make sshd access /home and that would make mount
exit with an error because the filesystem is busy. So in this case I had to
temporarily enable root logins (not too much of a risk, because the firewall
will block access from untrusted systems anyway). If you do this DO NOT forget
to disable root logins afterwards.

HTH future victims of similar problems.

Grx HdV



Reply to: