From owner-freebsd-questions@FreeBSD.ORG Mon Dec 6 17:18:24 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C471616A4CE for ; Mon, 6 Dec 2004 17:18:24 +0000 (GMT) Received: from fed1rmmtao10.cox.net (fed1rmmtao10.cox.net [68.230.241.29]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6E7C943D62 for ; Mon, 6 Dec 2004 17:18:24 +0000 (GMT) (envelope-from mnavarre@cox.net) Received: from cox.net ([68.6.195.68]) by fed1rmmtao10.cox.net (InterMail vM.6.01.04.00 201-2131-117-20041022) with ESMTP id <20041206171823.FFCS18977.fed1rmmtao10.cox.net@cox.net> for ; Mon, 6 Dec 2004 12:18:23 -0500 Message-ID: <41B4945D.6000309@cox.net> Date: Mon, 06 Dec 2004 09:18:21 -0800 From: Matt Navarre User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <41B379EE.9090503@cox.net> In-Reply-To: <41B379EE.9090503@cox.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: Disk problems - hard error reading fsbn NNNNNNNN (Bullet dodged) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Dec 2004 17:18:24 -0000 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