DiskMgmt.msc does not allow you to delete EFI partitions.
I tried with WMI first.
wmic has a nice assoc mode that allows you to find associated classes like the logical drive association to physical partitions.
But lets start simple: physical partitions and logical drives.
C:\temp>wmic partition get DeviceID, DiskIndex, Index, Type
DeviceID DiskIndex Index Type
Disk #1, Partition #0 1 0 GPT: System
Disk #0, Partition #0 0 0 Installable File System
C:\temp>wmic logicaldisk get Caption, DriveType, FileSystem, ProviderName, VolumeName
Caption DriveType FileSystem ProviderName VolumeName
C: 3 NTFS
D: 5
These Associations:
They can be hard to use.
LogicalDisks are bound to a Partition, but a Partition does not need to have a Logical Disk.
I wanted the other way around: finding partitions not having a LogicalDisk association. But that does not seem to be possible with WMI at all.
Heck, detecting EFI partitions with WMI seems to be impossible.
DiskPart
Even though there needs to be a 15 second delay between DiskPart invocations:
you must allow at least 15 seconds between each script for a complete shutdown of the previous execution before running the DiskPart command again in successive scripts
it seems to be the only way to go.
But it is hard, as there seems to be no way to convert from volume (which lists the EFI partition as ESP), to disk+partition.
So a way to automate what How to delete a protected EFI disk partition with Windows 7 or 8 | WinAbility Software describes seems impossible.
Any thoughts on that?
This is what I have done so far
- diskpart
- list volume
- now note the volume that has ESP
- list disk
- for each disk
- select disk #
- list disk
- to confirm you selected the correct disk
- list partition
- select partiton #
- list partition
- to confirm you selected the correct partition
- list volume
- to confirm the partition indeeds corresponds to the EFI volume
- delete partition override
- list volume
- list partition
- for each partition coming after the EFI partition
- select partition #
- list partition
- to confirm
- delete partition
- list partition
- to confirm
Now you can create a new partition on the disk.
–jeroen
via:
Like this:
Like Loading...