Clearing Storage

Got a drive with weird partitions on that you can’t work with? Here’s how to clean them down.

====
A colleague was running in to issues using a USB stick that had been formatted on a foreign system - Mac OS X or Linux or the like. The Windows machine he was using wouldn’t format it the stick, and couldn’t write to it. Constant Access Denied messages.

Anyway, there’s a fairly simple way to clear these storage devices in Windows, so I’ll run through that process here.

Start a DOS Prompt
Firstly, run a DOS Prompt using Start/RUN CMD.exe - note that you will need to start it with Administrative Privileges otherwise it won’t work.

2015-01-17RunAsAdmin

Run DiskPart
In the DOS prompt type ‘DiskPart’ to start the Disk Partitioning utility. Of course if you wanted you could start DiskPart directly without going into a DOS prompt (Again, make sure you run as Administrator) - the reason I don’t is that if DiskPart hits an error it’ll exit immediately and you’ll not see the error. By starting the DOS prompt first a fatal error just drops back to the DOS Prompt and you can see the error. Cunning hey?

List the Disks
From within DiskPart, use the command ‘List Disk’ to list the drives in your machine. You should see listed in here all your drives, and you should be able to identify the ID of the drive you want to work with.

2015-01-17DiskList


Select the Disk
Next, select the disk you want to work with using the command:

Select Disk
x

...where x is the Disk Number from the list. In my example I’m working with Disk 1 so I use the command ‘Select Disk 1’.
MAKE SURE YOU SELECT THE RIGHT DISK.

Clean the Disk
Clearing the selected disk is easy - just use the command ‘Clean’. Boom, completely wiped. This command removes any and all partitions or volume formatting from the currently selected disk -
so make sure you have the right disk selected!

Note that sometimes I’ve seen an ‘Access Denied’ message when you run this command - just wait a 30 seconds and run the command again.

Job done! DiskPart is very powerful utility for working with drives, you can see all the possible commands/functions here:

DiskPart Commands

You can also for example convert the partitions with this utility to - to convert from GPT to MBR for example just use the command ‘convert MBR’. A utility well worth getting to know if you work with storage a lot.

Video below runs through the process.






blog comments powered by Disqus