Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello friends
it is too long time I don't code :-(

I'm landed today on this cool community.

I need realize (or thank you if you want to provide one) an utility that would count how many blank sectors (blank is meant that for the given sector, each of the 512 bytes is x00) are present in an hard drive (which is obviously already used and written)

I'm wondering which is the best environment to choose (linux or windows)
I'm also wondering if it could be a bahs script in linux
I've seen some lines in Python, but I'd brand new to Python :-(

Obviously it should run at an acceptable speed, since it would parse all the sectors of an hard drive.. eg 500GB = 976 millions sectors

In linux it would be easy to identify and work directly with the given hard drive and so this would avoid an hard drive selection section. Just run the utility with an sdX /dev/sdX) parameter.

Anyway, no clue on the path to follow and honestly, no time to dedicate to study this from the scratch.

Hopefully I've been able to provide the rough idea of what am I wondering about :-)

Can you kindly hint, help or solve this?

Thank you in advance for any hint and even more thanks for any solution

Robert
Posted
Updated 4-Nov-14 23:57pm
v5
Comments
Kornfeld Eliyahu Peter 5-Nov-14 6:14am    
As I understood, you want to check each end every physical sector on a hard-drive and see how many of them is 'clean'?
Such loop over the disk is done when one run a low-level format - for a 500GB disk it can take several hours!
If you insist on such application, you have to look for some low level language, like C or ASM...
Robert-68 6-Nov-14 2:37am    
Thank you Kornfeld for your reply. Yes, I know. I use dd to blank hard drives writing with source the CPU channel /dev/zero onto the /dev/sdX drive. This runs at the writing speed of the disk, which mean with SATA3 at an average of 80MB/sec 90MB/sec, which means 2 up to 3 hours for a 500GB hdd 3.5" 7200rpm.
Though things will be slightly longer since e.g. an XOR of all the 512 bytes of the sector should be calculated and shall return x00 (this trick could be good and or fast enough to check if that one is a blank sector and the counter should be updated... So some cycles are required).
Though I can't code this :-)
Kornfeld Eliyahu Peter 6-Nov-14 6:20am    
I do not believe someone will write that code for you here. CP is not a site where people order code, rather write it by themselves and ask for help to fix it...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900