hard drive sector testing on Ubuntu

Nils Kassube kassube at gmx.net
Sat Sep 29 06:09:20 UTC 2012


lazer100 wrote:
> further to an earlier topic,
> 
> I would like to do a sector test of a hard drive on Ubuntu,
> this is a read and write test of sectors.
> is there any software to do this on Ubuntu 8.10?

How about "badblocks"?

> this is where the software would say read each sector,
> make some arbitrary change to the data, ideally change
> every byte,
> write that,
> then reread the sector and see if the data is correct,
> and then perhaps restore the original data.

AFAIK badblocks wouldn't restore the data.

> Further on this topic, is there any way to read and write to a
> specific sector number on say /dev/sdc or /dev/sdc1
> 
> I can read and write sequentially with dd eg
> 
> dd if=/path/file of=/dev/sdc1
> 
> would write the file sequentially,

You can use the skip and seek options of the dd command.

> does Linux have a trick for accessing a particular sector number,
> and will the sector numbers of each volume begin at say 0, eg

If you use bs=512 you would be operating with sector numbers.

> I guess I could subdivide the drive into 8 unformatted logical drives
> of 128G,
> and then write a 128G file to each, then filecompare that file with
> each,
> 
> but is there a less severe way of testing sectors, where every sector
> is tested?

Don't subdivide the disk into several partitions. You wouldn't really 
access every sector because there might be space left between the 
partitions and you also wouldn't access the boot sector. Instead use the 
device node of the entire disk for your tests, i.e. /dev/sdc and not 
/dev/sdc1.


Nils




More information about the ubuntu-users mailing list