Re: Filling a device with random data
David Joaquín Shourabi Porcel <[email protected]>
| Newsgroups | dev.linux.lists.cryptsetup |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your answer, Arno :). I benchmarked both methods and share my results in case they are of use to someone.
On my system, dm-crypt in its default configuration (AES in XTS mode with two 256 bit keys) is about ten times as fast as /dev/urandom:
```
$ dd if=/dev/urandom of=/dev/null status=progress
4819285504 bytes (4,8 GB, 4,5 GiB) copied, 12 s, 402 MB/s^C
9708379+0 records in
9708378+0 records out
4970689536 bytes (5,0 GB, 4,6 GiB) copied, 12,379 s, 402 MB/s
$ cryptsetup benchmark --cipher=aes-xts-plain64 --key-size=512
# Tests are approximate using memory only (no storage IO).
# Algorithm | Key | Encryption | Decryption
aes-xts 512b 4749,3 MiB/s 4622,4 MiB/s
```
/dev/urandom also provides data at a lower rate when multiple processes read from it simultaneously; dm-crypt did not seem to slow down. This might be worth considering if several drives or partitions are to be filled with random data in parallel. On the other hand, /dev/urandom is much faster than any of the devices I will be preparing for encryption.
Kind regards,
David J. Shourabi Porcel