DISKPART Basics. Creating partitions using DiskPart Diskpart does not see partitions

💖 Do you like it? Share the link with your friends

When trying to format a flash drive (less often a hard drive) using the “DiskPart” command interpreter, the user is faced with the error information “The DiskPart program has detected an error”, after which the reason for the error is often given (for example, “The media is write-protected”). In this article I will talk about the most common errors in Diskpart, and also explain how to fix them.

DiskPart encountered an error (access denied)

Mistake #1. Media is write protected

The user may encounter the message “The media is write protected” when trying to format their flash drive, while the latter may not have a special jumper for write protection (if there is one, just try switching it).

Solution #1

  1. Launch Command Prompt as Administrator and enter:
  2. DiskPart - and press enter.
  3. Then type: list disk press enter again.
  4. A list of disks available on the PC will be displayed; mark which letter the problem disk (flash drive) has.
  5. Type: select disk X - (instead of X, put the letter of the problem disk) and press enter.
  6. Type: attribute disk and press enter.
  7. You will be informed whether the problem disk has a “read only” status.

Here the flash drive has the status “Read only” (read only)

If yes, then type: attribute disk clear readonly and press enter. This status will be changed to “No”. Try formatting again required disk using DiskPart.

Solution #2

Click on the "Start" button, enter in the search bar regedit and press enter. Follow the path:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies - and set the “WriteProtect” parameter value there to 0 (zero).

If you don't find the "StorageDevicePolicies" branch endpoint, then you need to create one. Right-click on the previous step of the branch (Control) – “Create” – “Section”. Give the section a name " StorageDevicePolicies"(without quotes).


Right-click on the created section on the left - “Create” - “Dword parameter (32 bits)”. Rename the setting to "WriteProtect" (without quotes). Set its value to “0”, click on “Ok”, and close the system registry. Reboot your PC and try DiskPart again.

Mistake #2. Access denied

DiskPart detected an access denied error that usually occurs when you try to clean your flash drive using the diskpart "clean" command. In the error message, the system recommends viewing the logs, which may detail the cause of the problem.

Solution #1

View the system logs (Control Panel – System and Security – Administration – Event Viewer – Windows Logs – System). Perhaps the cause of the dysfunction will be indicated there, you will be able to identify and correct it.

Solution #2

Run the command line only as an administrator, and enter the “diskpart” command in it.

Mistake #3. DiskPart encountered an error: the parameter is set incorrectly

The parameter is set incorrectly error usually occurs in a situation where the disk file structure is damaged or the disk encryption driver in Windows OS has been changed.

Solution #1

Go to “My Computer,” hover over the problem disk, right-click, and select “Properties” from the menu that appears. In the menu that opens, go to the “Service” tab - “Run check”. Check both boxes and click on “Launch”.

Check your disk using CHKDSK

Solution #2

Download, install, and run the “Partition Guru” program Click on the problem disk, then click on the “File Recovery” button, and then on the “Start” button. Wait until the file recovery process completes.


Use Partition Guru to check your disk

Mistake #4. Error in CRC data

Occurs due to the presence of bad (bad) sectors on the device.

Solution

Use CKDSK as described above, or run “Partition Guru”, select the problem disk, select the “Disk” menu section, and in it “Verify Or Repair Bad Sectors” - “Start Verify”. When the check is completed, click on “Repair”.


Check for bad sectors on your disk using Partition Guru

Mistake #5. The request was not completed

Usually means hardware problems with the drive itself.

Solution

  1. If you have such problems with the flash drive, then go to Device Manager (click on the “Start” button, enter in the search bar devmgmt.msc and press enter).
  2. Find “USB Controllers” there, open the subsection by clicking on it, and uninstall all its contents (click on the first subdevice in the queue, press the right mouse button - Delete, and so on until you delete all the contents of “USB Controllers”).
  3. Then restart your computer and try again to start “DiskPart” and do what you intended.
  4. If it doesn’t help, then most likely your flash drive has a hardware failure.

Mistake #6. I/O device error

An I/O device error occurs when a device (flash drive or hard drive) cannot write or read data.

Solution

Check the hardware connection between the device and PC. If it is a flash drive, use a different USB connector; if it is a hard drive, check the cables and plugs, as well as the tightness of connecting the latter to the corresponding connectors.

Conclusion

The message “DiskPart has encountered an error” can be caused by a number of reasons, most of which are listed above. Please be specific about the problem and then follow the steps I have given, this will help you fix “DiskPart has encountered an error” on your PC.

Despite the fact that I have switched to Linux for several years now, sometimes I still have to install Windows for my friends and relatives.

To partition a disk for working with the system, you can use the DiskPart utility.

DiskPart is a console utility with an interface command line for working with disks (disk), partitions (partition) and volumes (volume). Developed by Microsoft for the Windows family of operating systems. Therefore, there should be much fewer problems, as, for example, when using software from Acronis, or Paragon. Has many more features than the GUI-based Disk Management snap-in. You can also launch DiskPart during Windows installations Vista/7/8, which will help in the future not to create an extra reserved partition of 100MB in size, which Windows creates automatically.

To open the console when starting the WIndows system installation mechanism, you must press the key combination Shift+F10.

