These instructions assume that you have already done the basic installation for the flash drive (SSD).
Erasing the device
Any pre-existing data on the disk will be lost during this process. Be sure that you do not do this to the drive containing the operating system because it will erase the OS.
In order to erase the device, it must be either trimmed or wiped (zeroized) before use. Devices can be erased concurrently, see How to zeroize multiple storage devices simultaneously?.
Newly provisioned devices should be erased and their header (the initial 8MiB) must be wiped (zeroized). Older devices that previously had Aerospike data on them should be entirely wiped (zeroized) before being reused.
Trimming the device
blkdiscard (or a similar utility) is significantly faster than
wiping (zeroizing) the entire device. Many drives support
(for example, all modern Amazon EC2 instances support TRIM).
Now wipe (zeroize) the Aerospike device header.
# use blkdiscard to zeroize the header
blkdiscard -z --length 8MiB /dev/<device-id>
# alternatively use dd to zeroize the header
dd if=/dev/zero of=/dev/<device-id> bs=1024 count=8192 oflag=direct
If you need to erase a device that previously held Aerospike data, you need to be sure that the drive deterministically returns zeros after TRIM (RZAT). You should check with your hardware provider or cloud provider. If you are unsure, it is safer to wipe (zeroize) the device.
Wiping the device
Wiping raw drives is similar to formatting a conventional drive and may take an hour or more depending on the drive.
# using blkdiscard to zeroize the device
blkdiscard -z /dev/<device-id>
Using dd to wipe (zeroize) the device
Alternatively, use dd to wipe (zeroize) the device.
dd if=/dev/zero of=/dev/<device-id> bs=1M &
Once the disk is completely zeroized,
dd will finish with the message
No space left on device or an
out of space error. This shows that dd has successfully completed writing to the entire disk and there is no more space left for
dd to continue.
To monitor the progress of
dd, you can use:
bash$ while [ 1 ]
do kill -USR1 (pid_of_dd)