Securely Erasing Your Old Hard Drive Easily with Linux or a Mac

I have been thinking of the easiest way to completely and securely erase a hard drive lately.  I was given two old laptops and was asked by a dear family member to help get some personal effects off of an old laptop.

To keep this short, I was able to do that using an external hard drive case and my own machine.

Since I use Linux, I am immune to windows viruses, I can simply copy the desired data to my computer.  I now have a directory of 1.1 GB of pictures, writings and other information on my desktop which I will burn to a DVD and say “Here you go, enjoy”.

Mac people and other BSD people can rejoice in that as well.

She’ll need to scan that for viruses before she looks at it in detail since she’s on windows.

Ok, that’s all done right, just toss the drive in the nearest secure shredder or sneak it into the trash or….

Not so fast.

You see, data can be forever.

A CD typically lasts 10 years.

A CD that “you” wrote may not last that long, say 5 years.

A DVD will last longer, I haven’t had one that I wrote fail yet, and some are well more than 10 years.

I still don’t trust that removable and optical stuff.

But, if I can get the computer I am looking at now to recognize the drive, the data will still be there.  Useful or not.

Even those old 500 MB drives from the first days of the IDE era can be read if I have a way to convince my laptop to read it.  How?

Get an external hard drive case.   You need to know what kind of hard drive you have in your hands.

IDE External Cases are still available.

Serial ATA or SATA cases are available in USB 3.0 and 2.0 if you want cheap.

I paid under $5 for mine when they were on sale.

Put the drive in question in the case.

Plug the drive case into the computer.

Assuming that your computer can see the drive and the data on it, now what.  You’ve got your data off and you want to securely erase the drive.

Here’s where Linux comes in to play, although a Mac will work as well.

Don’t have a Mac or Linux computer?  The easy fix is to download a copy of Ubuntu and burn that to a DVD or to a memory stick and boot from that.   That is all done via a program called unetbootin and it is available for any modern operating system that I can reasonably think of.   Follow the instructions and you end up with a bootable USB stick.  Boot from that stick.  Plug the external drive in.

Now you’re looking at Linux.

(If you’re a Mac guy, you can to follow this on your Mac.)

Commands from this point forward will be in BOLD
Start Terminal.

Get root with “su” or “sudo su” and give it the system’s password.

Verify the address of the external drive.  “dmesg” will give the device name at the end of the display.  You can also find it in gparted (if installed).  The address will be similar to /dev/sdb.

Verify it again.  “Measure twice and cut once”.

In terminal enter the following command – I am assuming that the operating system thinks that the external drive is on “/dev/sdb”.  You need to know which partition and this will tell you where it is:

fdisk -l /dev/sdb

(Man, I hate Helvetica – That is a lower case -l )

On the Windows drive I have in question, it gave me two partitions – sdb1 and sdb2.  Windows being what it is, will almost always use sdb1 as the boot partition, and it will almost always be the largest one and the one in question with your data.

Since I have cleared out all the data that I would be worried about in an earlier step, I do not have to worry about deleting any partitions.  But I do have to create a space to work with.

Within terminal, mkdir work will make an empty directory to play with.

To access the data on the external drive: mount /dev/sdb1 work

To verify you have connected to the drive, cd work 

To list any data files you left in that directory, ls  will show you.

To create a big file to overwrite all that empty space enter the following command.

    dd if=/dev/urandom of=junkfile.txt

That dd Command will write random garbage out to the file called junkfile.txt until it runs out of space. Out of Space is a bit misleading because certain disk formats have maximum file sizes, so just run it again with a different name on the “of” portion of the command – like “junkfile1.txt” until you are satisfied.

That’s about it.   Your empty space on the drive has been filled with garbage.  You can delete that junkfile.txt and use the drive as a floppy if you like.  Since you previously deleted things that you wanted to be securely deleted, this happened with it was overwritten with random data.

The theory goes that with the “new” and “large” disks we have inside of our computers over the last few years, simply writing garbage out would be sufficient.
The Geek version was that the old drives had enough space between tracks that the data would sometimes, but not always, be mirrored and repeated in the empty spaces.  Some of the information could be “recovered” by reading that space.

You don’t have the technology to do that.  Any “normal” person finding your drive would not either.

New drives over the last few years are so densely packed that that space between the tracks is too small to store extra copies of the data.

