Internet Windows Android

Diskpart fast formatting. Basic DISKPART Commands

DiskPart is a tool for working with disks, partitions and volumes in the Windows operating system. With DiskPart, you can perform important operations such as converting disk types, creating partitions and volumes, and configuring RAID arrays. In addition, DiskPart is used to configure automatic mounting of new disks in the file system, to assign letters to disks and paths connected network drives... However, DiskPart is not designed to format drives. For this purpose, the FORMAT command is used.

Running the DISKPART utility

DiskPart works with physical hard drives installed in your computer. CD / DVD drives, removable media, or USB flash drives are not supported. Before using the DiskPart commands, you must enumerate and then select the disk, partition, or volume that you want to work with to give it focus. When a disk, partition, or volume is in focus, any Disk-Part commands affect that particular disk, partition, or volume.

Basic DISKPART Commands

The following commands are assigned to list the available disks, partitions and volumes:

  • list disk- Lists all the physical hard drives of the computer;
  • list volume- lists all disk volumes (including partitions hard disk and logical drives);
  • list partition- lists the partitions on the disk in focus.

When using the list commands, an asterisk (*) appears in focus next to a disk, volume, or partition. You select a disk, volume, or partition by its number or drive letter, for example disk 0, partition 1, volume 2, or volume D.

When you are finished with DiskPart, enter exit at the DiskPart command prompt to return to the standard command prompt.

Examples of using DiskPart

To understand how to work with DiskPart, consider the following example, where DiskPart starts, lists the available disks, and sets the focus to disk 2.

  1. To run DiskPart, enter diskpart at the command line.
  2. The command line will look like this: DISKPART>
  3. This indicates that the DiskPart interpreter is running. To list the available disks, enter list disk at its command line.
  4. The list contains available disks, their status, size and free space: Disk ## * Status Size Free Dyn GptDisk 0 Online 56 GB OB Disk 1 Online 29 GB OB Disk 2 Online 37 GB 33 GB
  5. Since you are going to work with disk 2, you must give it focus by entering the command select disk
  6. DiskPart will report: Disk 2 is now the selected disk
  7. When you are finished with the disk, enter exit at the command line to exit DiskPart.

Today I want to tell you about such a wonderful program as. What's so great about her? - you ask. And the fact that it can be used (data from a flash drive after formatting) or a disk, and the most interesting thing is that this program is available to any Windows user through the command line, in other words, it does not require installation. And don't be afraid of the phrase “ command line”- using it is much more convenient and easier than it seems at first glance.


So, after we inserted the flash drive into the USB connector, we launch the command line. To do this, click Start and in the search bar we write cmd, and press Enter.

In the command line that appears, we write, thereby launching the disk management program. Push Enter.

In the list of devices we find our USB flash drive - it can be recognized by its size. In my case it is Disc 6... Therefore, further we write the command. If your flash drive is number 4, then you need to enter the command. If under the number 2, then, respectively. Push Enter.

Then we enter the command clean, which will delete all files from a flash drive or disk. Push Enter.

Then we enter the command. Thus, we select the specified section and move the focus to it. Push Enter.

Then we execute the command. The system marks the partition as active. Push Enter.

Now it is necessary. It can be fast or complete. Full formatting is done with the command format fs = NTFS... If you don't want to wait and time is running out, then we do a quick formatting with the command format fs = NTFS QUICK... Push Enter.

We are waiting for the end of the formatting.

Now you need to assign a letter to the USB flash drive. We do this using the command assign... We press Enter.

A letter is automatically assigned to the USB flash drive, and after that, the media autorun is triggered.

Now you can exit the program. Enter the command exit and press Enter.

The last thing to do is to copy the files of the operating system distribution kit (the one for which we made a bootable USB flash drive) onto our flash drive. After that, our flash drive will be bootable, and will boot absolutely everywhere, on any device. With its help, it will be possible to install your operating system anywhere.

I want to note that with the help of the program, you can carry out a lot of manipulations with both hard disks () and flash drives. The example considered today is only a small part of all the possibilities. I will consider other commands and examples of working with this program in the following articles.

Also read on this topic:

Formatting a flash drive to NTFS
How to recover data from a USB flash drive after deleting or formatting? How to change disk size in Windows 2000 / XP / Vista / 7/8. Free software EaseUS Partition Master Free How to create a bootable UEFI USB stick for Windows installations 8.1 vs 10?
How to freeze a row in Excel? How to create a disk image from using Daemon Tools?

It often happens that many modern computers do not have a floppy drive. This often causes difficulties, especially when it is necessary to install a program with installation disk... The most common problem occurs when installing or reinstalling the Windows operating system on such a computer. To avoid such problems, it is proposed to create bootable usb drive which will perform all functions exactly like the installation disc.

