zero-wipe usb and unsure what I get from | hexdump -C | grep [^00]

3 respostas [Última entrada]
justlooking
Desconectado
Joined: 03/11/2014

Hello,

I wanted to write zeros on usb and proof it.

I tried to write zeros on kingston usbdrive few times using:
sudo dd if=/dev/zero of=/dev/sdb bs=512

in 30489408
out 30489408

to proof everything is zero I found this on the net:
sudo dd if=/dev/sdb | hexdump -C | grep [^00]

It outputs a red number "3a2768" (I think this is for nonzero besides from the zeros)

Output "redcoloured":

00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "|................|
*
3a2768"000

Does anyone know if this should not be or be there?

Legimet
Desconectado
Joined: 12/10/2013

hexdump is not the right tool, because it outputs the offsets (and if you use -C the ASCII). Instead, use xxd. Replace the "hexdump -C" with "xxd -p".

Magic Banana

I am a member!

Desconectado
Joined: 07/24/2010

Why not using 'shred'? To get the 0s after writing random data (more secure), you need the -z option:
$ shred -z /dev/sdb

justlooking
Desconectado
Joined: 03/11/2014

tried with "xxd -p"

sudo dd if=/dev/sdb | xxd -p | grep [^00]

..and nothing red showed up as I want it

For getting some more trust I
tried to write a "1" onto /dev/sdb for checking again
(found on net dont know if doing right)

sudo dd if=/dev/zero bs=1 count=1 | tr "\0" "\1" > onefile
sudo dd if='/home/user/onefile' of=/dev/sdb
and now
sudo dd if=/dev/sdb | xxd -p | grep [^00]
gives a red "1"
010000000000000000000000000000000000000000000000000000000000

I used this shred on files but didnt know it works on whole drives its cool to have it. And with good status output.

And I got onto this "dc3dd" like a better "dd" with many details.