DiskPart – Parting the Disk

Not too long ago I wrote a post about fdisk and how that tool came in handy when creating some drives for copying files to and from a retro Windows system. So let us roll the clock forward to something more modern, and a tool that I use regularly to prepare drives for installing (or imaging) modern Windows or to create USB drives to get those installs started. Available sometime around the Windows 2000 days, DiskPart simplifies the process of partitioning and formatting drives by putting all the steps into a single tool. Plus, no reboots required. We start DiskPart from an elevated command prompt – DiskPart requires elevation to do its work.

Once it gets started, as shown by the prompt changing, DiskPart can list the storage drives connected to the machine with the “List Disk” command (shortened here to ‘lis dis’).

DiskPart reports two drives connected to this machine (it is a Virtual Machine, but the prompts will look the same on a physical machine). The first, larger one, is the hard drive of the virtual machine. The second one is a USB drive plugged into the VM. Since this is something I have had to explain more than a few times, let us go ahead and clean that USB drive – a simple process that starts off with selecting the drive.

Once selected, then we Clean.

Clean is a quick process that just removes the partitioning in preparation to be repartitioned and formatted. It is important to note that just a clean will not get rid of all the data left on the drive. Now that we have a ‘clean’ drive we have to create a partition we do that by telling DiskPart to Create a Primary Partition or Create Partition Primary (shortened in the image to “Cre Par Pri”).

We have a single partition, now lets give it something we can put files on with the format command, and quickly. We do this with the command Format quick with NTFS, or better put Format quick fs=ntfs.

Most of the time, once formatted Windows will give the new drive a drive letter and open it up to show a blank file explorer. In the event that it does not, DiskPart can push that drive letter along with the Assign command.

This was a quick introduction into a tool that prepares a drive for use in a (Windows) computer or cleans it up from too much junk. Hopefully this was useful, while I would think most computer folks would have this process memorized – we all need a refresher from time to time. We just scratched the surface with this post, I would encourage anyone interested to jump in and start looking closer – especially the list commands. Going the route in this post is not the most secure route, but I have a post planned for the future that will dive deeper into using DiskPart to securely wipe a drive.

PHP Code Snippets Powered By : XYZScripts.com