I am preparing a device with shred to use it later on encrypted with dm-crypt/cryptsetup/luks.
How can I check the device before and after using shred or e.g openssl/dd with /dev/urandom to be sure what was done? Is there a possibility?
I am preparing a device with shred to use it later on encrypted with dm-crypt/cryptsetup/luks.
How can I check the device before and after using shred or e.g openssl/dd with /dev/urandom to be sure what was done? Is there a possibility?
On a POSIX system, a disk device is a file so it can be read from by any tool which supports reading from files—be it cat
, dd
or even LibreOffice Writer (OK, just kidding).
So basically you have two issues to sort out:
Since your disk drive will contain generally non-human-readable data, the simplest way to view it by eye is to use something like od
(should be available right away) or xxd
(a bit more convenient but might not be available on a minimal system). So, somehting like
# od </dev/sda3 | less
should be OK to see what's there on the disk drive.
The second issue is trickier as it's more philosophic than technical (what @sebix tried to point out). The problem is that it's unclear what do you really mean. If you want to somehow measure randomness of the data after your openssl
and /dev/urandom
encantation, you have to 1) come up with a way to define a method to measure that randomness; 2) execute it.
I doubt you have really meant something like that though and will make a wild guess: you probably just wanted to see if the data on the disk drive does merely look random.
If yes, then the simplest way would be to first dd if=/dev/zero of=/dev/sda3 ...
to fill the drive with zero bytes, then re-write it using your "random encantation" and then use od
or a similar tool to verify there's really random data on the drive.
If, instead, you did really mean to measure the randomness of your data, then it's just an improper place to ask: try asking on the math.stackexchange.com
and tag your question as being related to statistics. In other words, a way to read the data is a technical question, a way to perform a statistical analysis on it is not.