Sunday, May 22, 2011

Write/wipe with zeros to USB drive in Linux

Say, you have a USB thumb drive that you want to donate or give to a friend and you want to ensure that nothings left that might embarrass you, don't worry my friend. As always in the Linux/Unix land there is a tool for that. So to wipe clean a USB drive, do:

dd if=/dev/zero of=/dev/sdc

"/dev/zero" is a special file  that provides a stream of null characters. "/dev/sdc" is the USB thumb drive. dd is a low level system utility used to copy raw data from a source to a destination. Source being a stream of zeros and destination the thumb drive. So, we just wiped clean our storage media. Note that this is applicable to most storage devices, so be careful.


~ts

2 comments:

Rade said...

Please be careful and do not automatically assume /dev/sdc is "your" usb drive.

You can easily find out what storage devices are attached to the system by running (as super user) fdisk -l

For Ubuntu users, sudo fdisk -l

Better to be safe than sorry :-)

Techno Scavenger said...

You are exactly right. The above command is [quite] dangerous. Thanks for dropping by.

Fedora install screen chronicle

Fedora install screen chronicle Below are links to Fedora installation screens. It is interesting to see how it has evolved over time. Fe...