You are not logged in.

#1 2012-10-08 20:46:48

norbert108
Member
Registered: 2012-10-08
Posts: 2

Bad sectors on hard drive?

Hi, I have an issue with my filesystem that might be caused by damaged HDD. Sometimes during normal work, when I, for example, try to install new package using pacman I get an error: could not lock database: root file system read-only. When I reboot Arch, filesystem is beeing repaired (recovering from journal for most of the time but some time I need to manually run fsck because it won't start). I tried to boot arch from live CD and run fsck -fpv (there was one more option but i can't remeber) it was supposed to fix bad sectors and according to messages I got, it did. But that didn't solve my problem. Is there any way I can fix it for good?

Offline

#2 2012-10-08 20:55:49

Pres
Member
Registered: 2011-09-12
Posts: 423

Re: Bad sectors on hard drive?

First, I would make sure you have a full backup.

You can check for bad sectors using badblocks. `man badblocks` for more information. Make sure you are doing a non-destructive test if there is data on the drive.

badblocks -v /dev/sda

If I remember correctly, there is a way to pipe the output from badblocks to mkfs to ignore those sectors during filesystem creation, but if there are many bad sectors your best bet is to get a new drive. It's probably a sign of one on the way out.

Offline

#3 2012-10-09 17:55:29

HoZ
Member
Registered: 2008-03-30
Posts: 38

Re: Bad sectors on hard drive?

I always prefer to run hard drive diagnostics offline (i.e. from a live CD).  I keep a copy of Parted Magic around for just such occasions.  It's full of great tools, and includes gsmartcontrol.  Use this to check your SMART data (check for re-allocated sectors, etc) and then run the "short" drive test.  If your drive passes the short test, run the long test next (can take a few hours).  If the drive fails either (usually with a "read error"), I would replace it soon, before it fails completely.  There is no real need to run the long test if the drive fails the short test first. 

You can also usually download diag tools from your drive manufacturer's website.  For instance, Seagate has Seatools (I uasually boot Seatools for DOS from a CD or PXE).  Western Digital and Hitachi have similar products. 

If the drive is dying, ddrescue (also on the Parted Magic live CD) is a great tool to clone a failing drive to a new one.

Offline

Board footer

Powered by FluxBB