Is there a way to avoid creating a Recovery partition?

seezoo

New Member
Messages
19
Reaction score
2
Is there a way to avoid creating a recovery partition when doing a clean install of Windows 11?
 
You must create an Unattended disk layout which wipes the disk, and doesn't create a Recovery partition.

For a licensed copy of NTLite:

1. From the toolbar, click on Configure disk / Disk template to open the disk layout wizard.
2. Select Operating system, and click on the double-arrows to extend the disk.
3. Select Recovery image, and enter a size if 0.

View attachment 11997


For the free edition:

1. From the toolbar, click on Configure disk / Individual partition.
2. Create three partitions in a row, using this table:

Partition IDGPT (UEFI)Wipe diskTypeSizeDrive letterInstall to partitionMaximum (Extend)
1checkedcheckedEFI260
2MSR16
3PrimaryCcheckedchecked

View attachment 11998
 
Thank you for your advice.

Is there a way to avoid creating a recovery partition during installation using a script or command, rather than a tool?
 
There's several ways, but they all require considerably more work.

1. Use an unattended file to run diskpart from WinPE pass, and create a commands text file on-the-fly or insert it into the image or ISO. The text file contains all the diskpart commands you would have manually executed.

diskpart /s commands.txt
Code:
select disk 0
clean
convert gpt
create partition efi size=100
format quick fs=fat32
create partition msr size=16
create partition primary
format quick fs=ntfs

There are many online examples following the answer file method.

2. Don't use an unattended file, but replace WinPE's startnet.cmd to bypass Setup from starting up. Run diskpart like in the previous example, and then invoke sources\setup.exe to resume the normal workflow.

For both examples, if you wanted a hands-free experience, unattend.xml needs to have an <InstallTo> target defined.
 
Thank you very much for your detailed explanation.
I'll try it based on your advice.
 
Hello

Until 23h2. I deleted the component related to the recovery partition, so no partition
With 24h2, it's mandatory to keep the "agentrecovery" and "Winre" components and therefore this partition

Will adding the recovery partition to Unattended, with a value of 0, will not create this partition ?

I haven't tested yet, I will surely test when we have finished the current tests, about this 24h2

Thanks
 
Will adding the recovery partition to Unattended, with a value of 0, will not create this partition ?
The text description when you click on Recovery image, says "0 to skip partition creation".

If you remove WinRE component, then you can't have the option to create a Recovery partition later on the installed machine without using Host Refresh to restore the missing files.
 
Ok thanks
I hadn't looked yet, and I wasn't sure with the 24h2 and the obligation to keep Winre
 
Dear Tistou77 and Seezoo, garlin's solution to use diskpart is the most straight-forward way to create a RE-less partition setup for Windows installation, in particular you may edit unattend.xml to start the diskpart script duirng Windows PE pass:

Code:
        <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <RunAsynchronous>
                <RunAsynchronousCommand wcm:action="add">
                    <Description>Partition Disk</Description>
                    <Order>1</Order>
                    <Path>diskpart /s x:\diskpart.txt</Path>
                </RunAsynchronousCommand>
            </RunAsynchronous>
        </component>

Then just save the diskpart script as "diskpart.txt" under root folder of boot.wim.

However, personally I do not suggest removing the recovery partition just to save 1GB of space. I think it is always a good idea to have a way to "recover" your Windows when there is a need for it.
 
There's two different ways of managing a diskpart.txt file. Each has their own pro's & con's.

1. Create a (long?) list of WinPE pass RunSynchronousCommand's to sequentially echo each line of the diskpart.txt into a temporary file on the X:\ volume. Because autounattend.xml is copied to the ISO folder, no boot.wim modification is required.

Pro: Portable to every ISO, no copying of a file to the boot.wim
Con: Need a (long?) list of RunSynchronousCommands to create the file. Usually a hassle to update, because you need to preserve the <Order> sequence.

2. Write all the diskpart commands to a file, and copy it to the boot.wim. All you need is one RunSynchronousCommand to execute "diskpart /s \path\diskpart.txt".

Pro: Don't need to make autounattend.xml complicated, and too long because it has all these echo commands.
Con: Every time you need to update diskpart.txt, boot.wim must be mounted.


If you want a bare-minimum autounattend.xml to install Windows, without a Recovery partition:
Code:
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="windowsPE">
        <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <ImageInstall>
                <OSImage>
                    <InstallTo>
                        <DiskID>0</DiskID>
                        <PartitionID>3</PartitionID>
                    </InstallTo>
                </OSImage>
            </ImageInstall>
            <RunSynchronous>
                <RunSynchronousCommand wcm:action="add">
                    <Order>1</Order>
                    <Path>cmd /c (for %a in ("sel disk 0" "cle" "con gpt" "cre par efi size=100" "for quick fs=fat32" "cre par msr size=16" "cre par pri" "for quick fs=ntfs") do @echo %~a) | diskpart</Path>
                </RunSynchronousCommand>
            </RunSynchronous>
            <UserData>
                <ProductKey>
                    <Key></Key>
                </ProductKey>
            </UserData>
        </component>
    </settings>
</unattend>


Every <Command> is limited to a maximum of 251 chars, but two tricks can reduce the number of lines:
1. diskpart has command shortcuts, like "cre par efi size=100" for "create partition efi size=100".
2. "exit" isn't required as the final command, since diskpart quits when reaching the end of the file, or reading from STDIN.
 
Ok thanks

I do the tests on my laptop in dual boot,
The main OS is installed on partition 3, the configuration is as follows

Partition 1: EFI
Partition 2: MSR
Partition 3: OS
Partition 4: DATA

I install the test OS on partition 5, and the recovery partition is created on partition 6
To not delete partitions 3 and 4, I must have this configuration ?

View attachment 12010

Thanks
 
Thank you for the very clear explanation.
I'm not sure if I can do it, but I'll try it on a second notebook.
 
Back
Top