EXT2-fs panic: ext2_find_entry

Dragisa N. Duric (dragisha@hobbiton.co.yu)
Mon, 31 Jul 95 08:20 MET DST

After system crash (1.2.12, somewhere in swapper task) and manual fsck
where i had to fix errors in root inode (2), i am getting this message

Kernel panic: EXT2-fs panic (device 3/66): ext2_find_entry: buffer head pointer is NULL

when kernel tries to start init process. When i boot from another
partition and mount 3/66 (/dev/hdb2, my main root partition), i will get
same message every time i try to create file in root directory of 3/66.

fsck will NOT fix this problem. In hope defrag will reorganize directories
and clean trash, i tried to defrag. Nothing new, panic again. Luckily, i
solved my problem with debugfs, and i am posting recipe here in hope it will
help in similar situtaion, and this posting will prompt someone to look at
fsck source. :)

Recipe :)

This problem has two flawors, one when directory with problem is /, and
one when it is not /. Second case is easy:

mkdir new-dir
mv old-dir/* new-dir
mv old-dir/.* new-dir
rmdir old-dir
mv new-dir old-dir

In first case, mount /dev/hdb2 on /mnt, move all entries except mnt and
lost+found from /mnt to /mnt/mnt, umount /dev/hdb2 and with

debugfs -w /dev/hdb2
clri /

clear root inode. Now, start fsck -f on this partition, and answer
questions. After first fsck, start another one, and when second fsck ends,
reboot from main parititon.

EOR :)