Format a USB stick completely

Solution 1:

How to erase / delete / blank or wipe a disk

I’m sure there are other methods, but the one I prefer to use is the one that uses dd to copy zeros, or random data in the file system I want to wipe.

So, run this command if you want to erase your… let’s say microSD card.

Suppose it is mounted on /dev/sdd1:

dd if=/dev/urandom of=/dev/sdd1

If you do not want to wait too much, you can fill the partition with zeros instead of random data:

dd if=/dev/zero of=/dev/sdd1

Both are secure, but IMHO the first one may be better, but of course I can be wrong.

Once again, be sure to double check, or better triple check on which partition you are going to apply this, you will not be warned by Linux, and the result can not be undone.

A good practice could be to first make an image of the disk and then wipe it. If you want to proceed that way, do this.

dd if=/dev/[partition-to-wipe] of=/tmp/backup.img

Then wipe it

dd if=/dev/urandom of=/dev/[partition-to-wipe]

You can then recover the data by doing

dd if=/tmp/backup.img of=/dev/[partition-to-wipe]

Info taken from this site.

Solution 2:

Just use GParted. GParted

Unmount all the partitions on the USB stick, and then delete them. You can then create partitions as you like. The is some documentation here if you need any.

This should effectively wipe any partitions. - remember to click this green button, or it won't do anything:

enter image description here


If you just want to wipe it, you could also find the device name in sudo fdisk -l in terminal, and then run:

sudo dd /dev/zero /dev/sdX1

Where sdX1 is the name and partition number of the device, which you can find in GParted or fdisk. This is not that necessary if you just use GParted, but you may need to use GParted afterwards to reformat it anyway... smiley

Solution 3:

Simple! Start up gparted via the terminal (Ctrl+Alt+T) and entering sudo gparted

terminal.

Once you do that gparted will start.

gparted starting

The USB stick should show in the disks area (upper-right-hand corner) as something like /dev/usb or /dev/sdb. Make sure the disk selected is the USB stick, the following steps will wipe ALL data on the selected disk.

  1. Go to Device>Create Partition Table This window will come up:

new partition window

click Apply . You may have to also start this process by clicking the check-mark button.

This will create a new partition table and will make the data unrecoverable by most people.