Skip to content

Commit

Permalink
feat: Set directory attributes (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Dec 23, 2023
1 parent d1158df commit 636eea9
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,21 @@ checkFS () {
fi
fi

if [ -f "$DISK_FILE" ] ; then
FA=$(lsattr "$DISK_FILE")
[[ "$FA" == *"C"* ]] && FA=$(lsattr -d "$DIR")
else
local FA=""
[ -f "$DISK_FILE" ] && FA=$(lsattr "$DISK_FILE")

if [[ "$FA" == "" || "$FA" == *"C"* ]]; then
FA=$(lsattr -d "$DIR")
if [[ "$FA" != *"C"* ]]; then
{ chattr -R +C "$DIR"; } || :
FA=$(lsattr -d "$DIR")
fi
fi

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 <path>)."
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 <path>"
fi
fi

Expand Down

0 comments on commit 636eea9

Please sign in to comment.