To create a bootable usb-drive, or sometimes it is also called a bootable flash drive using the command line "cmd", you need to follow a simple two-step procedure. The first stage will involve the use of standard utility entitled diskpart.

How diskpart works

Creating a bootable flash drive via the console utility diskpart is a fast and affordable way. Due to the fact that this utility works in text mode, each user personal computer easily cope with such a task.

With the rapid development of technology, everyone has access to the Internet, where you can find free versions various programs for creating a bootable flash drive. However, it also happens that there is no Internet access due to some circumstances, so it is important to know a few simple alternative ways creating a bootable flash drive.

One of them is the described method using the command line. This manual method will come in handy for every PC user. This console utility is listed standard programs ... There is no need to additionally search and install any other programs for setting up a bootable flash drive. After ten minutes of using diskpart is ready bootable USB drive with the Windows installation file.

Preparing a USB flash drive using diskpart

Diskpart Is a console system program included with Windows, through which you can manage disks, partitions and volumes by directly entering commands.

Creating a bootable flash drive using the command line will be shown visually. As an example, we will use operating system Windows 8. On other versions of the Windows operating system, such as Windows 7 or Windows 10, the creation process will be identical.

Before starting work, you must connect a portable drive or flash drive, or other removable media to your computer. Such a device will hereinafter be referred to as a flash drive.

Then press the key combination Win + X or right-click in the lower left corner of the screen. For those who still know what this Win button is, we remind you:

Select the menu item " Command Line (Admin)».

If it is more convenient for you to call the window " Execute"Using Win + R, you can do this by typing in the window that opens" cmd»And clicking OK. These actions will lead to a similar result.

In the window that opens, enter diskpart and press the Enter key.

Of course, it is more likely that the need to create a flash drive will arise not from the operating system, where there are simpler and convenient ways and from a clean command line during a PC restart.

After that, you need to enter the data in the same way as shown in the picture below. After each command entered, press the Enter key.

  • list disk- a list of available disks will be displayed;
  • select disk #- instead of # enter the number of the disk, which is a flash drive, it will be bootable (for example, this is disk number 1); it is easy to distinguish a USB flash drive from other disks by its size;
  • clean- the disk will be erased, all previous information will be deleted
  • create partition primary- a special section is created
  • active- the section is activated
  • format fs = ntfs quick- the disk will be formatted
  • assign- a disk name will be assigned and a mount point assigned
  • exit- the operation is completed. The command line is exited.

The first step of creating a bootable flash drive is now complete.

Copying files to a USB flash drive

The next step will be copying installation files programs to a flash drive. You need to copy all files completely with all structure and directories.

This can be done using standard Windows tools such as "Explorer". If you want by virtue of different possible reasons to do this using the same command line, then the following commands will help you with this:

  • Improved copy command “ robocopy", Unlike the outdated" copy "can copy subfolders with all their contents. The first argument to the command is the path to the copied files, and the second is the path to the folder to which the files will be copied. To copy subfolders, add the third argument “ / E", Otherwise only the files will be copied. For example, to copy all files from drive f to a flash drive named g: you need to enter the command: robocopy f: \ g: \ / E
  • The obsolete file copy command " copy", Using which you can copy only files (folders will have to be created manually with the" md "command). The first argument to the command is the path to the copied files, and the second is the path to the folder to which the files will be copied. To make it clear to the command that you want to copy not one file in a folder, but all files, specify the code "*. *" As the file name.
  • Disk change command, the format of which is: DISK: ... Those. to go to the "D: \" drive, enter the following command: d:
  • To select a directory located in the current folder, enter cd <имя директории>for example: cd win10
  • To go to top level file hierarchy enter cd \
  • To navigate to the parent folder, write cd ..
  • To view a list of files in the current folder, enter the dir command
  • To create a folder, run the command md <имя папки>

Knowledge of these commands is enough to successfully copy files to a USB flash drive.

This is how it will look for the case of copying the installation files located on the d: \ win10 drive and a flash drive named "G: \". Preparation and launch robocopy:

After a certain time, all files will be successfully copied:

Most often, a bootable flash drive is used to install or reinstall an operating system. If you don't have a drive, you can use the virtual DVD drive and the image file.

When installing the operating system from a bootable flash drive, you must change the settings in the BIOS so that the computer boots through this particular device.

Related Videos

The topic of compressing a volume or disk partition in Windows was touched upon. Here I want to show you how you can use unallocated disk space and create a new volume or partition using the Disk Management tool or using the command line.

How to create a new volume or partition through Disk Management

