Visit Our UNIX and Linux User Community


Erasing hard disk contents using dd or dcfldd


 
Thread Tools Search this Thread
Special Forums Hardware Filesystems, Disks and Memory Erasing hard disk contents using dd or dcfldd
# 1  
Old 06-02-2009
Data Erasing hard disk contents using dd or dcfldd

Hi,

I am writing a script to wipe my hard disk, in a relatively secure manner by over-writing the disk with 3 patterns. So, I run the dd/dcfldd command 3 times with a sync call in between each command call in the script.

Code:
#!/bin/sh
dcfldd pattern=99 conv=notrunc of=/dev/sda
sync
dcfldd pattern=jj conv=notrunc of=/dev/sda
sync
dcfldd pattern=hell conv=notrunc of=/dev/sda
sync

I want to know if the above code would in fact,result in my hard disk being over-written with the given patterns in that order? Since I have introduced a sync in between each command call, any remaining buffers to be written onto the disk would have been physically written before the next pattern is being copied to the disk by dcfldd.

Please help me. I really want to understand the impact.
# 2  
Old 06-04-2009
If this is a hard drive and not some solid-state storage device, overwriting the entire disk with plain ordinary zeroes will prevent anyone except NSA men in cleanroom spacesuits from reading the previous data. If your data thieves are that motivated, all bets are off anyway.

I'd make your patterns prime number lengths, perhaps 5, 7, and 11 characters, to give maximum annoyance to the cleanroom spacesuit people since this will make a very long-interval thing for them to have to predict and compensate for.

Last edited by Corona688; 06-04-2009 at 05:33 PM..
# 3  
Old 06-04-2009
I'm in no way an expert on this. But I'd think you can try to read the swiped disk using dd and see if there is any old data.

dd if=/dev/sda of=somefile ....
# 4  
Old 06-04-2009
As Peter Gutmann put it
Quote:
Originally Posted by Secure Deletion of Data from Magnetic and Solid-State Memory (Epilogue)
As the paper says, "A good scrubbing with random data will do about as well as can be expected". This was true in 1996, and is still true now.
If you've got /dev/urandom (or some similar source or "randomness") dd that to your disk. If it's not available, choose any pattern, and overwrite a second time using the complement number.

If you've got to delete HDDs often and/or want to be extra sure, DBAN is very recommendable.
# 5  
Old 06-04-2009
Even after random data has been written to the drive it maybe possible to recover data using special tools that government agencies have access to.

If this is a problem for you and you really think that the government is out to get you, then you should simply destroy the drive and buy a new one.

Exactly how you destroy it is up to you but I read that the US government has a system for destroying computer equipment by cross cut, crush, grind, burn and then spread on the roads as grit in winter.
# 6  
Old 06-05-2009
Thanks everyone for the responses.
Actually my doubt is if I am doing 2 swipes over the disk with a pattern and its compliment, using either dd/dcfldd for the purpose in a script, then the first swipe should have actually ended up physically on the sectors on disk before the second swipe.
With the script I have pasted in my first post, is the sync in between 2 swipes sufficient to ensure that?
Can anyone help me with some pointers on the impact of OS/disk caches on the way to disk sectors?
# 7  
Old 06-05-2009
The sync is useful, but not really necessary (IMO). It does tell the kernel to write it's caches and metadata to disk, but you can't force the HDD cache. But even with a 64MB on-disk cache: that will be full & written to disc 2 seconds after you started writing the second pass.

Previous Thread | Next Thread
Test Your Knowledge in Computers #917
Difficulty: Easy
Unix time is also known as Epoch time.
True or False?

10 More Discussions You Might Find Interesting

1. BSD

Migrate a Hard Disk

hi Has anyone already tried to migrate a hard disk with FreeBSD using recoverdisk? (1 Reply)
Discussion started by: ccc
1 Replies

2. Linux

C++ Code to Access Linux Hard Disk Sectors (with a LoopBack Virtual Hard Disk)

Hi all, I'm kind of new to programming in Linux & c/c++. I'm currently writing a FileManager using Ubuntu Linux(10.10) for Learning Purposes. I've got started on this project by creating a loopback device to be used as my virtual hard disk. After creating the loop back hard disk and mounting it... (23 Replies)
Discussion started by: shen747
23 Replies

3. UNIX for Advanced & Expert Users

Need help for getting hard-disk traces

When we write a programme,we declare variables and compiler allocates memory to them.I want to get access to the physical block number of hard-disk where actually the data is stored by the programme " Some one help me out... (3 Replies)
Discussion started by: nagraz007
3 Replies

4. Red Hat

Need help for getting hard-disk traces

When we write a programme,we declare variables and compiler allocates memory to them.I want to get access to the physical block number of hard-disk where actually the data is stored by the programme " Some one help me out... (1 Reply)
Discussion started by: nagraz007
1 Replies

5. Solaris

Need Hard Disk Details

Hi freinds, What is the command to find out the hard disk details (logical name, FS type etc,). Because i connected one ntfs partition and i don't know the hard disk logical and physical name to mount it.Kindly do the needful. Thanks | P.Bharathiraja. :mad: (2 Replies)
Discussion started by: bharathiraja
2 Replies

6. SCO

declare disk driver for IDE hard disk

hi I've a fresh installation of SCO 5.0.7 on the IDE hard disk. For SCSI hard disk I can declare, for example blc disk driver using: # mkdev hd 0 SCSI-0 0 blc 0but it works for IDE hard disk? (3 Replies)
Discussion started by: ccc
3 Replies

7. UNIX for Dummies Questions & Answers

Hard Disk at 99% Help!

:eek: I use this Solaris to run CMS a call acounting software package for my job. No one could run reports today because it said the this when you logged on "The following file systems are low, and could adversely affect server performance: File system /: 99%full" Can some one please explain... (9 Replies)
Discussion started by: mannyisme
9 Replies

8. UNIX Desktop Questions & Answers

Hard Disk

I have a cuestion. How Can I to add other hard disk to my computer? I need to configurate anyone? (4 Replies)
Discussion started by: hmaraver
4 Replies

9. UNIX for Dummies Questions & Answers

How to Copy Contents from CD to Hard disk

Hello all.. Iam New to Unix Environment. I need to copy .cpio file from CD to a Folder on Sun 5.8 Box. Can anyone give me the commands to execute this ?.. Thanks in advance Ron (4 Replies)
Discussion started by: vr76413
4 Replies

10. Filesystems, Disks and Memory

hard disk meltdown

I had an issue with a second hard disk in my machine. I have a sparc station running solaris 7. It was working fine but now it wont mount on boot up and when you try to mount it manually it gives an I/O error. I tried a different disk as a control which was fine. What I want to know is if my... (3 Replies)
Discussion started by: Henrik
3 Replies

Featured Tech Videos