Билайн

Командная строка как инструмент для форматирования флешки. Команды утилиты Diskpart Diskpart команды создания разделов

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 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 paremeters, 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 paremeters, 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 paremeters, 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 paremeters, 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 paremeters, 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 paremeters, 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 paremeters, 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 paremeters, 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 paremeters, 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 paremeters, 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 paremeters, 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.

При попытке форматирования флеш-накопителя (реже жёсткого диска) с помощью командного интерпретатора «DiskPart», пользователь встречается с информацией об ошибке «Программа DiskPart обнаружила ошибку», после чего часто приведена причина ошибки (например, «Носитель защищён от записи»). В данной статье я расскажу о наиболее частых ошибках в работе «Diskpart», а также поясню, как их исправить.

Программа DiskPart обнаружила ошибку (отказано в доступе)

Ошибка №1. Носитель защищен от записи

Пользователь может встретить сообщение «Носитель защищён от записи» при попытке форматирования своей флешки, при этом последняя может не иметь специальной перемычки для защиты от записи (если таковая имеется, просто попробуйте её переключить).

Решение №1

  1. Запустите командную строку от имени администратора, введите там:
  2. DiskPart — и нажмите на ввод.
  3. Затем наберите: list disk вновь нажмите на ввод.
  4. Высветится список имеющихся на ПК дисков, отметьте какую букву имеет проблемный диск (флешка).
  5. Наберите: select disk X — (вместо X поставьте букву проблемного диска) и нажмите на ввод.
  6. Наберите: attribute disk и нажмите ввод.
  7. Вам высветится информация, имеет ли проблемный диск статус «read only» (только чтение).

Здесь флеш-накопитель имеет статус «Read only» (только чтение)

Если да, то наберите: attribute disk clear readonly и нажмите ввод. Данный статус будет изменён на «No» (нет). Попробуйте вновь отформатировать нужный диск с помощью DiskPart.

Решение №2

Нажмите на кнопку «Пуск», в строке поиска введите regedit и нажмите на ввод. Перейдите по пути:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies — и поставьте там значение параметра «WriteProtect» на 0 (ноль).

Если вы не обнаружите конечный пункт ветки «StorageDevicePolicies», тогда вам необходимо его создать. Правый клик мыши на предыдущей ступени ветки (Control) – «Создать» — «Раздел». Имя разделу дайте «StorageDevicePolicies » (без кавычек).


Правый клик мыши на созданном разделе слева – «Создать» — «Параметр Dword (32 бита)». Переименуйте параметр на «WriteProtect» (без кавычек). Установите его значение на «0», нажмите на «Ок», и закройте системный реестр. Перегрузите ПК и попробуйте вновь выполнить DiskPart.

Ошибка №2. Отказано в доступе

Программа DiskPart обнаружила ошибку отказано в доступе обычно возникает, когда вы пробуете очистить вашу флешку с помощью diskpart-команды «clean». В сообщении об ошибке система рекомендует просмотреть логи, в которых может быть детализирована причина проблемы.

Решение №1

Просмотрите логи системы (Панель Управления – Система и Безопасность – Администрирование – Просмотр Событий – Журналы Виндовс – Система). Возможно там будет указана причина дисфункции, вы сможете её выявить и исправить.

Решение №2

Запускайте командную строку только от имени администратора, и уже в ней вводите команду «diskpart».

Ошибка №3. Программа DiskPart обнаружила ошибку параметр задан неверно

Ошибка параметр задан неверно обычно возникает в ситуации, когда файловая структура диска повреждена или изменён драйвер шифрования (encryption driver) диска в ОС Виндовс.

Решение №1

Перейдите в «Мой компьютер», наведите курсор на проблемный диск, нажмите правую клавишу мыши, в появившемся меню выберите «Свойства». В открывшемся меню перейдите во вкладку «Сервис» — «Выполнить проверку». Поставьте обе галочки и нажмите на «Запуск».

Выполните проверку диска с помощью CHKDSK

Решение №2

Скачайте, установите, и запустите программу «Partition Guru » Кликните на проблемный диск, затем нажмите на кнопку «File Recovery», а потом на кнопку «Start». Дождитесь окончания процесса восстановления файлов.


Используйте программу «Partition Guru» для проверки диска

Ошибка №4. Ошибка в данных CRC

Возникает по причине наличия на устройстве битых (плохих) секторов.

Решение

Используйте CKDSK как было описано выше, или запустите «Partition Guru», выберите проблемный диск, выберите раздел меню «Disk», а в нём «Verify Or Repair Bad Sectors» – «Start Verify». Когда проверка закончится, нажмите на «Repair».


Проверьте наличие на диске битых секторов с помощью «Partition Guru»

