From d32d52d64e636594bdc7fab8cf017d47c52a27e8 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Tue, 7 Jan 2025 12:02:09 +0800 Subject: [PATCH] =?UTF-8?q?windows:=20=E4=BF=AE=E5=A4=8D=20mbr=20+=20?= =?UTF-8?q?=E5=A4=A7=E4=BA=8E=202t=20=E7=A1=AC=E7=9B=98=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=AE=89=E8=A3=85=20windows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- trans.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/trans.sh b/trans.sh index d3c4baf..9384a34 100644 --- a/trans.sh +++ b/trans.sh @@ -1928,6 +1928,7 @@ create_part() { # 1. vista/2008 不能删除 boot.wim # 2. 下载镜像前不知道是 vista/2008,因为 --image-name 可以随便输入 # 因此还是要额外添加 200m + # 注意这里单位要用 MiB,因为后面的 border 要以 MiB 计算 part_size="$((size_bytes / 1024 / 1024 + 200))MiB" apk add ntfs-3g-progs @@ -1952,11 +1953,17 @@ create_part() { mkfs.ntfs -f -F -L installer /dev/$xda*4 #4 installer else # bios + mbr 启动盘最大可用 2t - is_xda_gt_2t && max_usable_size=2TiB || max_usable_size=100% + if is_xda_gt_2t; then + border=$((2 * 1024 * 1024 - ${part_size%MiB}))MiB + max_usable_size=2TiB + else + border=-${part_size} + max_usable_size=100% + fi parted /dev/$xda -s -- \ mklabel msdos \ - mkpart primary ntfs 1MiB -${part_size} \ - mkpart primary ntfs -${part_size} ${max_usable_size} \ + mkpart primary ntfs 1MiB ${border} \ + mkpart primary ntfs ${border} ${max_usable_size} \ set 1 boot on update_part