Thursday, November 21, 2013

Safe Delete(Shred) DATA in HDD/ Partition in LINUX


What Happens when you issue remove command on File System?

     Most File System just remove the vnode link from the DIR structure. So what happens to your DATA. You got is right, it just sits at the DISK, waiting for be overwritten or to be recovered by a Crash Recovery Software. The latter sounds good when you are actually using it, but if some one else uses it. You know the consequences. 

How to Safe Delete/ Shred File?

Simple, use any of the above commands

sudo dd if=/dev/zero of=<Device Target>

eg 
sudo dd if=/dev/zero of=/dev/sda

To get the Device Target use the following command

fdisk -l

This command lists all the Disk Partition info with Disk targets.

You can also use this command, if you need to be so sure. This makes two passes in shredding. 

sudo shred -vfz -n 1 <Device Target>

eg
sudo shred -vfz -n 1 /dev/sda

You can also use the LiveBoot of gparted.iso(http://gparted.org/). Boot it via CD/USB. And issue the above command even in Windows/ NON-Linux x86 Machines.

Note : Be careful when playing with these commands. You may purge away useful data Partition/Disk.