文章目录
对硬盘进行分区并准备应用映像
- 将CreatePartitions-UEFI.txt文件复制并保存到 USB 闪存驱动器。
- 使用 Windows PE 启动目标 PC。
- 清洁和分区驱动器。参数传递脚本。本例中,F为U盘盘符。
DiskPart /s F:\CreatePartitions-UEFI.txt
如果您使用自定义分区布局,请更新按钮恢复脚本,以便恢复工具可以在需要时重新创建自定义分区布局。
为避免分区大小导致裸机恢复启动问题,制造商应允许裸机恢复功能的自动生成脚本创建用于恢复 WIM 的分区。如果制造商想要使用自定义 DISKPART 脚本来创建分区,建议的最小分区大小为 990MB,并且至少有 250MB 的可用空间。
创建分区脚本
将这些脚本与 DiskPart 一起使用,为 Windows 格式化和设置硬盘分区,包括恢复工具。根据需要调整分区大小以填充驱动器。
CreatePartitions-UEFI.txt
为基于 UEFI 的电脑创建系统、MSR、Windows 和恢复工具分区。
此脚本临时分配这些驱动器号:System=S、Windows=W 和 Recovery=R。MSR 分区没有收到信件。字母 W 用于避免潜在的驱动器号冲突。设备重新启动后,Windows 分区将分配字母 C,而其他分区不会收到盘符。
Recovery 分区必须是 Windows 分区之后的分区,以确保 winre.wim 在设备的生命周期内保持最新。
下图显示了生成的分区配置:
rem == CreatePartitions-UEFI.txt == rem == These commands are used with DiskPart to rem create four partitions rem for a UEFI/GPT-based PC. rem Adjust the partition sizes to fill the drive rem as necessary. == select disk 0 clean convert gpt rem == 1. System partition ========================= create partition efi size=100 rem ** NOTE: For Advanced Format 4Kn drives, rem change this value to size = 260 ** format quick fs=fat32 label="System" assign letter="S" rem == 2. Microsoft Reserved (MSR) partition ======= create partition msr size=16 rem == 3. Windows partition ======================== rem == a. Create the Windows partition ========== create partition primary rem == b. Create space for the recovery tools === rem ** Update this size to match the size of rem the recovery tools (winre.wim) rem plus some free space. shrink minimum=500 rem == c. Prepare the Windows partition ========= format quick fs=ntfs label="Windows" assign letter="W" rem === 4. Recovery partition ====================== create partition primary format quick fs=ntfs label="Recovery" assign letter="R" set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac" gpt attributes=0x8000000000000001 list volume exit
CreatePartitions-UEFI-FFU.txt
此脚本基于 CreatePartitions-UEFI.txt,但它不会创建恢复分区。这样 Windows 分区就是驱动器上的最后一个分区,可以扩展。如果使用此脚本,稍后可以使用 ApplyRecovery.bat 配置恢复分区。
rem == CreatePartitions-UEFI-FFU.txt == rem == These commands are used with DiskPart to rem create four partitions rem for a UEFI/GPT-based PC. rem Adjust the partition sizes to fill the drive rem as necessary. == select disk 0 clean convert gpt rem == 1. System partition ========================= create partition efi size=100 rem ** NOTE: For Advanced Format 4Kn drives, rem change this value to size = 260 ** format quick fs=fat32 label="System" assign letter="S" rem == 2. Microsoft Reserved (MSR) partition ======= create partition msr size=16 rem == 3. Windows partition ======================== rem == a. Create the Windows partition ========== create partition primary rem == c. Prepare the Windows partition ========= format quick fs=ntfs label="Windows" assign letter="W" list volume exit
CreatePartitions-BIOS.txt
为基于 BIOS 的 PC 创建系统、Windows 和恢复工具分区。
此脚本临时分配这些驱动器号:System=S、Windows=W 和 Recovery=R。字母 W 用于避免潜在的驱动器号冲突。设备重新启动后,Windows 分区将分配字母 C,而其他分区不会收到盘符。
Recovery 分区必须是 Windows 分区之后的分区,以确保 winre.wim 在设备的生命周期内保持最新。
下图显示了生成的分区配置:
rem == CreatePartitions-BIOS.txt == rem == These commands are used with DiskPart to rem create three partitions rem for a BIOS/MBR-based computer. rem Adjust the partition sizes to fill the drive rem as necessary. == select disk 0 clean rem == 1. System partition ====================== create partition primary size=100 format quick fs=ntfs label="System" assign letter="S" active rem == 2. Windows partition ===================== rem == a. Create the Windows partition ======= create partition primary rem == b. Create space for the recovery tools rem ** Update this size to match the size of rem the recovery tools (winre.wim) rem plus some free space. shrink minimum=500 rem == c. Prepare the Windows partition ====== format quick fs=ntfs label="Windows" assign letter="W" rem == 3. Recovery partition ==================== create partition primary format quick fs=ntfs label="Recovery image" assign letter="R" set id=27 list volume exit