Quickly format a flash drive via the command line. Command line as a tool for formatting a flash drive Diskpart boot disk

Creating discs on a hard drive or recording bootable flash drive a difficult task, especially when bugs come one after another. The integrated Diskpart utility is good in some ways, but a series of errors it detects sometimes completely deprives you of the desire to do something. Let's look at all cases separately.

We have looked at several points where problems are possible when using DiskPart.

  1. Error in CRC data

Let's look first at the "error in CRC data" case. It is very typical when working with a hard drive. Appears against the background of damaged source or transferred files. A special Windows algorithm cannot verify the integrity of user-specified software.

If such a situation arises when recording a boot disk, then check its integrity, download Windows image again, take another flash drive.

  1. I/O Errors

This bug is also related to the hard drive. It may appear due to a technical failure, due to OS updates, changes to main partitions, termination of administrator rights, etc.

Let's not write off Windows either. Maybe it's yours "pirate" version is full of all sorts bad sectors, which means that only reinstalling the OS will help.

  1. The device is not ready and the parameter is set incorrectly

Appears when working with a flash drive. Most likely, the user cannot format it or write anything down, because the commands in Diskpart are not written correctly.

  1. The request was not completed

In many cases, flash drives with such errors are most likely broken. However, the last hope becomes formatting DISKPART. It is formatting that can help, so resort to the help of various utilities - there is nothing to lose.

In the eventuality that you have been using computers since the early 1990s, then there is a chance that you heard of fdisk. If not, this is a utility embedded in the MS-DOS and Windows that allows users to format hard disk and create logical partitions. Microsoft DiskPart is a tool that replaces this handy application in operating system s starting with Windows 2000.

Allows you to preview details of the drive before making any adjustments

The program does not feature an interface, but rather you can install and access it using Command Line. On a side note, on Windows 10, the utility does not work with PowerShell. Following the straightforward installation, you can access the tool and commence managing your disks and volumes.

It is worth mentioning that the tool uses scripts and hence, it is recommended that you list and select the object of choice before performing various operations. Once selected, you will be happy to learn that you can find out more about the volume you are managing via the detail command. At the same time, you can assign new letters to the partitions and set the primary drive.

The application works with standard, extended and logical partitions and you can remove or further extend the ones already configured. Other noteworthy operations include import, retain, create volume stripe or setting up a raid from multiple hard drives. Moreover, you can change a drive into a dynamic or basic one using the convert command and selecting the MBR or GPT partitioning styles.

A comprehensive tool for formatting and setting partitions on your HDD

In spite of the CLI operation, Microsoft DiskPart is a reliable tool that enables you to adequately prepare and partition a brand new or older hard drive. Not only does it allow you to grab explicit information about the disk volumes but advanced users can conveniently manage multiple disks, volumes and create as many partitions as necessary.

Macrorit Disk Partition is portable program to manage partitions hard drive. Thanks to this tool, you can not only resize individual partitions without first formatting them, but also optimize the overall speed of the HDD/SSD.

The main window of Macrorit Disk Partition displays basic information about the disks installed in the system: total volume, amount of free space, file system and current health. The program also indicates the partitions and boot areas that are located on each physical medium. In order to obtain more detailed information about disks, you must select the "Properties" item in the section's context menu. There (in the context menu) you will find other functions that Macrorit Disk Partition can perform: resizing, copying a partition, changing the label, checking the volume for errors, defragmentation, deleting a partition, formatting, complete cleaning and analysis of the media surface. The program also provides a tool for creating bootable drives.

For almost every function in Macrorit Disk Partition there is a special step-by-step wizard with detailed explanations and tips. The developers from Macrorit have done everything to make working with their program as comfortable as possible. This is one of the few hard drive managers that is completely free for home use. There is also a paid Professional version that offers users 24/7 technical support and several additional functions.

Key Features and Functions

  • the ability to manage the size of existing partitions without preliminary formatting;
  • the ability to select new sections and assign the necessary labels to them;
  • availability of tools for defragmentation, checking the disk surface, formatting and completely clearing data from the partition;
  • the ability to assess the current state of the physical media;
  • bootable media creation function;
  • section with detailed information about sectors;
  • ability to work in portable mode (without installation into the system).

Don't be fooled by the name of this command and its usage. command console as such. DiskPart commands (meaning attributes entered along with the main line) allow you to use such powerful operating tools Windows systems, which are not available in standard mode.

What this tool is used for and how to use it, read on. The information will be useful to all those who are going to administer hard drives or creating new sections.

DiskPart commands: what are they and why are they needed?

The most important purpose of this tool is that its use allows (based on their basic understanding of abbreviations) to split hard disks to logical partitions.

