Context
In some circumstances it may be necessary to remove all data from an SSD drive used by Aerospike. There are multiple methods of doing this, two of the most common beingdd and blkdiscard. Which is better to use in what circumstances?Method
Thedd approach will mark all sectors on the SSD as 'used' as it writes zeros across the disk. This interferes with the ability of the SSD to perform sector reallocations, native trim and wear levelling, as all sectors are now deemed occupied. blkdiscard on an SSD only marks the sectors as unused so that they are treated as all zeros. For this reason, blkdiscard is preferred in most cases. However, on AWS instances, blkdiscard instead performs an OPAL rotation on the data, which leaves it with garbage data. In this case, dd is the better option.Notes
* "blkdiscard -z" is actually equivalent to the dd command* Please see the device initialization page for details.