Open the Disk Management tool. To do this, open the Run dialog (Win + R), enter the command diskmgmt.msc and press Enter.

Right click on the unallocated space and click Create Simple Volume.

On the New Simple Volume Wizard, click Next.

Enter the amount of space that you want to use for the new volume (or partition) and click Next.

In the next step, you can change the formatting options, but this is not necessary, especially if you are satisfied with the default settings. Additionally, you can change the volume label to any name of your choice, but it is better to use something descriptive: for example, "Movies", "Documents", " Backups"Etc. Also you can enable the option to compress files and folders. When all settings are selected, click "Next".

Review the selected options. If you want to change anything, click Back to return to the previous steps. If everything suits you, click "Finish".

After that, a new partition should be successfully created on your computer.

How to create a new volume or partition via the command line

Open a command prompt with administrator rights.

Enter diskpart and press Enter.

In the DISKPART line enter list disk... This command will list the drives on your PC. It will also help you determine the number of the disk with unallocated space.

Now enter the command select disk with the volume number and press Enter: for example, selectvolume 0.

Advice: you can manually specify the size of the new partition. To do this, add size = x to the create partition primary command (where x is the size of the partition in megabytes). The whole command will look like this: create partition primary size = 1000

Now that the partition has been created, enter the command list volume and press Enter. As a result, you will see a volume (in my case, volume 3) with a RAW file system. However, it would be more correct to say that this is a volume without file system.

Next, you need to format the partition to NTFS file system. Enter the command format fs = ntfs quick(where quick Is an indication of what should be used quick way format) and press Enter.

You have just successfully created and formatted the partition. The last thing to do is assign a drive letter for the new partition. This is also a fairly simple task.

Enter the command list volume, pay attention to the number of the new section and enter the command select volume, not forgetting to indicate the section number. For example, in my case, the command will look like this: select volume 3.

You now have two options to assign a drive letter: you can simply enter the command assign, but then the DiskPart tool will automatically assign one of the available letters for the new partition (this is what is shown in the screenshot below); or you can enter the command assign letter = f, where f Is the drive letter. If you choose the second option, make sure the drive letter you want to assign is not already assigned to another drive.

That's all! Everything written above works in Vista, Windows 7 and 8.x.

Have a great day!

Do not be intimidated by the name of this command and the use of the command console as such. DiskPart commands (meaning attributes entered with the main line) allow you to use such powerful operating Windows systems that are not available in standard mode.

For what this tool is used 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 elementary understanding of abbreviation) to partition hard drives into logical partitions.

However, if someone does not know, it is impossible to create a partition without formatting. And if it concerns system partition, in it in mandatory there must be a boot record, thanks to which the operating system starts after checking the "hardware" in the BIOS.

But the possibilities of any DiskPart command are not limited only to this. The fact is that even when restoring the system from the console or the command line when booting from removable media, this tool allows you to eliminate many problems that cannot be fixed with conventional means.

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

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

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

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 when installing an additional hard drive for RAID arrays) comes to the fore.

Getting information about features and attributes

For use this toolkit initially you need to call the command console. Like it or not, this built-in utility works exclusively in this way.

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

Script support

In the simplest version, the command allows you to select a partition in DiskPart quite simply. To split the selected section, use the line create partition logical size = XXXXXX, where XXXXX- the size of the created logical drive in megabytes.

Naturally, the system should see the section marked with a certain letter in file manager... To do this, use the command assign letter = X, where NS is an unused letter. This means that if you assign a new section, 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 the modifications of Windows-systems up 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 or delete disks.

There is no question about any formatting with the choice of the file system. But in Windows 7 and above, this problem is eliminated by using the disk and partition formatting tool originally included in the program, and even with support for mobile operating systems.

The simplest algorithm for using the console command

Now about practical use this tool. The command line is invoked initially. If it runs on a running system, be sure to start 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 in the system. The command for selecting a partition in DiskPart looks like this: select disk X, where X- the number of the partition or disk indicated when viewing all available ones.

Line clean deletes all contents of the partition, then use the command to create the 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 the formatting is done - format fs = ntfs if you need this particular file system.

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

Now the matter is small. 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 can come across situations when the system displays a message that DiskPart is not an internal or external command. This can be observed when you start booting from removable media when you select a GPT partition (by the way, checking the disk in the form of a combination chkdsk not immune from this). What to do in this case?

This will help input cleaning and transforming ( clean and convert mbr) after the disk selection line ( select disk). As stated, this process can take several hours, but it works, as they say, 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, the DiskPart commands do not present anything difficult to use. The most important thing here is observance of the input sequence from the algorithm described above, of course, taking into account some additional parameters... And note that 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 critical failures. But that is another topic.