LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-20-2011, 07:36 AM   #1
Stoomy
LQ Newbie
 
Registered: Feb 2011
Posts: 2

Rep: Reputation: 0
Question Removing All Hard Drive data *quickly*


Hi all,
I'm looking for a way to quickly remove all data/partitions/boot records from my hard drives while running linux (distribution is irelevant).

There are lots of ways to do this that I know of, but they all have some problems. Here's a list of what I've tried/thought of already.

The most obvious is fdisk:

Simply delete all the partitions. This usually works just fine and is very quick, but there are times it just doesn't....I'm realy not sure what gets left behind...I remove the MBR as well..but whatever it is, it's in the way.

A couple other options are:

dd if=/dev/zero of=/dev/sdb bs=1M

shred -vfz -n 1 /dev/sdb

Both of these approches are great if you're selling the components and want ot make it very difficult for anyone to recover data. The draw-back is they take so very long to run. I've got four 1.5 TB drives that I've been writing zeros to for 2 days now. If you thought watching grass grow or paint drying was boring......

A hundred years ago or so, when I was doing tech support for Windows 95 users we used this nifty dos-based debug script to wipe the hard drive. It was sort-of a last resort thing, but it worked beuatifully, most of the time. If the cutomer had already formated, fdisked, fdisk /mbr, reinstalled Windows, but still couldn't get the thing to work, this would clean the drive so you could do a fresh install.

Just in case someone wants this, I'll post it. To use: first boot to some type of DOS environment in which you have the program "debug".

-----------------------------------------------------------------------------
debug
-F 200 L1000 0
-A CS:100
xxxx:0100 MOV AX,301
xxxx:0103 MOV BX,200
xxxx:0106 MOV CX,1
xxxx:0109 MOV DX,80

NOTE: Type 80 for the primary hard drive - HD 0,
or type 81 for the secondary hard drive - HD 1.
In most cases, the primary hard drive is required 80.


xxxx:010C INT 13
xxxx:010E INT 20
xxxx:0110 (Leave this line blank. Press the <Enter> key to continue.)
-G

The message Program terminated normally appears.
------------------------------------------------------------------------------

Anyone know how to do something like that while running linux?

Thanks!
~Stoomy
 
Old 02-20-2011, 07:52 AM   #2
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 4,728

Rep: Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753
Actually I forgot what exactly INT13 did if you pass those parameters, but I cannot imagine it is something else than wiping the MBR and write zeroes to it. Does BX=200 set the length of 512 bytes? I have used the same program in .COM form often when for gawdknowswhatreason W95 or W98 wouldn't install determining not to do so based on any reason which was not the business of the installer.

That having said, why does the dd not work as expected? What you do is exactly right, dumping a 1 MB of zeroes in the MBR. I have done this as well on a RAID array, and I can tell you any information on the disk was beyond accessibility. (For normal use that is, not for forensic recovery of course)

