Whenever you try deleting a protected partition using the Diskpart Command-line Interface (CLI), it will show an error message saying “Can’t delete a partition without the force protected parameter set.” It is a protection feature on Windows that prevents accidental deletion of the drives that are essential to run the operating system.
The protected partitions where this feature applies include:
- Recovery Partition
- System or EFI System Partition (containing the boot files and the bootloader)
- Boot Partition (containing the operating system files)
- Page File Partition (containing the virtual memory
pagefile.sys
)
You can check for the type of partition in Disk Management (diskmgmt.msc
on Run) and go to the relevant solution if you really need to delete this partition.
If the partition doesn’t fit any criteria or is only a basic data partition, it is likely a heavily corrupted partition or a corrupted disk. In such cases, you can either try clearing the whole disk and then formatting it. If it still doesn’t resolve the issue, you need to replace the disk altogether.
Use Override Attribute With Delete Partition
It is possible to delete the recovery partition through Diskpart. However, you need to use the parameter override
to force the deletion. The complete process goes like this:
- Open the Diskpart command line by entering
diskpart
on Run (Windows key + R). - Then, type the following commands one by one and press Enter after each:
list disk
(look for the number of the disk you want)select disk #
(replace # with the number from above)list partition
(same as for disk)select partition #
(replace # with the appropriate number)delete partition override
exit
Change Pagefile Location
If you try deleting the current pagefile partition on Diskpart, even with the override function, you’ll get the message- “Delete is not allowed on the current boot, system, pagefile, crashdump, or hibernate volume.” But you’ll also get the same message if the partition is the boot or system volume. So, first, try checking whether it is the pagefile partition or not.
The pagefile partition stores a pagefile.sys
file that reserves the space your system uses as virtual memory. It is a hidden OS file, so you should first unhide all protected system files.
- Open Run by pressing Windows key + R.
- Type
control folders
and press Enter to open File Explorer Options. - Go to the View tab.
- Check Show hidden files, folders, and drives.
- Uncheck Hide protected operating system files.
- Click OK.
Then, open that partition or drive through your file explorer and see if you can see the pagefile.sys
file there. If so, you need to change its location so that you can delete the partition.
- Open Run.
- Type
systempropertiesadvanced
and press Enter to open the Advanced tab of System Properties. - Click on Settings under Performance.
- Go to the Advanced tab and select Change under Virtual Memory.
- Uncheck Automatically manage paging file size for all drives.
- Select the partition with the pagefile, check No paging file, and click Set.
- Then, select another partition with enough empty space and check System managed size. It’s better to use an SSD partition or the partition with the OS.
- Click Set and then OK > OK > OK.
- Restart your PC to apply the change and then try deleting the partition you want.
Change Boot Partition
Now, you need to check whether the partition of your partition is the boot partition. You can do so from the Disk Management utility.
- Open Run.
- Type
diskmgmt.msc
and press Enter to open Disk Management. - Look for the relevant disk and partition on the lower panel.
- If the partition shows System or EFI System Partition, it is the current boot partition. System indicates a legacy bootloader partition and EFI System Partition indicates an EFI bootloader partition.
If the partition with the bootloader exists on the same disk as the OS, don’t try deleting it as it is an essential partition. If it exists on another disk and there is no other boot partition, you need to create a new boot partition on your primary disk to be able to delete this partition.
- First, you need to create a 100-250 MB partition on the other disk (the same disk that contains the OS is recommended). On Disk Management, right-click on the OS partition (that shows boot) and select Shrink Volume. Type 100-250 and click Shrink.
- Then, create a Windows installation media and boot using the disk.
- On the Install screen, press Shift + F10 to open the Command Prompt.
- Enter the commands below depending on whether you need to recreate the legacy boot partition or the EFI system partition (same as earlier).
To create an EFI partition on a GPT disk:
diskpart
list disk
(note down the disk number of the disk with the newly created partition by checking the size)select disk #
(replace # with the number from above)create partition efi
list volume
(Note the partition number of the newly created partition by checking the size. Also, check the drive letter of the partition with the OS as it may not be C: here)select volume #
(replace # with the appropriate number)format fs=fat32 quick
(you can’t use ntfs)assign letter=S:
(or any unused drive letter)exit
bcdboot C:\Windows /s S: /f UEFI
(replace C: with the drive letter of the partition with the OS that you got fromlist volume
)
To create a legacy boot partition on an MBR disk:
diskpart
list disk
(note down the disk number of the disk with the newly created partition by checking the size)select disk #
(replace # with the number from above)create partition primary
list volume
(Check the partition number of the new partition by looking at the size. Then, check the drive letter of the partition with the OS as it may not be C: here)select volume #
(replace # with the partition number of the newly created partition)active
format fs=ntfs quick label="System Reserved"
assign letter=S
: (or any unused drive letter)exit
bootrec /fixmbr
(to make sure the partition has a valid Master Boot Record)bcdboot C:\Windows /s S:
After that, try deleting the old boot partition on the other disk.
Clear Whole Disk
If you are trying to wipe the entire drive, you can use the clean command in diskpart to remove all contents of the drive including the protected partition. Also, if you have more than one boot partition on two separate disks, then you may need to clear the whole disk to delete that partition.
- Open Run.
- Type
diskpart
and press Enter to run this CLI. - Type the following commands and press Enter after each to execute them:
list disk
select disk #
(replace # with the relevant disk number)clean
create partition primary
select partition 1
format fs=ntfs quick
assign letter=
S: (replace S with any unused drive letter you want)