DiskPart: Windows Commands

Let the name of this command and the use of the command console as such not be afraid. DiskPart commands (referring to the attributes entered along with the main line) allow you to use such powerful tools of Windows operating systems that are not available in standard mode.

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

DiskPart Commands: What is It and Why Are They Needed?

The most important purpose of this tool is that its use allows (based on their elementary understanding of reduction) to split hard drives into logical partitions.

diskpart command

However, if anyone does not know, creating a partition without formatting is impossible. And if it concerns the system partition, it must necessarily contain a boot record, thanks to which the operating system starts after checking the hardware in the BIOS.

But the capabilities of any DiskPart command are not limited to this. The point here is that even when restoring a system from the console or command line when booting from removable media, this tool allows you to fix many problems that can not be fixed with conventional tools.

So, for example, sometimes even at the stage of installing the OS it may be necessary to convert the partition into which it will be installed (most often this is connected with booting from USB-drives or choosing hard drives with a capacity of more than 2 TB). Typically, the system displays a message stating that installation into the selected GPT partition is not possible because there is no support for the MBR boot record.

diskpart is not an internal or external command

You can get rid of this quite simply using the BIOS settings with the choice of a drive on which there is no EFI label.

But what if the selected partition really has the GPT format, although it does not exceed a capacity of 2 TB? In this case, the DiskPart conversion commands from GPT to MBR are used.

And partitioning 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.

Retrieving Feature and Attribute Information

To use this toolkit, you will initially 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 for all other tools of the system, you can simply register the name of the command itself, and then enter a question mark ( diskpart /? ) After a space and the right slash. All attributes available for use are displayed on the screen. But in this case, we are only interested in some of them.

Script support

In the simplest version, choosing a partition in DiskPart command is quite simple. To partition the selected partition, use the create partition logical size = XXXXXX line , where XXXXX is the size of the created logical disk in megabytes.

diskpart conversion command from gpt to mbr

Naturally, the system should see the section marked with a certain letter in the file manager. To do this, the assign letter = X command is used, where X is an unused letter. 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-ROM drive, then either they will not work later, or the created partition will be inactive.

Previous DiskPart Windows Commands

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

There is no question about any formatting with the choice of a file system. But in Windows 7 and above, this problem has been eliminated through the use of disk and partition formatting tools, which was initially included in the program, even with support for mobile OS.

The simplest algorithm for using the console command

Now about the practical use of this tool. Initially, the command line is called. If it starts in a running system, it is mandatory to start on behalf of the administrator. If we are talking about the recovery console when booting from external media, this does not matter.

diskpart windows commands

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

command to select a partition in diskpart

The clean line deletes the entire contents of the partition, then the create partition primary create entry primary command is used, then the select partition 1 line is displayed (indicating the number of the created partition), then the partition is activated by the active line and finally formatting is done - format fs = ntfs , if necessary it is this file system.

But the above command does full formatting. If you don’t feel like wasting time, you can add quick at the end of the line, which corresponds to fast formatting.

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

Possible errors and failures

But not everything happens so smoothly. Sometimes you may encounter situations when the system displays a message that DiskPart is not an internal or external command. This can be observed when starting the boot from removable media when choosing the GPT partition (by the way, checking the disk as a combination of chkdsk is not safe from this). What to do in this case?

diskpart command

Here the input of cleaning and conversion ( clean and convert mbr ) after the line to select a disk ( select disk ) will help. Allegedly, this process can take several hours, but it works, as they say, one hundred percent. But to use such a tool is necessary 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 to observe the input sequence from the algorithm described above, naturally, 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 the issues of formatting or eliminating some critically dangerous failures. But that is another topic.


All Articles