Re: [SLUG] HD fscked?

From: Eben King (eben1@tampabay.rr.com)
Date: Fri Dec 09 2005 - 11:07:18 EST


On Fri, 9 Dec 2005, Levi Bard wrote:

> My secondary HD went out the other day. It started giving me I/O
> errors, so I tried to fsck it, and it wouldn't even run because of the
> errors. [c]fdisk won't even read the partition table.
> Next, I tried rebooting with the force-check flag, and basically the
> same thing happened - the errors were so bad that it killed makedev in
> the middle of creating the nodes in /dev, causing a host of other
> problems like not being able to ssh in or run X. I fixed these by
> yanking the drive entirely.
>
> The drive in question is a 120G Samsung. The data on it is not vital
> (read, there are no backups), but it would be nice to be able to
> recover it if possible. How should I begin to go about this?

What I did when a drive died was:

Copy each partition into a file with something like
dd if=/dev/hdxn bs=512 conv=noerror | gzip -9 > hdxn.img.gz

Uncompress _a copy_ of one partition at a time:
gzip -d < hdxn.img.gz > hdxn.img

(I didn't have room for the whole thing. If you do, skip the
compression/decompression.)

Attach it to a loopback device:
losetup /dev/loopm hdxn.img

fsck it:
fsck /dev/loopm

Repeat the fsck until it gets no errors.

(Or skip the fsck and work on it in some other way.)

Mount it:
mount /dev/loopm /mnt/wherever -o ro

You'll have to get a new drive anyhow, so you might as well use that for
scratch space.

-- 
-eben    ebQenW1@EtaRmpTabYayU.rIr.OcoPm    home.tampabay.rr.com/hactar
AQUARIUS:  There's travel in your future when your tongue freezes to the
back of a speeding bus.  Fill the void in your pathetic life by playing
Whack-a-Mole 17 hours a day.  -- Weird Al, _Your Horoscope for Today_

----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:25:44 EDT