Hi Guys

I want to build an application which can be used to empty the content of bad (remapped) sectors. At the moment I really dont know where to start, so I am hoping someone can give me a push in the right direction.
It would also be nice if someone could post some links on how drives built/programmed (in depth).

Recommended Answers

All 5 Replies

Hello Salem,

Well, I am more familar with *nix systems when it comes to lowlevel programming. I will be using Ubuntu 9.10 with an Ext4 filesystem. I will be using C++ (for now) on gcc. HDD = seagate.

Thanks for the links, I will read up on them.


PS. I want to correct a mistake I made on my first post: I want to read the content of the bad/remapped sectors.

Does reading /dev/sda (for example) read every sector regardless of it's status (as far as the file system bad block map is concerned)?

Bear in mind that modern hard drives may do this stuff transparently for you - silently remapping bad sectors to good sectors.
http://en.wikipedia.org/wiki/S.M.A.R.T..
Whether this actually extends into you being able to read the drives' bad sector map (and even having a go at reading the bad sectors) would need more research.

Does reading /dev/sda (for example) read every sector regardless of it's status (as far as the file system bad block map is concerned)?

Bear in mind that modern hard drives may do this stuff transparently for you - silently remapping bad sectors to good sectors.
http://en.wikipedia.org/wiki/S.M.A.R.T..
Whether this actually extends into you being able to read the drives' bad sector map (and even having a go at reading the bad sectors) would need more research.

Doesnt the OS 'ignore' bad sectors ? Otherwise you would have all sorts of problems. I need a way to bypass that control mechanism.

That's what the bad cluster map stored by the file system is for.

Originally, disks were dumb, and all you got from the HD controller was 'fail'. At which point the OS updated the bad cluster and never used it again.

If your drive is smart, then all this happens transparently and as far as the file system is concerned, the disk is perfect.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.