From 0af60c269963fcc29cc5dc4eace2857b07389c4a Mon Sep 17 00:00:00 2001 From: bin456789 Date: Thu, 8 May 2025 22:47:55 +0800 Subject: [PATCH] =?UTF-8?q?dd:=20=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D=20NT?= =?UTF-8?q?FS=20=E8=84=8F=E5=8D=B7=E5=B9=B6=E5=BC=BA=E5=88=B6=E6=8C=82?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #273 --- trans.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/trans.sh b/trans.sh index 43ded38..a324061 100644 --- a/trans.sh +++ b/trans.sh @@ -3697,10 +3697,20 @@ modify_os_on_disk() { is_windows() { true; } # 重新挂载为读写、忽略大小写 umount /os - mount -t ntfs3 -o nocase /dev/$part /os - # 有休眠文件时无法挂载成读写,提醒用户并退出脚本 - if mount | grep ' /os ' | grep -wq ro; then - error_and_exit "Can't mount windows partition /dev/$part as rw." + if ! { mount -t ntfs3 -o nocase,rw /dev/$part /os && + mount | grep -w 'on /os type' | grep -wq rw; }; then + # 显示警告 + warn "Can't normally mount windows partition /dev/$part as rw." + dmesg | grep -F "ntfs3($part):" || true + # 有可能 fallback 挂载成 ro, 因此先取消挂载 + if mount | grep -wq 'on /os type'; then + umount /os + fi + # 尝试修复并强制挂载 + apk add ntfs-3g-progs + ntfsfix /dev/$part + apk del ntfs-3g-progs + mount -t ntfs3 -o nocase,rw,force /dev/$part /os fi # 获取版本号,其他地方会用到 get_windows_version_from_dll "$ntoskrnl_exe"