Filling a device with random data
David Joaquín Shourabi Porcel <[email protected]>
| Newsgroups | dev.linux.lists.cryptsetup |
|---|---|
| Message-ID | <[email protected]> |
Hey there :) Section 2.19 of the [FAQ][1] explains how to fill devices with random data using dm-crypt: cryptsetup opens a plain mapping, zeros are written to it and it is closed. If LUKS is set up on the device afterwards, this translates to the following commands: ``` cryptsetup open --type=plain --key-file=/dev/urandom -- /dev/foo temporary dd if=/dev/zero of=/dev/mapper/temporary cryptsetup close -- temporary cryptsetup luksFormat -- /dev/foo cryptsetup open -- /dev/foo bar # mkfs / pvcreate -- /dev/mapper/bar ``` I would like to skip the first mapping and shorten the procedure as follows: ``` cryptsetup luksFormat -- /dev/foo cryptsetup open -- /dev/foo bar dd if=/dev/zero of=/dev/mapper/bar # mkfs / pvcreate -- /dev/mapper/bar ``` Does filling a device with random data under a separate dm-crypt mapping offer any security benefit? Kind regards, David J. Shourabi Porcel [1]: https://gitlab.com/cryptsetup/cryptsetup/-/wikis/FrequentlyAskedQuestions