LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   how to find the sector size of a hard drive? (https://www.linuxquestions.org/questions/linux-hardware-18/how-to-find-the-sector-size-of-a-hard-drive-925360/)

rabbit2345 01-23-2012 08:53 PM

how to find the sector size of a hard drive?
 
Hi,

So I want to fill a disk up with files that occupy exactly 1 sector on the physical drive in order to find bad sectors. How would I go about finding the size of a single sector, to the byte?

After dd'ing the whole disk with bs=16M, it reported copying about 250GB of data. But dd also reported the number of bytes copied, which doesn't equal 250GB by any definition (1024 or 1000=1K)

In the end I would like to run an md5sum on all the files to find the corrupt sector. Then leave the files hidden so the OS won't use them again. Is this a possible solution, or am I missing something?

thanks,
rabbit2345

eeekster 01-23-2012 09:03 PM

blktool /dev/sda sector-sz

rabbit2345 01-23-2012 09:08 PM

Well I feel pretty dumb...
For anyone wondering this, you can use fdisk and it gives you the sector size. I can also verify that blktool works just as well.

But about my HD patching idea, is it a viable solution or are there problems with it?

eeekster 01-23-2012 09:19 PM

Quote:

Originally Posted by rabbit2345 (Post 4582675)
In the end I would like to run an md5sum on all the files to find the corrupt sector. Then leave the files hidden so the OS won't use them again. Is this a possible solution, or am I missing something?

Modern drives do that for you. In fact you can scan the entire drive with something like this:

smartctl -t long /dev/sda

Then write to drive and the bad sectors will be relocated from the spares.


All times are GMT -5. The time now is 10:23 AM.