From couple of days my HDD works slow. So i test my HDD using disk utility. It shows i have 1352 bad blocks.

SMART test says HDD health is good but shows a error "Reallocated Sector Count". So i run #badblocks. But it shows 0 badblocks

sudo badblocks -v /dev/sda


Then i run hdparams

sudo hdparm -tT /dev/sda
/dev/sda:
Timing cached reads:     2 MB in  2.70 seconds = 759.55 kB/sec
Timing buffered disk reads: 172 MB in  3.02 seconds =  56.99 MB/sec


Then i run benchmark test using disk utility.

Here it shows read/write speed is 69.6 MB/S but hdparm shows 759.55 KB/sec, SMART says HDD has bad sectors but badblocks say there are no bad sectors. I am so much confused. I had already submit my laptop for HDD change(valid warranty), but they refused to change it and they said there are no bad sectors(They used windows's tools). But HDD performance is poor.

System specification:

CPU: DualCore E-450 AMD APU
RAM: 2GB
HDD: Toshiba 320 GB
Laptop model: Acer aspire 4250


There should be any way that we can prevent SATA controller to reallocate bad blocks. Then we can find out the bad blocks and mark unused by fsck. After that enable reallocation again. So ubuntu will not call for bad sectors and reallocation will be zero and also it reduce the rate of new bad sectors.

-
The drive's inbuilt controlller is reallocating sectors so badblocks (and presumably whtever your supplier used) can't see any bad blocks as they have been revectored. The revectoring impacts performance as disk blocks may no longer be sequential. You need to push back on your supplier or resign yourself to buying a new drive. –  StarNamer Jul 29 '12 at 19:54
Is there any way that at least i can find out which drive(sda1,sda2..) contains bad sectors? –  shantanu Jul 30 '12 at 14:54
Years ago, I bought a program called spinrite from grc.com to test disks for bad blocks, but, for obvious reasons, they don't give demo versions away. I don't know of any similar low-level testing program. –  StarNamer Jul 30 '12 at 16:58

I agree with StarNamer's comment. The bad blocks are substituted by the firmware on the drive, so ideally the operating system doesn't know about the bad blocks (except through S.M.A.R.T.) The number of reallocated sectors does seem high to me for a disk as young as yours.

Disk throughput depends upon the size of the data reads and writes and its location on disk.

You may wish to Run the self-test in the main window above to see how it does.

It may be prudent to find tools that access S.M.A.R.T. under Windows and quote its findings should you resume the conversation with your vendor. That will show the remapped sectors. The S.M.A.R.T. data is information from the disk controller and therefore will be the same for Ubuntu and Windows.

-
Is there any way to mark bad sectors disable. There is a way using badblocks and fsck but i can not apply this. Because badblocks does not return any blocks. Thanks for your quick reply –  shantanu Jul 30 '12 at 14:49
No, I'm afraid not. As far as the operating system is concerned all of the sectors are good because the drive firmware found the problem, was able to make out the data on the bad sector, and relocate it. There are two effects, it can take a bit longer to read the bad sector because the head has to move, and the firmware remembers the error. I would consider the badblocks thing to be the older technology, from when drives weren't as sophisticated and it was more up to the operating system to keep track of the condition of the drive and also up to the OS to not use the bad sectors. –  John S Gruber Jul 31 '12 at 0:19
Then how disk Utility report exact number of badblocks in HDD? Surprising! isn't it? –  shantanu Jul 31 '12 at 4:52
There should be any way that we can prevent SATA controller to reallocate bad blocks. Then we can find out the bad blocks and mark unused by fsck. After that enable reallocation again. So ubuntu will not call for bad sectors and reallocation will be zero and also it reduce the rate of new bad sectors. –  shantanu Jul 31 '12 at 4:58