Question: I have hard drive filled with zeroes.

How to check if all bits on hard drive are zeros using bash?

Answer: od will replace runs of the same thing with *, so you can easily use it to scan for nonzero bytes:

$ sudo od /dev/disk2 | head0000000 ?000000 ?000000 ?000000 ?000000 ?000000 ?000000 ?000000 ?000000*234250000

You can combine this with either dd or pv to get a progress display while the scan is taking place:

$ sudo dd if=/dev/disk2 bs=1M status=progress | od | head# or:$ sudo pv /dev/disk2 | od | head

💠

🔵 Best-selling data storage everyone's buying.

Fast, reliable, and on sale now. Thousands pick these weekly — don't miss Amazon's lowest storage prices.

Top 10 Bestsellers
🏆 4.7★+ Reviews
📦 Prime Shipping
👉 See today's best-selling hard drives, USB flash drives & SSDs on Amazon.com HDD · USB Flash Drives · SSD · External Drives
🛒
✅ Updated hourly — Amazon real-time ranking 🔥 Limited stock deals 🔗 Affiliate
⭐ Click to see complete best-selling list ⭐