Page 1 of 1

ZFS zero out HDD

Posted: Tue Jan 16, 2024 4:02 pm
by zemerdon
Wiping the entire disk
This will overwrite all partitions, master boot records, and data. Use the sudo command as well (sudo dd...)

Filling the disk with all zeros (This may take a while, as it is making every bit of data 0) :
dd if=/dev/zero of=/dev/sdX bs=1M #replace X with the target drive letter.
If you are wiping your hard drive for security, you should populate it with random data rather than zeros (This is going to take even longer than the first example.) :
dd if=/dev/urandom of=/dev/sdX bs=1M #replace X with the target drive letter.
The reason one should fill with urandom in case of required security is explained here: [1]

Important Note: You need to replace sdX with the device name you want to overwrite. sda is usually the first hard drive, the second drive would be sdb and so on. Use for example gparted to find the correct drive. If you replace the device name, you can also wipe USB sticks and other peripherals.