ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
For an article on how to do **everything** with this ultimate power tool, search here for member awesomemachine, and look in his sig.
"man dd" for the basics.
My normal "wiping" is to first write random data to the drive, and then all zeros. Secure wipe does something like, but several times. If you don't care about security, just writing all zeroes should be plenty.
What I'm more interested in though is how to do this myself programmatically in C. Is there anything in the linux header files that helps with DMA access? Also, would
Code:
FILE* fp=fopen("/dev/sda","w");
allow me to write to the drive?
I've also read something about a KIO buffer although I haven't been able to find much info on it through google.
Ok, I understand that dev/hda, dev/sda, etc have to do with the hard drives in the computer. But where in the dev/ folder does it contain information about USB's plugged into the system.
I'm trying to figure out how to use dd to wipe a usb.
How could I find out the current, plugged in USB's 3 character name in the dev/ folder? I want to call something like:
Code:
dd bs=4M if=/dev/zero of=/dev/usb
Where usb is the 3 character name in the dev folder. How do I find out this name?
Just curious, I know now that dd bs=4M if=/dev/zero of=/dev/sdx will write all zeros and dd bs=4M if=/dev/random of=/dev/sdx will write random bytes. But how does one write all 1's?
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339
Rep:
Quote:
Originally Posted by scarypajamas
Interesting...
Just curious, I know now that dd bs=4M if=/dev/zero of=/dev/sdx will write all zeros and dd bs=4M if=/dev/random of=/dev/sdx will write random bytes. But how does one write all 1's?
Just curious, I know now that dd bs=4M if=/dev/zero of=/dev/sdx will write all zeros and dd bs=4M if=/dev/random of=/dev/sdx will write random bytes. But how does one write all 1's?
The thing is it would need to be something like a device node so you can read unlimited data from it, like /dev/one, and I think there's a kernel patch somewhere that implements it. You can also write a small C program to do it. Or you can use my solution above.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.