LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 10-03-2012, 12:44 PM   #1
jnbb
LQ Newbie
 
Registered: Oct 2012
Posts: 3

Rep: Reputation: Disabled
Using DD to erase a flash drive


Flash memory commonly has 0xFF as the erased state of its memory bytes. I can use dd to erase to 0x00 thus: dd if=/dev/zero of=/dev/sdX. How can I write all 0xFF characters to the device?
 
Old 10-03-2012, 12:48 PM   #2
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,101

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
tbh i would use dd if=/dev/urandom of=/dev/sdX then format it.
 
Old 10-03-2012, 12:55 PM   #3
jnbb
LQ Newbie
 
Registered: Oct 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for the urandom hint but I'd still like to know if there's a way to write 0xFF
 
Old 10-03-2012, 01:12 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,592
Blog Entries: 2

Rep: Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046
You can use dc3dd (available in many distro's repositories) to write any pattern you want to a file. Assuming your flash drive is /dev/sdb:
Code:
dc3dd pattern=FF of=/dev/sdb
 
Old 10-03-2012, 01:29 PM   #5
jnbb
LQ Newbie
 
Registered: Oct 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Many thanks - just what I want
 
Old 10-03-2012, 01:44 PM   #6
guanx
Senior Member
 
Registered: Dec 2008
Posts: 1,014

Rep: Reputation: 146Reputation: 146
Instead of installing a new software for every task, you can also combine existing tools
Code:
tr '\000' '\377' < /dev/zero | dd ...
 
Old 10-03-2012, 02:39 PM   #7
jefro
Guru
 
Registered: Mar 2008
Posts: 11,521

Rep: Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404
Pretty sure there is a way to force an exact stream to a device with dd.
 
  


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
Secure Erase flash media? Super TWiT General 2 09-06-2011 01:16 PM
Really erase USB drive allelopath Linux - Hardware 5 06-26-2007 11:27 AM
LXer: EDGE Tech Corp Announces Portable Flash Drive With Muscle - the New 8GB DiskGO!(TM) Now Available; Swap and Go With This Secure Thumb-Sized Flash Drive LXer Syndicated Linux News 0 12-14-2005 02:16 AM
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


All times are GMT -5. The time now is 11:14 PM.

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