However, if anyone doesn’t know, it’s impossible to create a partition without formatting. And if this concerns the system partition, it must necessarily contain a boot record, thanks to which operating system and starts after checking the hardware in the BIOS.

But the capabilities of any DiskPart team are not limited to this. The point here is that even when restoring the system from the console or command line when booting from removable media, this tool allows you to fix many problems that are impossible to fix using ordinary means.

For example, sometimes even at the OS installation stage it is necessary to convert the partition into which it will be installed (most often this is due to booting from USB drives or selecting hard drives with a capacity of more than 2 TB). Typically, the system will display a message stating that installation to the selected GPT partition is not possible because MBR boot record is not supported.

You can get rid of this quite simply by using BIOS settings with the selection of a drive that does not have an EFI tag.

But what if the selected partition is indeed in GPT format, although it does not exceed a capacity of 2 TB? In this case, the DiskPart commands for converting from GPT to MBR are used.

And dividing the hard drive into logical partitions is not the most important thing. The issue of formatting and creating an active boot record (for example, when replacing a hard drive or installing an additional hard drive for RAID arrays) comes first.

Obtaining information about capabilities and attributes

To use this toolkit, you will first need to call the command console. Whether you like it or not, this utility built into the system works exclusively in this way.

In the command console, as with all other system tools, you can simply enter the name of the command itself, then enter a question mark separated by a space and a right slash ( diskpart/?). All attributes available for use will be displayed on the screen. But in this case we are only interested in some of them.

Script support

In the simplest version, selecting a partition in DiskPart is quite simple. The string is used to split the selected section create partition logical size=XXXXXX, Where XXXXX- size of the created logical drive in megabytes.

Naturally, the system should see a section marked with a certain letter in file manager. To do this, use the command assign letter=X, Where X is an unused character. This means that if you assign a new partition, for example, the letter F or E, under which the OS recognizes a removable USB drive and DVD/CD drive, then either they will not work later, or the created partition will be inactive.

Legacy DiskPart Windows Commands

As for modifications of Windows systems up to the seventh, the use of this command is fundamentally different. The trouble is that in systems of a lower rank (like XP, 2000 or Server 2003) this utility can only partition disks or delete them.

No formatting with choice file system The question isn't even worth it. But in Windows 7 and higher, this problem is eliminated by using the disk and partition formatting tool that was originally included in the program, and even supports mobile operating systems.

The simplest algorithm for using a console command

Now about practical use this tool. Initially, the command line is called. If it is launched on a running system, be sure to start it as an administrator. If we are talking about the recovery console when booting from external media, this does not matter.

Teams start first diskpart And list disk(in some cases you can use the addition volume to view the letter of the selected section). The first activates the main tool, the second provides information on all disks and partitions available in the system. The partition selection command in DiskPart looks like this: select disk X, Where X- partition or disk number specified when viewing all available ones.

Line clean deletes all contents of the partition, then uses the command to create a primary boot record create partition primary, followed by the line select partition 1(indicating the number of the created section), then the section is activated by the line active and finally formatting is done - format fs=ntfs, if this particular file system is needed.

But the above command does a full format. If you don't want to waste time, you can add quick at the end of the line, which corresponds to quick formatting.

Now it's a matter of small things. The created section must be assigned a letter with the command assign, after which you can exit the command console either by closing it normally, or by entering the line exit, which contributes to the correct completion of its work.

Possible errors and failures

But things don't always go so smoothly. Sometimes you may encounter situations where the system displays a message stating that DiskPart is not internal or external team. This can be observed when starting to boot from removable media when selecting GPT partition(by the way, and checking the disk as a combination chkdsk I am not immune from this). What to do in this case?

Entering cleaning and transformation will help here ( clean And convert mbr) after the drive selection line ( select disk). Allegedly, this process may take several hours, but, as they say, it works one hundred percent. But it is necessary to use such a tool only if there is no information on the disk. Otherwise, all data will be destroyed.

In general, DiskPart commands are not difficult to use. The most important thing here is compliance with the input sequence from the algorithm described above, of course, taking into account some additional parameters. And note, the use of this particular tool can solve not only the problems of partitioning disks into logical partitions, but also issues of formatting or eliminating some critically dangerous failures. But that is another topic.

This guide explains how to use the diskpart utility for the following Windows versions: Windows XP, Vista, 7, 8, 8.1 or 10.

What is diskpart

The diskpart utility (available in Windows 2000, XP, Vista, 7, 8, 8.1 and 10) can be used to create or delete partitions on your PC.

The utility allows you to:

  • Partion
  • Remove partitions
  • Remove formatting
  • Assign and remove drive letters and mount points
  • Convert disks from basic to dynamic
  • Create and extend volumes

