Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i am new to linux can any one give me a suggestion on how to format hard disk that is i need to clean the data,data should not recover again it should be permanently deleted.

share|improve this question

migrated from Jul 9 '12 at 10:47

This question came from our site for professional and enthusiast programmers.

dd if=/dev/zero of=/dev/<target device>

this will write an endless stream of zeros to your device.This will make the recovery impossible. It's somewhat slow though.

You can also try dcfldd, but you have to install it first, and than run:

dcfldd if=/dev/zero of=/dev/<target device>

Some people claim it's faster than dd.

A Note: I am talking about low-level-format here, please be sure it's exactly what you need in your case.

share|improve this answer
Thanx for a suggestion, i will explain u a scenario i have taken a system for rent to my firm i am giving back to them, so i need to format everything i will give them a plain hard disk the data should be totally wiped out – Sukesh Jul 9 '12 at 8:23
Well, than simple format should be enough I think. I doubt they will start recovering data. Though if you want to be sure no recovery is possible, the above will do the trick. – hovanessyan Jul 9 '12 at 8:29
Keep in mind it would be best, if you can plug the hard disk you want to format, to another computer or use a Linux Live CD to execute the commands. – hovanessyan Jul 9 '12 at 8:32
Thanks, which one will be the best like dd or ddfldd – Sukesh Jul 9 '12 at 8:32
dcfldd actually uses dd and it's faster, but requires you to install it. A side from that, they are equivalent in the result. – hovanessyan Jul 9 '12 at 8:42

Two options come to mind.

If its a partition, use the shred command shred -n 2 -z /dev/sdxX should do the trick for a partition. -n 2 will do 2 overwrites with random data, and -z will finish it off by overwriting it with zeros. Slightly overkill, and will also works with files

If its a drive run dban - this should result in the contents of the entire drive being irrecoverably overwritten using a algorithm of your choice.

That said, even zeroing out SHOULD prevent recovery on modern hard drives, but both of these are simple, direct ways of getting data erased.

share|improve this answer
thanks for your input, I wasn't familiar with these tools! – hovanessyan Jul 9 '12 at 12:19
+1 for dban. It's a good tool. – Zoot Jul 9 '12 at 12:57
The joys of being a forensics student. I know a dozen ways to make life difficult for myself if i wanted to do a recovery ;p – Journeyman Geek Jul 9 '12 at 14:37

If you delete the data, and then write new data to the same place in hard disc the previous is impossible to recover. That's because only the beginning of file is deleted. I think it works for all OS and computers.

share|improve this answer

You must log in to answer this question.