From 627ec5626238d1d0771b70dacca2e8e85a890083 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sat, 23 Dec 2023 21:26:23 +0100 Subject: [PATCH] feat: LINUX_IMMUTABLE flag (#485) * feat: LINUX_IMMUTABLE flag --- readme.md | 1 + src/disk.sh | 3 ++- src/install.sh | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index c7365aa..029093e 100644 --- a/readme.md +++ b/readme.md @@ -36,6 +36,7 @@ services: - /dev/kvm cap_add: - NET_ADMIN + - LINUX_IMMUTABLE ports: - 5000:5000 volumes: diff --git a/src/disk.sh b/src/disk.sh index 4021cd0..7e310bf 100644 --- a/src/disk.sh +++ b/src/disk.sh @@ -295,7 +295,8 @@ checkFS () { if [[ "$FA" != *"C"* ]]; then info "Warning: the filesystem of $DIR is ${FS^^}, and COW (copy on write) is not disabled for that folder!" - info "This will negatively affect performance, please empty the folder and disable COW (chattr +C )." + info "This will negatively affect performance, please empty the folder and add the LINUX_IMMUTABLE flag" + info "to the 'cap_add' section of your compose file, or disable COW manually by executing: chattr +C " fi fi diff --git a/src/install.sh b/src/install.sh index cdf90e1..11b1108 100644 --- a/src/install.sh +++ b/src/install.sh @@ -61,9 +61,10 @@ if [[ "$FS" == "xfs" || "$FS" == "zfs" || "$FS" == "btrfs" || "$FS" == "bcachefs { chattr -R +C "$STORAGE"; } || : FA=$(lsattr -d "$STORAGE") fi - if [[ "$FA" != *"C"* ]]; then + if [[ "$FA" != *"C"* ]]; then info "Warning: the filesystem of $STORAGE is ${FS^^}, and COW (copy on write) is not disabled for that folder!" - info "This will negatively affect performance, please empty the folder and disable COW (chattr +C )." + info "This will negatively affect performance, please empty the folder and add the LINUX_IMMUTABLE flag" + info "to the 'cap_add' section of your compose file, or disable COW manually by executing: chattr +C " fi fi @@ -74,8 +75,7 @@ else TMP="/tmp/dsm" SPACE=$(df --output=avail -B 1 /tmp | tail -n 1) if (( MIN_SPACE > SPACE )); then - TMP="$STORAGE/tmp" - info "Warning: the $FS filesystem of $STORAGE does not support UNIX permissions.." + error "The $FS filesystem of $STORAGE does not support UNIX permissions, and no space left in container.." && exit 93 fi fi