Most commands that you can perform in Disk Management (see ) are available with diskpart. Because it's a command line utility, you need to open Command Prompt and type diskpart .

On Windows Vista, 7, 8 and 10 systems, you can type diskpart at Run, click OK or press Enter and Command Prompt will automatically open with diskpart loaded.

When the utility is loaded, you will notice the version installed on your computer:

Microsoft DiskPart version 6.1.7600 Copyright 1999-2008 Microsoft Corporation. On Computer: MY_COMPUTER

Commands and parameters

The diskpart tool has the following commands and parameters available:


Error Codes

You can find a list of error codes to debug various errors:

  • Code 0 means that no errors occurred
  • Code 1 means that a fatal exception occurred
  • Code 2 means that the parameters you specified for a command are incorrect
  • Code 3 means that diskpart is unable to open the specified file
  • Code 4 means that diskpart (one of the services used by the utility) returned a failure
  • Code 5 means a command syntax error

diskpart in Windows XP

Note that the fdisk utility found in pre-Windows XP systems is now known as diskpart on Windows XP systems.

If you can boot into Windows XP

If you can boot into your computer, you simply need to open Command Prompt to access diskpart:

  1. Boot into Windows XP
  2. Click Start
  3. Click Run
  4. Type cmd
  5. Press Enter or click OK
  6. At the Command Prompt window, type diskpart
  7. Press Enter

If you can't boot into Windows XP

If you can’t boot into Windows XP to access diskpart, you have 2 options:

  • Use the original CD to access Recovery Console

If you have the original CD:

If you can’t boot into Windows XP, but you have the original CD, you can access the Recovery Console:

  1. Insert the Windows XP CD
  2. Reboot the computer
  3. Press any key to boot from the CD
  4. At the Microsoft Setup menu, press R
  5. Select the operating system and enter the Administrator password, if requested
  6. When Command Line appears, type diskpart
  7. Press Enter

diskpart in Windows Vista

You need to run these steps as an Administrator on Windows Vista systems.

If you can boot into Windows Vista with no errors, . Otherwise, follow.

If you can boot into Windows Vista

You simply need to open Command Prompt, if you can boot into Windows Vista:

  1. Boot into Windows Vista
  2. Click Start
  3. Type cmd
  4. Click Command Prompt from the search results list. You may need to right-click Command Prompt > Run as Administrator, if you are not logged in as Administrator already
  5. Type diskpart
  6. Press Enter

If you can't boot into Windows Vista

If you can't boot into your system, you have the following options:

  • Use the installation disc to access System Recovery Options
  • Access System Recovery Options without the installation disc (if installed)

If you can’t boot into Windows Vista, but you have the Windows Vista disc, follow these steps to open diskpart:


For the full list of diskpart commands and parameters, go to .

If your Windows Vista has the System Recovery Options installed and is available at the Advanced Boot Options menu, you can run Command Prompt from there. Otherwise, see the “If you use Easy Recovery Essentials” set of instructions below.

Follow these steps below to access diskpart without the installation disc:

    1. Reboot the computer
    2. Press F8 as your computer starts to boot, but before the Windows Vista logo appears
    3. Select Repair Your Computer, at the Advanced Boot Options menu

If a “Repair Your Computer” option isn’t listed, System Recovery Options is not installed on your computer. Use the original installation disc or go to the “If you use Easy Recovery Essentials”set of instructions below .

For the full list of diskpart commands and parameters, go to .

If you use Easy Recovery Essentials:

If you don't have the installation disc available, can't boot into Windows Vista or you don't have the “Repair Your Computer” option listed at the Advanced Boot Options menu, you can use Easy Recovery Essentials to access Command Prompt and load diskpart.

Follow these steps:


diskpart in Windows 7

Note that you need to run these steps as an Administrator on Windows 7 computers.

If you can boot into Windows 7

If you can boot into your Windows 7 system, simply open Command Prompt:

  1. Boot into Windows 7
  2. Click Start
  3. Type cmd
  4. Click Command Prompt from the search results list. Right-click on Command Prompt > Run as Administrator.
  5. When Command Prompt loads, type diskpart
  6. Press Enter

For the full list of diskpart commands and parameters, go to .

If you can't boot into Windows 7

Similar to Windows Vista, if you can’t boot into your system, you have the following options:

  • Use the installation disc
  • Boot into the Advanced Boot Options menu to access System Recovery Options
  • Use Easy Recovery Essentials and access Command Line

If you have the installation disc:

If you can’t boot into Windows 7, but you have the installation disc, you can run diskpart using the disc. To do so, follow these steps:


diskpart
  1. Press Enter

For the full list of diskpart commands and parameters, go to .

