I use the following diskpart.exe sequence. I want to specify the disk number and then format the disk.
C:\>diskpart Microsoft DiskPart version 10.0.18362.1 Copyright (C) Microsoft Corporation. On computer: AAAAAAA DISKPART> select disk 2 Disk 2 is now the selected disk. DISKPART> clean DiskPart succeeded in cleaning the disk. DISKPART> create partition primary DiskPart succeeded in creating the specified partition. DISKPART> format fs=ntfs label="My USB Disk" quick There is no volume selected. Please select a volume and try again. DISKPART> As you can see, the script should work and might on Windows 7, as several pages searched on the internet says that, but on my Windows 10 installation I get
There is no volume selected
This article does not apply. The author really did forget the create primary partition. Ditto here.
As you can see from this screenshot, there definitely is a volume on Disk 2.
My USB flash drive has a single volume, so format should work.
Thoughts?
2 Answers
The code is almost correct, but here is the fragment that is missing. Modify it according to your needs.
create partition primary select partition 1 active format fs=ntfs label="My USB Disk" quick assign letter=D 2I ran into this same issue, and for the record, it worked after a reboot (it wouldn't let go of the disk to format it) and trying in CMD rather than Powershell. This worked:
- Run CMD
- Type "diskpart" and hit enter
- In the diskpart window, type "list disk" and hit enter
- Note the disk number of your USB device to use later
- Type "sel dis 1" changing out the number 1 for whatever number your USB device was in step 4. Hit enter
- Type "clean" and hit enter
- Type "cre par pri size=30000" and hit enter
- Type "sel par 1" and hit enter
- Type "active" and hit enter
- Type "format fs=fat32 quick" and hit enter
- Type "assign" and hit enter
- Close the diskpart and CMD windows.
I'm trying to prepare a 50+GB USB stick as a <32GB FAT32 partitioned boot device.
1