fix: Disable COW for Virtual DSM boot image on Btrfs (#1376)

This commit is contained in:
Kroese
2026-08-13 16:03:19 +02:00
committed by GitHub
parent d854ae811c
commit d5bb90f012
+29 -2
View File
@@ -178,8 +178,35 @@ createSystemImage() {
return 67
fi
7z x -y -o"$tmp" "$DSM_BOOT" >/dev/null || return $?
DSM_BOOT="${DSM_BOOT%.zip}"
local bootTmp="$tmp/boot" bootBase
bootBase="$(basename "${DSM_BOOT%.zip}")"
rm -rf "$bootTmp" || return $?
if ! makeDir "$bootTmp"; then
error "Failed to create directory \"$bootTmp\" !"
return 93
fi
if [[ "${fs,,}" == "btrfs" ]]; then
{ chattr +C "$bootTmp"; } || :
fi
7z x -y -o"$bootTmp" "$DSM_BOOT" >/dev/null || return $?
DSM_BOOT="$bootTmp/$bootBase"
if [ ! -s "$DSM_BOOT" ]; then
error "The PAT boot image could not be extracted."
return 67
fi
if [[ "${fs,,}" == "btrfs" ]]; then
local attrs
attrs=$(lsattr "$DSM_BOOT") || return $?
if [[ "$attrs" != *"C"* ]]; then
error "Failed to disable COW for boot image $DSM_BOOT on ${fs^^} filesystem."
fi
fi
SYSTEM="$STORAGE/$BASE.system.img"
rm -f "$SYSTEM" || return $?