LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 06-25-2007, 09:16 AM   #1
allelopath
Member
 
Registered: Jan 2003
Location: New Mexico
Distribution: SuSE 9.2 Professional, OpenSuSE 10.1 64 bit, Open SuSE 10.2, Debian Etch
Posts: 535

Rep: Reputation: 30
Really erase USB drive


I have borrowed (and am about to return) a 512mb Cigar Pro USB drive. I had deleted all the files. Now, how do I really clean the drive (e.g. leave no possibility of recovering files)?

It is formatted in vfat. I can use Linux or, if i must, Windows.
 
Old 06-25-2007, 10:03 AM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 327Reputation: 327Reputation: 327Reputation: 327
Just write zeros to fill the drive. For example:

dd if=/dev/zero of=/dev/sda
 
Old 06-25-2007, 10:10 AM   #3
allelopath
Member
 
Registered: Jan 2003
Location: New Mexico
Distribution: SuSE 9.2 Professional, OpenSuSE 10.1 64 bit, Open SuSE 10.2, Debian Etch
Posts: 535

Original Poster
Rep: Reputation: 30
# dd if=/dev/zero of=/media:sda1
dd: writing to `/media:sda1': No space left on device
8047361+0 records in
8047360+0 records out
4120248320 bytes (4.1 GB) copied, 123.362 s, 33.4 MB/s

Did this work?
 
Old 06-25-2007, 10:24 AM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 327Reputation: 327Reputation: 327Reputation: 327
You wrote a lot of zeros (4.1GB), but to the wrong place (a file called "media:sda1" in your root directory).

Erase the file you created, and use:

umount /dev/sda1
dd if=/dev/zero of=/dev/sda1

You can also use:

umount /dev/sda1
dd if=/dev/zero of=/dev/sda

The second case will wipe the boot sectors and partition table as well.
 
Old 06-25-2007, 10:47 AM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,017

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
I just tried it, it didn't work for me (the files are still there).
So I tried this:
Quote:
# dd if=/dev/zero of=/dev/sda1
dd: writing to `/dev/sda1': No space left on device
517048+0 records in
517047+0 records out
264728064 bytes (265 MB) copied, 26.0638 seconds, 10.2 MB/s
But note that it took longer than 26 seconds for the memory stick light to stop flashing.
Then I unplugged it, and plugged it back in again.
It didn't auto mount.
So I tried this:
Code:
# fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 264 MB, 264896512 bytes
9 heads, 57 sectors/track, 1008 cylinders
Units = cylinders of 513 * 512 = 262656 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        1008      258523+  83  Linux
It appears to have one linux partition but no filesystem.
So I tried this:
Code:
# dd if=/dev/zero of=/dev/sda
The light on the stick flashed for 5mins, but never finished. It's only 256MB. As I couldn't <CTRL><C> the dd command, I just unplugged it and plugged it in again.
Better this time:
Code:
# fdisk /dev/sda
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
This looks like it is really zeroed out.
Time to fdisk it, and create a new filesystem on it.
Thanks, that was fun.

Edit macemoneta beat me to it!

Last edited by tredegar; 06-25-2007 at 10:48 AM.
 
Old 06-26-2007, 11:27 AM   #6
allelopath
Member
 
Registered: Jan 2003
Location: New Mexico
Distribution: SuSE 9.2 Professional, OpenSuSE 10.1 64 bit, Open SuSE 10.2, Debian Etch
Posts: 535

Original Poster
Rep: Reputation: 30
thanks to both of you for the help
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Erase windows + mount the 2nd hard drive. Dan8080 Linux - Newbie 2 06-22-2006 11:46 PM
Knoppix Drive Erase Le_Petit_Lapin Linux - Newbie 8 08-31-2004 07:07 AM
cant erase hard drive Xentrix Linux - General 3 07-14-2004 09:22 AM
Erase Hard Drive from Rescue? mithras Linux - Newbie 6 12-11-2003 11:29 PM
How to erase hard drive . . . zthomasz Linux - General 2 07-30-2003 10:25 PM


All times are GMT -5. The time now is 05:33 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration