General
All these actions should be performed when booted from another drive for example a USB drive.
You should erase the whole drive, that is /dev/sdx
, where x
is the device letter, in your case a
. You should be very careful, because that drive letter may change, and if you get it wrong, you might destroy valuable data.
HDD and shred
shred
can erase the data on a HDD, hard disk drive, but many people claim that it is overkill to overwrite several times. It is enough to overwrite with zeros once, which you can do with other tools, and it will be faster, and cause less wear of the hardware. You can use
- Disks alias
gnome-disks
or
- mkusb.
SSD (and HDD) connected via SATA or NVME
If you have an SSD connected via SATA or NVME, you should avoid using the tools above. Instead you should use the built-in tool to remap the links between the logical memory locations and physical memory cells. This can be done via the command line tool hdparm
in Ubuntu. This works like advanced encryption, where the key is thrown away and is much faster and causes much less wear compared to overwritng.
A fairly new hard disk drive (HDD) connected via SATA can also be remapped using hdparm
.
Lock the drive with hdparm
and the option --security-set-pass
Erase the drive with hdparm
and the option --security-erase
Unlock the drive with hdparm
and the option --security-unlock
See man hdparm
for more details.
SSD (and HDD) connected via USB
Warning: Using the built-in tool via hdparm
is very risky and should be avoided, when the drive is connected via USB.
USB pendrive and memory card and other drives connected via USB
You can use
- Disks alias
gnome-disks
or
- mkusb
to wipe the whole device of a USB pendrive or memory card and other drives connected via USB.
- A HDD connected via USB can also be wiped with
shred
as decribed above.