Disk problems - hard error reading fsbn NNNNNNNN (Bullet dodged)
Matt Navarre
mnavarre at cox.net
Mon Dec 6 09:18:24 PST 2004
Matt Navarre wrote:
> After a power outage last night I rebooted my computer and fsck
> complained of the following :
>
> ad1s2e: hard error reading fsbn 5103776 (ad1s2 bn 5103776; cn 317 tn
> 177 sn 20) status=59 error=40
>
> Then goes on for a while giving the same error on blocks 5103776 -
> 5103807, except for block 5103777 which has error=01.
>
> Does this mean the disk is failing, or can I just reformat? And what's
> the best way to recover any recoverable data from that slice?
> Unfortunately I don't have a recent backup, since my tape drive joined
> the choir invisible a while ago and I haven't had a chance to replace it.
I seem to have recovered all the data from the failing disk, just for
posterity here's what worked for me.
First you need two things: A new hard disk and a FreeSBIE CD. Install
the new harddisk and boot from the FreeSBIE cd. Then you need to make a
filesystem on the new disk (see the Handbook for the Magic Spells,
there's no /stand/sysinstall on the FreeSBIE cd). Mount the new disk. If
your damaged drive has data on other slices that don't have errors mount
them and recover the data. I used cd /mnt/ufs.2; find ./ -xdev -print0
| cpio -pa0V /mnt/ufs.1/gooddata.
Now, on to the damaged sectors, how to recover the data? dd stops when
it hits bad blocks, so we can't use that to copy the slice. same with
dump(8) as far as I can tell. So. Download dd_rescue from
http://www.garlof.de/kurt/linux/ddrescue/
Version 1.10 compiled and worked out of the box. No need to install it,
just run it from the build folder:
./dd_rescue /dev/ad1s2e /mnt/ufs.1/ad1s2e.img
Wait. a long time. keep in mind that the slice you are writing to needs
to be big enough to hold an image of the *entire* slice you are copying.
once dd_rescue finishes we're left with a (hopefully) usable image of
the bad slice. Now we need to use it.
see the handbook entry on Network, Memory and File-Backed File systems:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/disks-virtual.html
Here's the basic quick and dirty:
mdonfig -a -t vnode -f /mnt/ufs.1/ad1s2e.img -u 6 #change 6 to an unused
/mnt/md#, freesbie mounts it's filesystems on md[0-5] on my cd.
fsck_ffs /dev/md6
mount /dev/md6 /mnt/ufs.3
Now you should be able to get the data off the image and on to a real
filesystem. You can check your data with ls -lR > ls.out on the image
and the directory where your now hopefully rescued data is and diffing
the output. I saw differences in dates on directories, so if that's a
concern there's probably a better way to move the data than find/cpio.
Now I need to come up with a real backup scheme. This one has proved....
suboptimal.
Matt
More information about the freebsd-questions
mailing list