What is the most efficient way to traverse a hard disk and determine whether a given block is currently in use?

view story

http://stackoverflow.com – I'm working on a personal project to regularly (monthly-ish) traverse my hard disk and shred (overwrite with zeros) any blocks on the disk not currently allocated to any inode(s). C seemed like the most logical language to do this in given the low-level nature of the project, but I am not sure how best to find the unused blocks in the filesystem. I've found some questions around S.O. and other places that are similar to this, but did not see any consensus on the best way to efficiently and effectively find these unused blocks. df has come up in any questions even remotely similar to this, bu (HowTos)