I’ve been exceptionally unlucky with hard disks over last few days – to the point that I was beginning to wonder if I was exuding some kind of magnetic force field. Fortunately, the latest replacement from Toshiba seems to be doing fine and looks like the hard-disk I had on loan from an old PC will have to go back.
I was looking for ways to wipe data off the old disk beyond just formatting it, when I stumbled upon DiskPart’s clean command. Here is how you’ll do it (assuming the disk you are trying to clean is #1).
C:\>DiskPart DISKPART> select disk 1 Disk 1 is now the selected disk. DISKPART> list partition Partition ### Type Size Offset ------------- ---------------- ------- ------- * Partition 1 Primary 241 MB 0 B DISKPART> clean all DiskPart succeeded in cleaning the disk.
Firstly DiskPart always assumes you know what you are doing. It will not prompt you for confirmations. Unlike some of the other disk management tools (linux’s fdisk comes to mind), there is no “commit phase” where you write the changes you made to the disk. All changes are made live to the disk. Be extremely careful with this tool.
This technique works for external disks as well as for memory cards/sticks. In fact the output above is from an actual session with my 256 MB SD card connected via a USB card reader.
The list partition command has nothing to do with disk clean-up. It is merely a way to make sure that I have the correct disk selected.
The clean command simply zeros out the master boot record, while clean all zeros out every sector on the disk.
Surely a tool as powerful as this deserves a KB, and gets one too!.
If you need more rigorous cleaning than what DiskPart gives, you’ll need to look at external tools such as PDWipe.