If you are super worried (paranoid) about your data, give the drive to a destructive person, and some hand tools, and let them disassemble it for the magnets.  Or run over it with a truck.   Or both.

But this is as far as I go with my own personal data.

Advertisements

Now That You Have The New PC, What Do You Do With The Old One?

No, I don’t need it.

Well I mean, if it’s something really cool like a Mac Book Air, or a Thinkpad Yoga or something like that I could easily find a home for it here, but that’s not what I’m getting at.

So you had a computer for a while.  I don’t mean a tablet.  Tablets are their own weird problem.

A Laptop or Desktop Windows PC.  For sake of discussion.

And this is not meant to be comprehensive.  There are too many different vendors of computers, there are Macs, there are different places to keep the “original discs”.. you get the picture.

If you really need someone to hold your hand while doing this, you may want to consider finding someone nearby.  I’ve done this a number of times, and it is safe to do, but I am in South Florida and I have my own rates that I charge for this kind of service.

Advertisements aside….

You used the old PC for years.  I have a friend who had an old machine he just upgraded that he used for 10 years.  He’s lucky he could keep it going that long.  But normally people use their main computer for 2 years or maybe 3.

You get used to its quirks, it’s current operating system, it’s way of storing files, its noisy fan, that sort of thing.

I keep hearing the story of people that take the hard drive out of the machine and throw it out, or they just roll it into the hall closet and try to forget about it.

Some homes have three or four computers that way.

No.  Just stop.  Someone else could use that machine anyway, especially if it is a Core 2 Duo or newer machine.

First of all, you need some of those files.  They’re typically under a few specific spots.

Open your File Manager: Start,  “This PC”  on Windows 8/8.1 or “My Computer” under Windows 7.

I wish they’d stop renaming things, it doesn’t help.

The things you normally need are in places that are listed:  Desktop, Documents, Downloads, Music, and Pictures.  If you are someone like me who goes and puts things in places that mean something to “ME”, you will know where they are.  I can’t tell you where that is from here, you’ll have to search for them yourself.

But Windows has for years kept things in specific folders where it wants you to save things.  If you followed Windows’ lead, then that does make life easier. 

You will need to copy those folders off.  Use an external hard drive, about $50, and copy the lot onto the drive.  If you know how to share the computer and the hard drive across the network, you probably know more than what you’ll get out of this article.  At that point you can copy the folders across the network.

Yes, you are already on a network since you are most likely on wifi and reading this here.  But hopefully you’re at home.

At any rate, copy those files back onto the new machine in the same fashion and in the same folders.  When you are done, delete them from the old computer.

Now, that doesn’t necessarily “clean” the computer.  What that did was to remove the pointer.  What everyone is afraid of is someone getting the computer and grabbing the data that was on it before.  The easiest way to fix that is to write over the data. 

There’s a middle step here that makes life easier.  If you created the original “Install” DVDs or have a way to “Set the Computer Back To Factory Settings”, do that now.  Your computer will go back to the way it was when you first plugged it in.  That doesn’t clear out your empty space, but it does delete everything and makes it all fresh and new.  It also is a one way trip and you can’t go back.  This is a bit of a shortcut since it makes space that needs to be cleared, and it also gets rid of your data.

Once you have done that, you need to clear all that extra space.

An automatic solution is one of those programs that writes “nulls” to the hard drive.  There are quite a few of them and many are free. 

This one, DP Shredder will simply delete files or folders, and there’s a handy little button that will let it clear out the free space on the hard drive, including the space you just made by deleting files.  He wrote the software correctly since it is a rare thing these days.  It is portable and does not require an install.  However it does come in a “.7z” extension which means that first you need a program to extract that.  You can install the 7-Zip program which is free, and extract the DP_Shredder.exe to run the program. 

Now that you ran DP Shredder, and that literally took hours I’m sure, your computer is cleared of your private data.

You can safely give the computer to the charity of your choice, the kid next door, or anyone you choose.  Your old data is gone.

Windows Update Forces My Backup

I’ll admit it, the last time I did a backup of my computer was February.  Six Months ago.  All excuses aside, it’s way too long.

Last night I was sitting in the big green chair.  Watching Oliver Douglas try to get Arnold Ziffel the Pig out from under the floor in the bedroom of the old Haney Place on Green Acres, I realized I reached the dreaded “Logical Breakpoint”.