If you don't have the installation disc:

Usually, Windows 7 systems should have the System Recovery Options installed on the hard drive. If it's not (follow steps below), go to the “If you use Easy Recovery Essentials” set of instructions below for an alternative to access diskpart.

Follow these steps to access diskpart without an installation disc on a Windows 7:


For the full list of diskpart commands and parameters, go to .

If you use Easy Recovery Essentials:


diskpart in Windows 8

If you can boot into Windows 8

If you can boot into your Windows 8 system, you simply need to open Command Prompt to access diskpart. To do so, follow these steps:

For the full list of diskpart commands and parameters, go to .

If you can't boot into Windows 8

If you can't boot into your Windows 8, you have these options available:

  • Use the original DVD or USB with Windows 8 or Windows 8.1 to access the Repair your computer option
  • Use Easy Recovery Essentials to launch Command Line

If you have the installation disc:


For the full list of diskpart commands and parameters, go to .

If you don't have the installation disc:

To access diskpart without an official Windows 8 or Windows 8.1 disc, follow these steps:


For the full list of diskpart commands and parameters, go to .

If you use Easy Recovery Essentials:

Easy Recovery Essentials can run from any CD, DVD or USB flash drives.

To access diskpart using Easy Recovery Essentials, follow these steps:


diskpart in Windows 10

If you can boot into Windows 10

If you can boot into your Windows 10 system, you simply need to open Command Prompt to access diskpart. To do so, follow these steps:

For the full list of diskpart commands and parameters, go to .

If you can't boot into Windows 10

If you can't boot into your Windows 10, you have these options available:

  • Use the original DVD or USB with Windows 10 to access the Repair your computer option
  • Boot into the System Recovery Options with Shift and F8
  • Use Easy Recovery Essentials to launch Command Line

If you have the installation disc:

If you can’t boot, but you have the installation disc, follow these steps:


For the full list of diskpart commands and parameters, go to .

If you don't have the installation disc:

If you don’t have the installation disc, you can boot into System Recovery Options or use Easy Recovery Essentials.

To access diskpart without an official Windows 10 media, follow these steps:


For the full list of diskpart commands and parameters, go to .

If you use Easy Recovery Essentials:

Easy Recovery Essentials can run from any CD, DVD or USB flash drives.

To access diskpart using Easy Recovery Essentials, follow these steps:


Troubleshooting

Download diskpart

You can not download diskpart utility. This utility is a command line utility part of Windows.

To access diskpart, you have the following options:

  • Use the original CD/DVD or USB of your Windows to access Recovery Console (for Windows XP) or System Recovery Options (for Windows Vista-8)
  • Boot into the recovery mode of your Windows
  • Use Easy Recovery Essentials, our recovery and repair disk, and open Command Line to access diskpart

Instructions on how to access diskpart if you use Easy Recovery Essentials:

  1. Download
  2. Burn the ISO Image. Follow. If you’d like to have a recovery USB instead, follow .
  3. Boot Easy Recovery Essentials from the CD, DVD or USB
  4. Select Launch Command Line

Instructions on how to access diskpart if you have the installation disc:

Instructions on how to access diskpart if you don’t have the installation disc:

Format USB with diskpart

To format a USB flash drive with diskpart, follow these steps:

  1. Open the utility by typing diskpart in Command Prompt
  2. Press Enter
  3. Once loaded type list disk: list disk
  4. Press Enter
  5. Determine which of the disks listed is your USB flash drive, e.g. Disk 2.
  6. Type select disk 2 , if #2 is the USB flash drive presented by the list disk command
  7. Press Enter
  8. Type clean to clean the USB flash drive: clean
  9. Press Enter
  10. Type this command: create partition primary
  11. Press Enter
  12. Type active: active
  13. Press Enter
  14. You should now receive this confirmation message: DiskPart marked the current partition as active.
  15. Type this command to format the USB flash drive: format fs=ntfs label="MY USB DRIVE"

    where ntfs is the NTFS file system (you can also use fs=fat32) and “MY USB DRIVE” is the label given to the USB drive.

  16. Type assign: assign
  17. Press Enter
  18. Quit diskpart by typing exit: exit
  19. Press Enter

Bootable USB with diskpart

To create a bootable usb using diskpart, follow the steps from .

Once successfully formatted the drive, simply copy the files to the USB drive.

USB not showing in diskpart

diskpart will not list external media, e.g. USB flash drive, if you’re using Windows XP.

Windows Vista to Windows 8 systems will show the USB flash drives in diskpart.

More Information

Support Links

  • – our repair and recovery disk.

    It’s an easy-to-use and automated diagnostics disk. It's available for , and . It’s also available for Windows XP and Windows Server.