• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

How to clean a drive through DISKPART

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

caddi daddi

Godzilla to ant hills
Joined
Jan 10, 2012
Today we will go through the steps in cleaning a drive using diskpart that comes with windows
It can be an ssd, an hdd or even a flash drive.
Today it will be A flash drive that has started acting funky.
Sometimes it's not seen and some times it is so, before throwing it out I'll clean it and see if that cures it. I'll be using win 10 but this will work in 8.1, 8 and 7.
The first steps are to open start, open file explorer, and type run in the search pane.
In win ten I had to scroll about 3/4 way down the page to find it, I used the highlighted one.
In win 7 it shows right at the top of the results.
Just double click it and it opens a thingy on your screen.
 

Attachments

  • run.PNG
    run.PNG
    25.3 KB · Views: 77
Last edited:
The next step is to type diskpart at the prompt and hit enter, then the screen looks like this,
no typing sudo, no passwords just diskpart and it's running.
 

Attachments

  • diskpart.PNG
    diskpart.PNG
    34.3 KB · Views: 72
Last edited:
Next we need to see the disks we have to chose from.
To do this, at the DISKPART> prompt we type, list disk, no caps by the way.
This gives us a list of disks numbered 0 through however many disks you have connected.
The one I am interested in is disk 3, a 16 gig flash drive but it's listed as 14 gigs for some reason.
Like I said, it's got the funk.
 

Attachments

  • list disk.PNG
    list disk.PNG
    36.5 KB · Views: 71
Last edited:
Now that we know the disk we want, we have to select it, ( this is so easy even I can do it).
Ready? This could be freaky!!!!! yea, just type select disk 3 at the prompt and you are in the disk, it's really that easy!!!!
 

Attachments

  • select disk 3.PNG
    select disk 3.PNG
    24.6 KB · Views: 72
Last edited:
Now that we have the disk selected, it's time to grab the good old brasso and apply the elbow grease, ready?
at the prompt type, clean and press enter,
that's all there is to it, no work at all, no 409, no fantastic, not even a Clinton in sight!!!!
 

Attachments

  • clean.PNG
    clean.PNG
    23.3 KB · Views: 74
Last edited:
When you see this on the screen you are done.
This resets everything on the disk back to the day you bought it so you get to start all over with it.
Now type exit at the prompt to close the window.
The clean command does not over write the data on the disk so it should not be the only thing done when you give the disk away or retire it. to really clean the drive so you can give it away use the clean all command.
I do this when I move a drive between windows and linux and when trying to salvage one.
I hope this helps someone because A few of you members taught me this when I was having issues and I thank you all for all your help.
 

Attachments

  • cleaned.PNG
    cleaned.PNG
    30.3 KB · Views: 69
Last edited:
Thanks for taking the time to write this up! :)

I'm not familiar with what "clean" does, exactly. Is the same thing accomplished by formating a drive in windows? Either in Explorer (select drive, right click, format), or through disk management?



In the first post, you may want to make it clear you are trying to get DISKPART to execute. As it stands, you have to look at the second post/image to see what command you need to look for/execute. The first image/post doesn't show it and doesn't say it by name.

Something to add that may shave a couple of steps off the process: In W10, you can also just type "DISKPART" in the search, no need to go into explorer and type run search for it. That may be the same in 8/7... not sure.
 
clean disk only resets some things on the disk, what, I really don't know exactly.
I do know that all your data is recoverable from the disk, I have selected the wrong drive once or twice and been able to recover it.
it is not the same as a reformat, after cleaning you have to reformat it.

tonight I'll look into the other notes, thanks!
 
Glad you shared a process you know what it does. :p

I looked it up...for those that are curious : http://www.sevenforums.com/tutorials/52129-disk-clean-clean-all-diskpart-command.html

Seems like its more like a quick format and the 'clean all' command is more like a full format.

If that is tbe case, id rather just format directly as it appears to accomplish the same thing but at least with format the drive is ready to use (witbout going in to computer management amd having to create the drive.

(Ill quote later.. mobile)
 
Last edited:
" ...
clean

Removes any and all partition or volume formatting from the disk with focus. On master boot record (MBR) disks, only the MBR partitioning information and hidden sector information are overwritten. On GUID partition table (GPT) disks, the GPT partitioning information, including the Protective MBR, is overwritten; there is no hidden sector information.

all

Specifies that each and every sector on the disk is zeroed, which completely deletes all data contained on the disk.
..."

Source: https://technet.microsoft.com/en-us/library/Cc766465
 
Exactly what i was going to quote. Its the same thing as quick format without the formatting....which is done 99% of the time anyway. :)
 
hey!!! I know what it does, it salvages better than half the drives that I think are toast!!!!!
and that is plenty to know for poor me.......
 
so, should I be using the clean all command?
and would this be a secure erase?
 
You know the result of what it does!

So is this something different than a straight format through windows? Did you try formating through windows, it failed, so you went to do this?


From the link I posted...
This will show you how to use the clean or clean all command on a selected disk to delete all of it's MBR or GPT partitions, volumes, and any hidden sector information on MBR disks is overwritten.

The data on the HDD is not written over using the clean command like it does with the clean all command below. With the clean command, the data on the HDD is only marked as being deleted instead and is only written over when new data is written/saved to the same location on the HDD next.

OR

You could use the clean all command (secure erase) to do the above and also have each and every disk sector on the HDD written over and zeroed out completely to securely delete all data on the disk to help prevent the data from being able to be recovered. "Clean All" takes about an hour per 320 GB to finish running.
 
I know the effect of "clean" but I don't even know how data is "written" to a disk, I know it has something to do with a lazer, I have read that it's something like an old record, I just think it's neat as all get out!!!!
 
would you call 3am early? that's my normal start time.
I'm going to try "clean all" and see if I can recover any of the data, I've gotten pretty good at it, I seem to Bjork everything when I bench.
 
I did, and I can't get a single file off the drive, that's great.
 
Back