I was going to do a full shut down of the PC that I use for my “Daily Driver”.   This is the little laptop that I’ve had for about 2 years.  I bring it everywhere that it’s appropriate and I’ll need proper computing power.  I use it for web development, graphics design, all my consulting, as well as a significant amount of entertainment.   I’ve got others, but this one and I “bonded” and it’s the one I start first and use all day.  I have programs that run from when it starts to do chat on AIM, Yahoo Instant Messenger, and MSN Messenger, Skype and others so that I can be found if any of my clients and friends need me. 

It’s pretty important.

So I don’t shut it down often.  I usually hibernate the machine because to shut down all those networks, graphics design programs, video editors, and the rest of the layers of software just take too long to get back to where they were before I shut it down in the first place. 

I don’t like that little gold shield that sits next to the shut down button because it will sit there nagging me until I do what it wants. 

Last night I did what it wants.

It took about an hour of reboots to recover. 

The machine went and installed 10 Windows Updates, then powered off. 

I pressed the little silver power slider to get it to come back on.  It finished the updates, then rebooted itself.

To darkness.

Ok first things first, that’s a major problem with Windows 7.  When you start a machine, it does not tell you what it is doing.   Sure, Microsoft wants you to believe that it is a sealed unit, just like a Mac, but it isn’t.  Something can go wrong.  In the land of FPL where power pops can destroy your washing machine, a laptop is an easy target.

It went to restart itself and asked if I wanted to try the recovery console.  Sure, lets try it.

Nope, it got part way into it and restarted itself.

Helpfully, from across the room I hear “Try powering it off completely and powering it up from a dead stop”.

Tried that, got further into the recovery console but that didn’t look comforting.  When you see that first power on screen again after almost two years, you know you’re in a weird place with your computer.

I closed that, and tried the shut down again.

It attempted to reboot the system again to the windows startup menu.

This time I got what a little child once called The Dark Place.  Wonderful description about when you get a black screen with white typing all over it trying to tell you what to do.

Tersely.

We selected “Boot From Last Known Good Startup” (or something phrased remotely like that) and it got me back to my familiar desktop.  I was staring at M.E. DePalma Park in bloom.   We all breathed easier.

Grabbing the external backup drive, I plugged it in.

After some hunting for the “Backup and Restore” software, it was started and I told it to do a full backup of my C Drive.

In Windows 7, Backup and Restore is in the Control Panel.  Start, then Control Panel, then Backup and Restore.   Don’t listen to Mr Expert.  He’s wrong when he tells you that nothing like that is in Control Panel. 

Anyway… when I woke up this morning the backup was at 75% complete.  That was after 10 hours.

So today has been “Triage Day”.   I’m familiar with the word Triage from the series MASH.  Basically the concept says you categorize your efforts into three levels:

  1. Dead  – What you don’t need.
  2. Repairable – What you need but if you lost it it wouldn’t be terrible.
  3. Alive – Absolutely Must Be Kept Safe!

I’m doing that now.  Getting the data into categories.  Copy your “My Documents” library onto some removable media.  Get the videos or music onto the chip that goes into the tablet or mp3 player.  Get your downloads out of the C:\Downloads or the C:\User\Bill\Download tree.

Then do a Chkdsk.   Remember those?   To do it right, your system must be in “Single User Mode”.  That means nobody can do anything to the PC.  So basically you schedule that disk check for when you turn it off and back on again.   To get to the program you have to do the following:

  1. Start
  2. Accessories
  3. Right Click on the “Command Prompt” icon and select “Run as Administrator
  4. type in “chkdsk C: /r” and hit enter
  5. respond “Y” to the question “would you like to schedule a chkdsk next time you start your computer?”

You will need to actually shut down the PC and then turn it back on.   That is where I am at.  When the machine comes back on, I’ll do the backup, really I will.   But that means I have to get back to the logical breakpoint.

As for Arnold Ziffel, he got out from under the Douglas’ floor before Oliver got squirted by the Hooterville Fire Department’s hose. 

The PC will take a little bit more time than that escapist comedy on TV last night.  I have 27GB of data from a client that still has to be copied off onto a removeable hard drive before I chance that chkdsk that will take more than an hour.