How To Wiki
m (→‎References: categorizing Linux articles)
Line 4: Line 4:
   
 
==Wiping the entire disk==
 
==Wiping the entire disk==
This will overwrite all partitions, [[master boot record]]s, and data.
+
This will overwrite all partitions, [[master boot record]]s, and data. Use the sudo comand as well (sudo dd...)
 
* Filling the disk with all zeros ''(This may take a while, as it is making every bit of data '''0''')'' :<pre>dd if=/dev/zero of=/dev/sda bs=1M</pre>
 
* Filling the disk with all zeros ''(This may take a while, as it is making every bit of data '''0''')'' :<pre>dd if=/dev/zero of=/dev/sda bs=1M</pre>
   
 
* If you are wiping your hard drive for security, you should populate it with random data rather than zeros ''(This is going to take even longer than the first example.)'' :<pre>dd if=/dev/urandom of=/dev/sda bs=1M</pre>
 
* If you are wiping your hard drive for security, you should populate it with random data rather than zeros ''(This is going to take even longer than the first example.)'' :<pre>dd if=/dev/urandom of=/dev/sda bs=1M</pre>
 
   
 
==Wiping the Master boot record (MBR)==
 
==Wiping the Master boot record (MBR)==

Revision as of 23:36, 16 September 2011

You may need to wipe you hard drive to clean up partition errors, bad installations, or for privacy. This will show you howto do this

These methods use a command called dd

Wiping the entire disk

This will overwrite all partitions, master boot records, and data. Use the sudo comand as well (sudo dd...)

  • Filling the disk with all zeros (This may take a while, as it is making every bit of data 0) :
    dd if=/dev/zero of=/dev/sda bs=1M
  • If you are wiping your hard drive for security, you should populate it with random data rather than zeros (This is going to take even longer than the first example.) :
    dd if=/dev/urandom of=/dev/sda bs=1M

Wiping the Master boot record (MBR)

If you messed up your master boot record (MBR) you can wipe it using this command :

dd if=/dev/zero of=/dev/hda bs=446 count=1

Wiping partitions

You can wipe a partition using the same method than for the whole disk. Just replace the device identifier. If /dev/sda is the whole disk, then (on Linux, because the naming scheme vary from one Unix to another) /dev/sda3 is the third partition on the disk.

  • Filling the second partition on the /dev/sda disk with all zeros :
    dd if=/dev/zero of=/dev/sda2 bs=1M
  • Filling the third partition with random data :
    dd if=/dev/urandom of=/dev/sda3 bs=1M

Wiping specific files

  • try the command "wipe filename" (cf more detail man wipe or wipe -h)
  • Can also try the command "shred" ex: # shred -n 6 -z -v personalinfo.tar.gz (cf man shred)

References