Monday, April 29, 2024
Homepage · dd
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 1423  / 2 Years ago, sun, february 27, 2022, 2:41:45

I formatted a 160GB drive using:


dd if=/dev/zeros of=/dev/sda bs=512

I expect the entire drive is filled with zeros, but how do I check it?


I thought I could just cat /dev/sda and see all zeros, however, after I did that, the terminal appeared to freeze.


More From » dd

 Answers
6

Notice on usage


It is /dev/zero and not /dev/zeros so your command should be:


dd if=/dev/zero of=/dev/sda bs=512

And not:


dd if=/dev/zeros of=/dev/sda bs=512

How to verify?


There are many ways to verify the drive contains only zeros but opening the drive as a file and viewing it is not the most efficient method at all.


A simple method wold be to use cmp which will compare two files byte by byte and report the first difference. Basically, you would compare /dev/zero as a file ( all zeros ) to your drive as another file like so:


cmp /dev/zero /dev/sda

If you get something like this:


cmp: EOF on....

Then files are identical up to the end of the shorter file ( your drive in this case ) and all there are are zeros.


A difference would be reported by cmp with something like this:


... differ: byte 1, line 1

[#1607] Sunday, February 27, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
zombieptu

Total Points: 490
Total Questions: 121
Total Answers: 108

Location: Nepal
Member since Mon, Jan 4, 2021
3 Years ago
;