Format USB Disk Using DiskPart Yields "No volume selected" Error

16,268

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
Share:
16,268

Related videos on Youtube

Sarah Weinberger
Author by

Sarah Weinberger

Updated on September 18, 2022

Comments

  • Sarah Weinberger
    Sarah Weinberger over 1 year

    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.

    diskpart showing a single volume

    My USB flash drive has a single volume, so format should work.

    Thoughts?

  • vanblart
    vanblart about 3 years
    This worked perfectly for me - leaving out the size=30000 to create the partition as the full usb size :)
  • principal-ideal-domain
    principal-ideal-domain over 2 years
    After "active" it says "The selected disk is not a fixed MBR disk. The ACTIVE command can only be used on fixed MBR disks." What to do?
  • harrymc
    harrymc over 2 years
    @principal-ideal-domain: Create a new post with all the information about your setup.