Ошибка №5. Запрос не был выполнен

Обычно означает аппаратные проблемы с самим накопителем.

Решение

  1. Если у вас возникли такие проблемы с флеш-накопителем, тогда перейдите в Диспетчер устройств (нажмите на кнопку «Пуск», в строке поиска введите devmgmt.msc и нажмите ввод).
  2. Найдите там «Контроллеры USB», откройте подраздел кликнув на него, и деинсталлируйте всё его содержимое (кликайте на первое в очереди субустройство, жмёте правую клавишу мыши – Удалить, и так пока не удалите всё содержимое «Контроллеры USB»).
  3. Затем перегрузите компьютер, и вновь попытайтесь запустить «DiskPart» и выполнить намеченное.
  4. Если не помогло – то скорее всего ваш флеш-накопитель аппаратно неисправен.

Ошибка №6. Ошибка I/O устройства

Ошибка I/O устройства возникает в ситуации, когда устройство (флешка или жёсткий диск) не может выполнить запись и считывание данных.

Решение

Проверьте аппаратное соединение между устройством и ПК. Если это флешка – используйте другой разъём ЮСБ, если жёсткий диск -проверьте шлейфы и штекеры, а также плотность подключения последних к соответствующим разъёмам.

Заключение

Появление сообщения «Программа DiskPart обнаружила ошибку» может быть вызвано рядом причин, большинство из которых перечислены мной выше. Конкретизируйте проблему, а затем выполните указанные мной действия, это поможет исправить «Программа DiskPart обнаружила ошибку» на вашем ПК.

Как создать загрузочную флешку (Диск) Утилита diskpart. 4 часть / Создаем загрузочную флешку (Диск). Утилита diskpart. 4 часть

Утилита diskpart

Добрый день уважаемые читатели блога сайт, сегодня хочется рассказать, что позади трилогия статей ( ) нужно брать новые высоты и знакомить вас с другими подходами не требующими установки дополнительного ПО, сегодня темой рассказа будет как создать загрузочную флешку (Диск) Утилита diskpart. 4 часть / Создаем загрузочную флешку (Диск). Утилита diskpart. 4 часть

Ну приступим, первое что делаем это открываем командную строку cmd

Вводим команду .

скачать diskpart

дисков командой disk list .

Видим, что наш диск это номер 6

Теперь создадим раздел с помощью create partition primary. Нажимаем Enter.

Потом вводим команду select partition 1. Таким образом выбираем указанный раздел и перемещаем на него фокус. Нажимаем Enter.

Затем выполняем команду active . Система помечает раздел как активный.

Форматируем . format fs=NTFS . Если не хочется ждать и время поджимает, то делаем быстрое форматирование командой format fs=NTFS QUICK

Сейчас необходимо присвоить флешке букву. Делаем это с помощью команды assign

После чего будет автозапуск флешки.

И командой exit мы выходит из утилитки.

Теперь берем и копируем содержимое установочного образа или диска на флешку, и получаем загрузочный носитель. Вот так просто и без дополнительный программ можно создать загрузочную флешку с windows.

Читайте далее Как создать загрузочную флешку с несколькими установщиками и утилитами с помощью утилиты Xboot. 5 часть / Утилита Xboot

Одним из способов отформатировать флешку является использование командной строки. Обычно к нему прибегают в случае, когда стандартными средствами это сделать невозможно, например, из-за возникающей ошибки. Как происходит форматирование посредством командной строки, мы рассмотрим далее.

Мы рассмотрим два подхода:

  • через команду «format» ;
  • через утилиту «diskpart» .

Их отличие в том, что ко второму варианту обращаются в более сложных случаях, когда флешка ни в какую не хочет форматироваться.

Способ 1: Команда «format»

Формально Вы проделаете все то же, что и в случае стандартного форматирования, но только средствами командной строки.

Инструкция в данном случае выглядит следующим образом:


При возникновении ошибки, можно попытаться проделать то же самое, но в «безопасном режиме» – так никакие лишние процессы не помешают форматированию.

Способ 2: Утилита «diskpart»

Diskpart – специальная утилита для управления дисковым пространством. Ее широкий функционал предусматривает форматирование носителя.

Чтобы воспользоваться данной утилитой, сделайте вот что:



Таким образом можно задать все необходимые настройки форматирования флешки. При этом важно не перепутать букву или номер диска, чтобы не стереть данные с другого носителя. В любом случае выполнить поставленную задачу несложно. Преимущество командной строки в том, что этот инструмент есть у всех пользователей Виндовс без исключения. Если у Вас есть возможность воспользоваться специальными программами для удаления, воспользуйтесь одной из тех, которые указаны в нашем уроке.