LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Using DD to erase a flash drive (http://www.linuxquestions.org/questions/linux-software-2/using-dd-to-erase-a-flash-drive-4175430320/)

jnbb 10-03-2012 12:44 PM

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?

frieza 10-03-2012 12:48 PM

tbh i would use dd if=/dev/urandom of=/dev/sdX then format it.

jnbb 10-03-2012 12:55 PM

Thanks for the urandom hint but I'd still like to know if there's a way to write 0xFF

TobiSGD 10-03-2012 01:12 PM

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

jnbb 10-03-2012 01:29 PM

Many thanks - just what I want

guanx 10-03-2012 01:44 PM

Instead of installing a new software for every task, you can also combine existing tools
Code:

tr '\000' '\377' < /dev/zero | dd ...

jefro 10-03-2012 02:39 PM

Pretty sure there is a way to force an exact stream to a device with dd.


All times are GMT -5. The time now is 08:27 AM.