From cd07750b48ddd2bc4fd4e411c02523773b439ea5 Mon Sep 17 00:00:00 2001 From: Kroese Date: Thu, 13 Aug 2026 15:10:56 +0200 Subject: [PATCH 1/2] fix: Disable COW for Virtual DSM boot image on Btrfs --- src/install.sh | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/install.sh b/src/install.sh index 2042b5a3..50fbbee4 100644 --- a/src/install.sh +++ b/src/install.sh @@ -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" + local 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 $? From 61e0aff53ea99abc02cb2d8091dc8e125d2d2b29 Mon Sep 17 00:00:00 2001 From: Kroese Date: Thu, 13 Aug 2026 16:02:27 +0200 Subject: [PATCH 2/2] Update install.sh --- src/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/install.sh b/src/install.sh index 50fbbee4..a44b8e24 100644 --- a/src/install.sh +++ b/src/install.sh @@ -178,8 +178,8 @@ createSystemImage() { return 67 fi - local bootTmp="$tmp/boot" - local bootBase="$(basename "${DSM_BOOT%.zip}")" + local bootTmp="$tmp/boot" bootBase + bootBase="$(basename "${DSM_BOOT%.zip}")" rm -rf "$bootTmp" || return $?