Cannot delete partition in diskpart - invalid argument?

70,648

Invalid argument! I got it now.

There's no need to append the command with the partition number when the partition is already selected.

Instead of:

select partition 2
delete partition 2 override

Use this:

select partition 2
delete partition override

As simple as that...

Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. Med ensamrätt.

C:\Windows\system32>diskpart

Microsoft DiskPart version 6.2.9200

Copyright (C) 1999-2012 Microsoft Corporation.
On computer: SKANNING26

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          698 GB      0 B        *
  Disk 1    Online         3819 MB  3670 MB        *

DISKPART> select disk 1

Disk 1 is now the selected disk.

DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Primary             49 MB    64 KB
  Partition 2    System              98 MB    51 MB

DISKPART> select partition 1

Partition 1 is now the selected partition.

DISKPART> delete partition 1

The arguments specified for this command are not valid.
For more information on the command type: HELP DELETE PARTITION

DISKPART> delete partition

DiskPart successfully deleted the selected partition.

DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 2    System              98 MB    51 MB

DISKPART> select partition 2

Partition 2 is now the selected partition.

DISKPART> delete partition

Virtual Disk Service error:
Det går inte att ta bort en skyddad partition utan att parametern Tvinga skyddad
 har angetts.


DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
* Partition 2    System              98 MB    51 MB

DISKPART> delete partition override

DiskPart successfully deleted the selected partition.

DISKPART> list partition

There are no partitions on this disk to show.

DISKPART>

a

Share:
70,648

Related videos on Youtube

Samir
Author by

Samir

Tell me and I forget. Teach me and I remember. Engage me and I learn.

Updated on September 18, 2022

Comments

  • Samir
    Samir over 1 year

    I'm trying to delete a partition on a UFD using Diskpart. I am running it through an elevated CMD prompt. But the problem is it reports that I am using an invalid argument. Please see the log below.

    Microsoft Windows [Version 6.3.9600]
    (c) 2013 Microsoft Corporation. All rights reserved.
    
    C:\WINDOWS\system32>diskpart
    
    Microsoft DiskPart version 6.3.9600
    
    Copyright (C) 1999-2013 Microsoft Corporation.
    On computer: SKANNING24
    
    DISKPART> list disk
    
      Disk ###  Status         Size     Free     Dyn  Gpt
      --------  -------------  -------  -------  ---  ---
      Disk 0    Online          465 GB  1024 KB        *
      Disk 1    Online         3819 MB  3670 MB        *
    
    DISKPART> select disk 1
    
    Disk 1 is now the selected disk.
    
    DISKPART> list partition
    
      Partition ###  Type              Size     Offset
      -------------  ----------------  -------  -------
      Partition 1    Primary             49 MB    64 KB
      Partition 2    System              98 MB    51 MB
    
    DISKPART> select partition 1
    
    Partition 1 is now the selected partition.
    
    DISKPART> list partition
    
      Partition ###  Type              Size     Offset
      -------------  ----------------  -------  -------
    * Partition 1    Primary             49 MB    64 KB
      Partition 2    System              98 MB    51 MB
    
    DISKPART> delete
    
    Microsoft DiskPart version 6.3.9600
    
    DISK        - Delete a missing disk from the disk list.
    PARTITION   - Delete the selected partition.
    VOLUME      - Delete the selected volume.
    
    DISKPART> delete partition 1
    
    The arguments specified for this command are not valid.
    For more information on the command type: HELP DELETE PARTITION
    
    DISKPART> list partition
    
      Partition ###  Type              Size     Offset
      -------------  ----------------  -------  -------
    * Partition 1    Primary             49 MB    64 KB
      Partition 2    System              98 MB    51 MB
    
    DISKPART> select partition 2
    
    Partition 2 is now the selected partition.
    
    DISKPART> list partition
    
      Partition ###  Type              Size     Offset
      -------------  ----------------  -------  -------
      Partition 1    Primary             49 MB    64 KB
    * Partition 2    System              98 MB    51 MB
    
    DISKPART> delete partition 2
    
    The arguments specified for this command are not valid.
    For more information on the command type: HELP DELETE PARTITION
    
    DISKPART> help delete partition
    
        Deletes the partition with focus.
    
    Syntax:  DELETE PARTITION [NOERR] [OVERRIDE]
    
        NOERR       For scripting only. When an error is encountered, DiskPart
                    continues to process commands as if the error did not occur.
                    Without the NOERR parameter, an error causes DiskPart to exit
                    with an error code.
    
        OVERRIDE    Enables DiskPart to delete any partition regardless of type.
                    Typically, DiskPart only permits you to delete known data
                    partitions.
    
        You cannot delete the system partition, boot partition, or any partition
        that contains the active paging file or crash dump (memory dump) filed.
    
        A partition must be selected for this operation to succeed.
    
        Partitions cannot be deleted from dynamic disks or created on dynamic
        disks.
    
    Example:
    
        DELETE PARTITION
    
    DISKPART> list partition
    
      Partition ###  Type              Size     Offset
      -------------  ----------------  -------  -------
      Partition 1    Primary             49 MB    64 KB
    * Partition 2    System              98 MB    51 MB
    
    DISKPART> delete partition 2 override
    
    The arguments specified for this command are not valid.
    For more information on the command type: HELP DELETE PARTITION
    
    DISKPART>
    

    Q: What is the "argument" in this case? And why is it not valid?

    This is not the first time that I'm using Diskpart, I have used it several times before whenever there were special hidden recovery partitions on a disk drive that could not be removed with conventional disk tools like Diskmgmt.msc. So I'm pretty sure I got the syntax right and I am doing everything according to the help pages.

    I am working on Windows 8.1 and the UFD is a SanDisk Cruzer Blade 4 GB, brand new. I only had PassMark Memtest86 installed on it and that's about all I ever used it for. I have formatted the UFD today to remove Memtest86 from it (quick format in Explorer), but a hidden EFI partition was left on the UFD. See screenshot below.

    a

    • Samir
      Samir about 10 years
      This applies to both the EFI partition and the primary partition you see up in the screenshot. So could this be a general Diskpart problem? But deleting the primary partition in diskmgmt.msc is possible. But the option is not available for the EFI partition.
    • Samir
      Samir about 10 years
      So I didn't get the syntax right then, not really... well, I did but the partition number was redundant. Can someone please post a comment on how this is an "argument"?