Note that the DOS program did not actually wipe the drive either. Filling a 1 GB drive with zeroes in those days took about as long as it does for a 1 TB drive today. (Moore's law, remember).

If you really want to overwrite a disk with zeroes it could be helpful to increase the BS dramatically, or to create one file of a few GB's and dd that one onto the drive to be wiped.

jlinkels
 
Old 02-20-2011, 08:29 AM   #3
Amdx2_x64
Member
 
Registered: Jun 2008
Distribution: Left LQ. Mods are too Rude!
Posts: 598

Rep: Reputation: 50
http://www.dban.org/ something like this? Or do you have to do it in Linux? Dban is an ISO you burn to cd. Then you boot into it (like a livecd,) and wipe the hard drive completely. It can take awhile though with larger drives, so quickly may not be an option.


Edit: Also simply removing or deleting data may not be enough if you have sensitive information you do not want recovered. Overwriting it, etc, many times would be the better option. But it will not be quick depending on the size of the drive. Like you mentioned, it is like watching paint dry.

Last edited by Amdx2_x64; 02-20-2011 at 08:39 AM.
 
Old 02-20-2011, 08:49 AM   #4
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 613Reputation: 613Reputation: 613Reputation: 613Reputation: 613Reputation: 613
It takes a long time to securely wipe data, especially with the insane disk sizes these days. Simple: if you don't want to wait, wipe less.
 
Old 02-20-2011, 09:56 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 16,412

Rep: Reputation: 1936Reputation: 1936Reputation: 1936Reputation: 1936Reputation: 1936Reputation: 1936Reputation: 1936Reputation: 1936Reputation: 1936Reputation: 1936Reputation: 1936
Welcome to LinuxQuestions.

As already stated fdisk will delete the entries from the partition table but not erase data and the debug program AFAIK will also just delete the partition table but again leave data still intact. You can use the dd command to erase the MBR and partition table:

dd if=/dev/zero of=/dev/sdx bs=512 count=1


If you want to erase data other utilities besides shred are dban and secure-delete. If you want to delete data then any utility will need to write to the entire disk and therefore will take a long time depending on its size.

Last edited by michaelk; 02-20-2011 at 09:59 AM.
 
Old 02-21-2011, 01:25 AM   #6
BoraxMan
Member
 
Registered: Apr 2010
Posts: 85

Rep: Reputation: 8
You can easily recover data from drives where the partition table has been deleted. 'shred' or 'wipe' will do, and you can just use one pass. Multiple passes are not necessary unless you think someone will physically inspect the hard disk platters.


I would use the 'shred' command but change -n 1 to -n 0 so it reads

shred -vfz -n 0 /dev/sdb

The command you supplied does TWO passes, one with random data, and one with zeros. This one just does one with zeros. This halves the time spent writing, and saves the CPU from having to come up with 1 trillion random numbers (another potential slow down).
 
Old 02-22-2011, 03:01 AM   #7
Powder-Dust
LQ Newbie
 
Registered: Jan 2011
Posts: 19

Rep: Reputation: 1
How about holding a powerful magnet close to the hard drive, or does that work anymore?
 
Old 02-22-2011, 07:12 AM   #8
Stoomy
LQ Newbie
 
Registered: Feb 2011
Posts: 2

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Powder-Dust View Post
How about holding a powerful magnet close to the hard drive, or does that work anymore?
I suppose immersion in sea water would probably work as well...

Thanks for the replies everyone!

~Stoomy
 
Old 02-22-2011, 09:24 AM   #9
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,620

Rep: Reputation: 451Reputation: 451Reputation: 451Reputation: 451Reputation: 451
Quote:
Originally Posted by Powder-Dust View Post
How about holding a powerful magnet close to the hard drive, or does that work anymore?
I am not sure if this will work with SSDs.
 
Old 02-22-2011, 11:42 AM   #10
silvyus_06
Member
 
Registered: Oct 2010
Distribution: Ubuntu 10.04 , Linux Mint Debian Edition , Microsoft Windows 7
Posts: 390

Rep: Reputation: 50
hi if your question got solved please mark it as solved in thread tools.
and with SSD he doesn't even need the magnet just break it. also have an ax around just to be sure/...perhaps if you want it to be inaccessible in case someone enters and wants to see whats on it delete the mbr but leave your comp running a command to delete the whole hard drive DD is good to leave running
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing a Hard Drive scu98rkr Linux - Software 4 01-22-2010 06:08 AM
Removing a Hard Drive scu98rkr Linux - Hardware 2 01-22-2010 05:15 AM
Hard drive file system problem, I think...please HELP QUICKLY rivalmist Fedora 7 01-23-2009 09:26 AM
Removing Linux from a second hard drive jstroud99 Linux - General 2 09-13-2004 01:06 PM
Removing second hard drive undershepherd Linux - Hardware 5 05-16-2003 11:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration