How can I Wipe a USB drive? How do I permanently delete files forever? Is it possible to erase or clear data from a USB to make deleted information unrecoverable? These are all great questions and yes can be accomplished fairly quickly and easily from within Linux. Follow along to learn how.
Table of Contents
What happens when you delete files from a USB drive?
When you delete a file from a drive, the file is not completely erased, even after emptying your trash or recycle bin. Until the space a file once occupied is overwritten with new information, that deleted file is still recoverable. Making it possible for you or anyone to potentially recover files you thought were permanently deleted. The same holds true when you delete files from a USB flash drive; though files deleted from a USB device do not go to the trash or recycle bin, the deleted information can still be recovered until that space is overwritten with new information.
The following tutorial explains how to permanently remove deleted information from your USB flash drive or any other partition. This makes the deleted files or information (for the most part) non-recoverable. We are able to accomplish this task by zeroing out the empty space on the drive using dd. There are many great uses for dd, from forensic data recovery and data backup to zeroing out empty drive space.
How to Wipe USB - Clear Data - Permanently Delete Files
The following process assumes you are up and running from Linux with your USB drive inserted and ready to use. You will be wiping and clearing data from your USB drive by zeroing out the empty space (filling it with zeros). Making the information you permanently deleted from your USB drive, not recoverable.
To proceed to Permanently Erase Data from a USB drive;
1. First, press ctrl+alt+t to open a terminal window.
2. To gain root (admin) access, from the terminal type the following and then press enter.
sudo su
3. Now you can use fdisk to locate your USB device.
To do this, type the following (making note of which device and partition you would like to zero out).
fdisk -l
4. Next, you'll create a directory to be used to mount your device partition.
To make a directory, type
mkdir /tmp/ddusb
5. Then, (replacing x#
with your device and partition),
To mount your partition to this directory, type
mount -o loop /dev/sdx# /tmp/ddsdb
6. Next, to overwrite the empty space on the drive with zeros, type
dd if=/dev/zero of=/tmp/ddusb/junk.bin status=progress
This process will take some time as every byte is being written. Once finished, dd will report that there is "no space left on device". This is normal.
7. Finally, you'll want to remove the zero filled file that currently occupies the empty space.
To remove the bin file so that you can free up the empty space for use, type
rm /tmp/ddusb/junk.bin
That's all there is to it. Now all of the remaining empty space on this partition has been filled with zeros through the junk.bin file. Any deleted information (files, folders, pictures, videos, notes, etc) that were once on your USB flash drive, and later trashed or recycled, have essentially been overwritten. Rendering those files hard to recover.
This concludes one way to use Linux to make deleted files unrecoverable!