LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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: 8

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,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
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: 8

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: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
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: 8

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,176

Rep: Reputation: 233Reputation: 233Reputation: 233
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
Moderator
 
Registered: Mar 2008
Posts: 21,981

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


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:32 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration