cschneegans / unattend-generator

.NET Core library to create highly customized autounattend.xml files
https://schneegans.de/windows/unattend-generator/
MIT License
659 stars 60 forks source link

Any idea about to set EFI and WinRE partitions size keeping interacitivity to select the main partition ? #4

Closed Fred-Vatin closed 8 months ago

Fred-Vatin commented 8 months ago

Hi,

Let’s say I have something like this.

select-partition-install-clean-windows-10

Then, I manually delete partitions 1, 2, 3, 4 so I end up with 2 partitions. I would want to select the first one then the setup will automatically recreate all system partitions with the given size :

This would avoid deleting another data partition.

Any idea if it would be possible ?

cschneegans commented 8 months ago

You can create an autounattend.xml file with a custom diskpart script, and instead of the CLEAN command (which would wipe the entire disk) only delete the first four partitions:

SELECT DISK=0
SELECT PARTITION=1
DELETE PARTITION
SELECT PARTITION=2
DELETE PARTITION
SELECT PARTITION=3
DELETE PARTITION
SELECT PARTITION=4
DELETE PARTITION
CREATE PARTITION EFI SIZE=499
…

This link will configure the DiskpartScript field accordingly.

I have not tested this setup. The data partition might inadvertently get deleted. Before you use this autounattend.xml file, backup any data you want to keep.

Fred-Vatin commented 8 months ago

Thanks. Since then, I thought about a USB toolkit that I could launched before installing OS to delete all system partitions and recreate them as I want. If you know one that can easily create EFI and WinRe partition with simple commands, let me know.

I could manually do it with diskpart for WinRe creation on GPT partition but I don’t want to type that in a CLI where I can not do copy/paste :

create partition primary id=de94bba4-06d1-4d40-a16a-bfd50179d6ac
gpt attributes =0x8000000000000001