Before trusting a new or repurposed drive with my data, or secure erasing used disks, I perform the following steps:
- smartctl to create a baseline
- shred one-pass with random data
- badblocks alternating four write passes with four read verification passes
- blkdiscard for full disk trim on SSD
- smartctl to compare with baseline
NOTE: Command badblocks defaults to a 1024 byte block size limiting it to 4 TB disks. Increasing the block size from 1024 bytes to 1048576 bytes (1 MB) allows very large disks. Using the default block size with an 8 TB disk throws the following error:
badblocks: Value too large for defined data type invalid end block (7814026584): must be 32-bit value
sudo smartctl -x /dev/sdX ; date -Iseconds
sudo bash -c 'device=sdX && time shred -n1 /dev/$device && time badblocks -b 1048576 -wvs /dev/$device && time blkdiscard -v /dev/$device ; date -Iseconds'
sudo smartctl -x /dev/sdX ; date -Iseconds