Menu

Prep & Wipe a Drive

Anonymous

To successfully wipe a USB drive, check either via lsblk or gparted if have more than one SSD/HDD, for this example the USB is found at sdc, due to the fact I have a twin disk set up, use the following commands to wipe and format a USB device.

USB

  1. sudo dd if=/dev/zero of=/dev/sdc bs=4M iflag=nocache oflag=direct

  2. UNPLUG/EJECT USB then re-insert;

  3. sudo parted /dev/sdc mklabel msdos to check the true partition size

Example parted /dev/sdc

then type "print"

GNU Parted 3.2
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: Generic Flash Udisk (scsi)
Disk /dev/sdc: 7736MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start  End     Size    Type     File system  Flags
 1      512B   2102MB  7736MB  primary  fat32        lba
  1. sudo parted -a none /dev/sdc mkpart primary fat32 0 7736MB use the printout size from your USB printout NOT the above example to ensure the true size of your drive when formatting it.

  2. sudo mkfs.vfat -n "Disk" /dev/sdc1

SSD

To successfully wipe a SSD, check either via lsblk or gparted if have more than one SSD or HDD, for this example the SSD is found at sda, due to the fact I have a HDD for data storage, use the following commands to wipe and format a SSD device.

If you get the following warning message "Descriptors says 2048, Linux says 512" run this command:

sudo dd if=/dev/zero of=/dev/sdX bs=2048; snyc

Afterwards re-open Gparted to create new partition table (GPT or MBR) and Reformat ext4 etc.

SECURELY WIPE SSD DRIVE
sudo dd if=/dev/urandom of=/dev/sda iflag=nocache oflag=direct bs=4096 @ 8hrs for 500Gb SSD

HDD

These days I only a HDD for data storage, if I was to erase the data, the optimum method is to use https://dban.org/ it takes 12hrs per 1 TB drive. The following dd method I have not tried, but I'm assured by peer reviews it works.

sudo dd if=/dev/urandom of=/dev/hda