SOLVED: Easy Script to Wipe A Hard Disk Fast

If you have a hard disk you need to scrap or sell and you want to remove your data from it, this is the place for you.  In our case, we had 700 3TB disks that need to be wiped and resold so we wanted to make sure it would be very difficult for even professionals to get the data off of them.

If you know what you are doing but just need the script click HERE to download it or skip down to QUICK SCRIPT TO WIPE HARD DRIVE, below.

The script below is self explanatory for anyone familiar with DISKPART but if you are not, you need to figure our which DISK and which VOLUME you want to kill.  To do that we simply run through the script manually once and then all of the others will be the same:

  1. Connect a disk you want to kill (as stated, we used a USB kit)
  2. Open a CMD prompt as an administrator
  3. Type DISKPART and press enter
  4. Type LIST DISK and press enter then note the number of the disk you want to wipe
  5. Type SELECT DISK x and press enter where X is the disk you want to wipe
  6. Type CLEAN and press enter – this will wipe the disk
  7. Type CONVERT GPT and press enter
  8. Type CREATE PARTITION PRIMARY and press enter
  9. Type LIST VOLUME and note the new volume numberIf you want to finish this disk off continue through this list, or just modify THIS script to match your VOLUME # and DISK # and run it
  10. Type SELECT VOLUME x and press enter, where x is the volume you want to kill
  11. Type FORMAT QUICK FS=NTFS LABEL=NEW2U and press enter
  12. Type ASSIGN LETTER=”U” and press enter
  13. Type EXIT and press enter

Once you know the DISK # and the VOLUME # you can download THIS SCRIPT and unzip and run it.  In fact there are two scripts included:

QUICK SCRIPT TO WIPE HARD DRIVE:

Download the disk wiping script HERE or build one yourself using the code below.

You can run first script by bringing up a CMD prompt as an administrator, change the directory you unzipped the files into (I used C:\TEMP) and then type:

DISKPART /S WIPE.CMD

Where WIPE.CMD is the following:

select disk 1
clean
convert gpt
create partition primary
select volume 3
format quick FS=NTFS label=New2U
assign letter="U"

QUICK SCRIPT TO WIPE DRIVE, OVERWRITE then WIPE AGAIN:

Simply removing partitions and volumes does not make it impossible to recover the data.  To do that you have to overwrite parts of the disk.  To meet various government and industry standards, various “destructive wipe” tools will copy zeros to every sector on a disk, perhaps more than once.  For most people that is overkill, so we devised a faster, simpler solution:

  1. Wipe the disk using the above script
  2. Automate the copying of files to the disk
  3. Wipe the disk again

This is definitely NOT as secure as certified solutions that write over the whole disk, but it is a whole last faster and very effective.

In our case the disks had data striped across many disks which means to get a single file back, you would need to have more than one disk and rebuild the RAID array before you could even attempt a recovery.  Good luck with that.  The CIA with an unlimited budget and manpower can do this but no-one else is.

To make this more flexible our script calls to copy anything named TEMP in the same folder as the script, to the doomed drive.  The idea being you can easily copy more or less as you see fit.  If you are more worried about protecting the data on your former disk, copy more stuff or larger stuff.

In our case I simply took a 10MB EXE file, renamed it TEMP.EXE and then made 20 copies of it.  That means our script would copy 200MB of garbage to the drive.  If you had more time, you could find a larger file, rename it temp.anything and then make 100 copies of it.  The script would then copy those files larger file to the doomed drive making it even more unlikely recoverable.

The WIPE-COPY-WIPE.bat file HERE does just that.  This is not acceptable for government data but just fine for almost everyone else.

If you want more information on how to overwrite a drive, you will like THIS article.

View Comments

  • Did you know that when you “delete” files from your computer, they can still remain on your hard disk?
    In many cases, deleted files can be recovered with little effort
    because most computer operating systems will only delete links to the data so they no longer appear to you, but the actual data remains on the
    disk. Getting access to the deleted data is as simple as restoring the links.

    This method of deletion is fine for most circumstances–where security is not an issue–but you
    wouldn’t want some people to recover your financial statements or
    medical records. For sensitive data, you need to make sure that your computer
    overwrites both the links to the information and the information itself.

Published by
Ian Matthews

This website uses cookies.