Subject: ffs problem - disk in a total mess after fsck
To: None <netbsd-help@NetBSD.ORG>
From: Thorsten Frueauf <frueauf@ira.uka.de>
List: current-users
Date: 09/20/1997 13:09:08
Hello!

Last night I had some strange problem that messed my disk totaly up :-(

Here is my story:

On my Laptop (Toshiba Tecra 500 CDT, running NetBSD/i386 current from 19.09.97)
there is an external modem (Creatix SG 2834) connected. I freshly booted,
started X (Xfree86 3.3.1) and wanted to logon to my ISP via ppp. The modem - it
has an external power supply - seemed not to react, so I waited until pppd
timed out, stoped my script, and powercycled the modem. Thats were my
Laptop froze up - no keyboard/mouse reaction anymore, even CTRL-ALT-DEL
did not work. So I had to powercycle the Laptop too. So far so good - this
happend some times before (although I found it strange that this can lock
up the machine - on my amiga this does not happen at all). I rebooted to
single user mode to do an fsck. And there the nightmare begun :-(

fsck detected many things it suggested to fix, so I decided to
do an fsck -y (maybe that was my fault no. 2). After that lots of files
and directories are now in lost+found (and thus disappeard from there
former location) :-(

At least essential parts were left intact - thats why I am able to write
this email.

Here is an overview of my disk:

wdc0 at isa0 port 0x1f0-0x1f7 irq 14
atapibus0 at wdc0
wd0 at wdc0 drive 0: <TOSHIBA MK2101MAN>
wd0: 2067MB, 4200 cyl, 16 head, 63 sec, 512 bytes/sec
wd0: using 16-sector 16-bit pio transfers, lba addressing

6 partitions:
#        size   offset    fstype   [fsize bsize   cpg]
  a:   104832  1645056    4.2BSD     1024  8192    11   # (Cyl.  204 - 216)
  b:   137088  1749888      swap                        # (Cyl.  217 - 233)
  c:  2580480  1645056    unused        0     0         # (Cyl.  204 - 523)
  d:  4225536        0    unused        0     0         # (Cyl.    0 - 523)
  e:  2338560  1886976    4.2BSD     1024  8192    11   # (Cyl.  234 - 523)
  f:  1644993       63     MSDOS                        # (Cyl.    0*- 203*)

The partition that is messed up is e - its my /usr. Fortunatly a (root) is
totaly ok. 

So now I have some questions:

1) Is it possible that recent changes to fsck_ffs (lite 2 integration) messed
   something up? I had those lock ups before, but fsck was always able
   to clean it up properly.

2) How does one handle those many files/directories in lost+found? If it
   were only a few, I would moved them by hand... but this are _many_.
   I started to identify the files (all names #<inode number>) and tryed
   to move them back to there proper position - but fsck reports those
   files to be a problem (something like EXTENTIOS link) and moves them
   back into lost+found again :-(( What is the proper way to clean this
   up?

3) I noticed that the directory inode, where a file is missing and moved
   into lost+found, has stil an entry, but the inode is set to 0.

   e.g. I had a directory /usr/export/frueauf/texte/Steuer/
   in /usr/lost+found I found #000439 which seemed to be that directory.
   If I look with fsdb at /usr/export/frueauf/texte I find stil
   "Steuer" in a slot, but with inode 0. ls -la in that directory
   does *not* show it. After I moved /usr/lost+found/#000439 to
   /usr/export/frueauf/texte/Steuer I see 2 entrys for "Steuer" in
   /usr/export/frueauf/texte with fsdb :-( I think this is the case
   with all files that made it into lost+found - how does one
   fix this?


So I would be happy for anyone that can help me fixing this. As always
in such situations the last backup is 1-2 months ago, so I can not
simply newfs and restore. I would prefer to somehow relocate those
files in lost+found to there former place. I really don't know how
this is properly done.

Thanx for any help in advance!

Greets
      Thorsten

PS: If I need to provide more infos - feel free to ask.