Bad sector's ???
Rashkae
ubuntu at tigershaunt.com
Wed Jul 21 14:32:36 UTC 2010
Larry Shields wrote:
> *I was just using the program Disk Utility, and went through each on of
> my hard drives, it shows
> that my 250gb drive has a few bad sector's on it...
>
> My question is there a way to correct this, without loosing any data...???
>
> Thanks for any help...
>
> Larry
> *
>
Maybe. It depends if there is any current data actually residing on
those bad sectors. Note that these operations can be dangerous, so my
first suggestion is to get in person help from an experienced technician
if data recovery is important..
First step is to copy all data from the failing drive to a new drive,
using file copy.. (I like rsync for this kind of operation myself.)
For example:
sudo rsync -a /path/to/mountpoint/ /path/to/new/drive 2>
~/transfer_error.log
When the command completes, any files that were not successfully
transfered due to i/o errors should be listed in the log file.
Otherwise, congratulations, the bad sectors did not affect any of your
current files.
Next step is to install smartmontools package and check your drive
diagnostics.
sudo smartctl -s on -a /dev/sd?
In particular, see if the number of re-allocated sectors is already high
(say, roughly over 12). If yes, then I would consider the drive
catastrophic and toss it. Otherwise, you can try to recover it by
zeroing the drive. You need to unmount any filesystem from it, (might
be easier to do this from a live cd)
ls /dev/disk/by-id/
dd if=/dev/zero of=/dev/disk/by-id/..... bs=1M
Notice that I'm using by-id rather that sd? This operation is 100%
destructive and you need to be careful that you don't get mixed up to
the wrong sd? device (which can change from boot to boot). Trust me
when I say, it's the kind of mistake you probably only do once. The
drive's controller should automatically test questionable sectors and
re-allocate any that are defunct. Check with smartctl again to see if
re-allocated sectors have increased and by how much.
Alternative: Rather than zeroing the drive, you can use badblocks to do
an in place write/read test. This operation takes a *long* time, but it
should do a thorough test of the entire drive, and when finished, will
leave all the data in place (except for any data that is damaged by bad
sectors)
sudo badblocks -nv /dev/disk/by-id/....
More information about the ubuntu-users
mailing list