Zeroize Multiple SSD's Simultaneously

The Aerospike Knowledge Base has moved to https://support.aerospike.com. Content on https://discuss.aerospike.com is being migrated to either https://support.aerospike.com or https://docs.aerospike.com. Maintenance on articles stored in this repository ceased on December 31st 2022 and this article may be stale. If you have any questions, please do not hesitate to raise a case via https://support.aerospike.com.

Synopsis:

Need to find a way to dd multiple disk on a server Solution: There may need to Zero multiple drive in the same

Solution:

If your disks support blkdiscard (most SSDs), you should use that instead. blkdiscard instructs the SSD disk to discard blocks and treat them as unused/zeroed. This results in an operation that takes a few seconds only and removes the need to DD the disks.

blkdiscard /dev/sdb
blkdiscard /dev/sdc
...

Or in a loop:

for i in sdb sdc sdd sde ; do blkdiscard /dev/"${i}" ; done

Command line example to zeroize sdb, sdc, sdd, and sde at the same time using dd:

dd if=/dev/zero bs=128k | tee /dev/sdb | tee /dev/sdc | tee /dev/sde > /dev/sdd
1 Like

This was written before learning of blkdiscard which will only work on SSDs. This uses the disks TRIM API to zero the a disk and I have seen this be significantly faster than using dd (locally zeroed a 480 GB drive in about 8 seconds with blkdiscard).

1 Like