Let's look at an example of disk partitioning during the installation of Windows 7. If you do formatting using the Windows Setup Wizard itself, it creates a 100 MB service partition, which to a simple user not needed! Therefore, it is better to use the utility and partition the disks yourself and install Windows on an already formatted active priority partition hard drive. If HDD there is only one in the computer, then it will be the priority. If there are several of them, then it is recommended to disconnect the extra disks while installing Windows. Or set the priorities correctly in the BIOS (UEFI).

Let's consider a situation in which the disk is empty, there is no data on it, or it is not important and can be deleted.

So, to launch DiskPart during Windows installation, at the first stage press Shift+F10 and get into the cmd command shell. Let's launch disk utility diskpart.

There is a help command in diskpart for general help, or for help on a specific command, use help command_name (for example, help clean).

Let's create a main partition for the system, and an extended partition in which there will be two logical partitions for data and for documents.

Let's look at the list of disks in the system:

Sel disk=system

or you can select the disk by number:

Sel disk N

Let's check that the correct disk has been selected:

or zeroing all sectors on the disk (the operation is very time-consuming - all sectors of the disk are written to zero)

Create part primary size=102400

Let's make it active (bootable):

Format fs=ntfs label=System quick

Let's create an extended partition for data and documents on the entire remaining disk space

Create part extended

Inside the extended partition, we will create a logical partition for data, 100 GB in size, for example, to store documents:

Create part logical size=102400

Let's format the partition in NTFS, assign the label "Docs", apply quick formatting:

Format fs=ntfs label=Docs quick

Let's connect this section to the system:

Let's create another logical disk, for example, to store media data for all the remaining free space:

Create part logic

Let's format (quickly) the partition in NTFS and assign it the "Media" label:

Format fs=ntfs label=Media quick

Let's connect this section to the system:

Let's see what happened. The system should show all created partitions on the disk:

Detail disk

If everything is successful, exit diskpart and the console:

If you encounter any difficulties while working with the diskpart utility, you can always use the help of this utility. Here are some commands that may be useful:

To view the list of partitions, you need to run the command:

List part

You can select the desired section with the command:

Sel part N

You can delete the selected partition with the command:

Del part

That's all! But, my many years of work on Linux systems shows that the era Windows already passed, although gamers can argue with me, because installing games here is still very problematic (I’m not into games, so this doesn’t bother me at all)

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.

Creating disks on a hard drive or burning a bootable USB flash drive is 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 original or transferred files. A special Windows algorithm cannot verify the integrity of user-specified software.

If this situation occurs when recording 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.

It often happens that many modern computers do not have a disk drive. This often causes difficulties, especially when you need to install a program with installation disk. Most often the problem occurs during installation or reinstallation operating system Windows 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 disk.

To create a bootable USB drive, or sometimes also called a bootable flash drive, using the “cmd” command line, you need to follow a simple two-step procedure. The first stage will involve using a standard utility called diskpart.

How diskpart works

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

With the rapid development of technology, everyone has access to the Internet, where they can find free versions various programs for creating a bootable flash drive. However, it also happens that there is no access to the Internet 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 be useful to every PC user. This console utility is included in the list standard programs . There is no need to additionally search for and install any other programs to configure a bootable flash drive. After ten minutes of use, diskpart is ready bootable flash drive with the Windows installation file.

Preparing a flash drive using diskpart

Diskpart- this 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 clearly. The Windows 8 operating system will be used as an example. On other versions of the operating system Windows systems, such as Windows 7 or Windows 10, the creation process will be identical.

Before starting work you must connect a portable disk or flash drive, or another removable media to the computer. Such a device will be further referred to as a flash drive.

Then press the Win + X key combination 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 menu item " Command Line (Administrator)».

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

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

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

After this, 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 that is a flash drive, it will be bootable (in the example, this is disk number 1); It is easy to distinguish a flash drive from other disks by its size;
  • clean– the disk will be cleaned, 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– the disk name will be assigned and the connection point will be assigned
  • exit– the operation is completed. This will exit the command line.

The first stage of creating a bootable flash drive is complete.

Copying files to a flash drive

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

This can be done using standard Windows tools"Explorer" type. If you want due to different possible reasons To do this using the same command line, the following commands will help you with this:

  • Improved copy command " robocopy", unlike the legacy "copy", can copy subfolders with all their contents. The first argument of the command is the path to the files to be copied, and the second is the path to the folder into which the files will be copied. To copy subfolders you need to add a third argument " /E", otherwise only the files will be copied. For example, to copy all the files from drive f to a flash drive named g: you need to enter the command: robocopy f:\ g:\ /E
  • Deprecated 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 of the command is the path to the files to be copied, and the second is the path to the folder into which the files will be copied. To make it clear to the command that you want to copy not just one file in a folder, but all files, specify the code “*.*” as the file name.
  • The disk change command, the format of which is: DISK: . Those. to go to drive “D:\” you need to 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 go to the parent folder, write cd ..
  • To view a list of files in the current folder, enter the command dir
  • To create a folder, run the command md <имя папки>

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

This is what it will look like if you copy 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 disk drive, you can use a virtual DVD drive and an image file.

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

Video on the topic



tell friends