Operating System - Linux
1825768 Members
3483 Online
109687 Solutions
New Discussion

Re: Check Hard Disk for damaged sectors

 
SOLVED
Go to solution
'chris'
Super Advisor

Check Hard Disk for damaged sectors

hi

Howto check Hard Disk for damaged sectors?
I've tried to format 80GB IDE Hard Disk using gparted, but it was to quick.
6 REPLIES 6
Steven E. Protter
Exalted Contributor
Solution

Re: Check Hard Disk for damaged sectors

Shalom,

dd

dd if=/dev/sda of=/dev/null bs=1024

If you have i/o errors, you have bad sectors.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
David Claypool
Honored Contributor

Re: Check Hard Disk for damaged sectors

IDE drives don't give you access to actual sectors. They manage and remap to spares anything that exhibits any anomaly.
Sheldon Smith
HPE Pro

Re: Check Hard Disk for damaged sectors

Get a copy of SpinRite.
http://grc.com

Note: While I am an HPE Employee, all of my comments (whether noted or not), are my own and are not any official representation of the company

Accept or Kudo

Michal Kapalka (mikap)
Honored Contributor

Re: Check Hard Disk for damaged sectors

hi,


To check if a harddisk is in good shape,
you can use its SMART capabilities:

smartctl -t long /dev/hda

To check for bad sectors, use

badblocks -sv /dev/hda


mikap
'chris'
Super Advisor

Re: Check Hard Disk for damaged sectors

Thx, but does this command:

badblocks -sv /dev/hda

just checking (reading) without damaging data from the Hard disk?
Huc_1
Honored Contributor

Re: Check Hard Disk for damaged sectors

Yes "Badblocks -sv /dev/hda " is readonly
The man page say's so (on ext2 and ext3)

Only the -n and -w (mutually exclusive) will write to disk ...

-w BEWARE WILL DESTROY ALL THE DATA ON YOUR DISK,

-n is "safer"

------- extract from man page badblocks -----

-n Use non-destructive read-write mode. By default only a non-
destructive read-only test is done. This option must not be
combined with the -w option, as they are mutually exclusive.

------- End of extract from man page --------

Just to test this i tried badblocks -sv on a spare disk (ext2 with some data on it), be patient this does take a long time.

# badblocks -sv /dev/sdb
Checking blocks 0 to 17716607
Checking for bad blocks (read-only test): done
Pass completed, 0 bad blocks found.

In my this case no badblocks and my filesystem did survive this test !

as a side point how reliable is this I don't really know and lot of other thinks beside bad blocks could be wrong with a hard disk the controller electronic could also be wrong!

Enjoy life.

Jean-Pierre Huc



Smile I will feel the difference