The ArchLinux Wiki on dm-crypt advices overwriting new storage devices or partitions with random data before using them for encrypted volumes. There are two ways I have used to achieve this, but I find that one method (using dd) has been much faster than the other (using LUKS format-erase by way of Gnome Disks).
Are there any known conditions where dd if=/dev/urandom
is less secure on a fairly modern (for 2013-2023) and typical x86 UEFI PC?
Thanks in advance for your advice.
Repeating my Procedure
The dd
command I used was:
sudo if=/dev/urandom of=$NEW_BLKFILE status=progress bs=1M
Where $NEW_BLKFILE
is the block device file, like /dev/sdb
or /dev/sdb1
.
Using the status=progress
option on GNU/Linux causes progress information to be output to the terminal, including an estimated write rate.
The method of initiating LUKS format jobs was:
- Enter Gnome Disks
- Select the "device" from the list on the left
- "Format" the disk (creating the partition table) if required (Drive Options > Format Disk), acknowledge the warning
- Press the Create Partition button (the plus sign) in the volume layout diagram, set the partition size
- Enable the Erase option; choose Ext4 and enable "Password Protect Volume (LUKS)" in the Type options
- Enter the password
- Run
udisksctl info --object-path $JOB_OBJ
, where$JOB_OBJ
is the format-erase operation job object path, likejobs/42
The Rate
attribute from the job object shows the estimated write rate
of the process in bytes per second.
Here's my observations on write speeds on a low-end desktop SSD (1TB, 4-bit "QLC") and a low-end server HDD (4TB, "5400RPM class", CLV?):
SSD: >100MB/s for dd
, <=33MB/s for format-erase
HDD: >150MB/s for dd
, <=14MB/s for format-erase
The format-erase operation was a lot noisier on the HDD, indicating a large number of seeks.
EDIT: Added HDD stats, disclose dd
block size.