Skip to content

Commit

Permalink
Fix the use of chattr +C only for btrfs
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeniy-antonyuk committed Oct 24, 2024
1 parent 48f5f6b commit f2a9ac7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 2 additions & 0 deletions install/OneClickInstall/install-Debian/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ make_swap () {
EXIST=$(swapon -s | awk '{ print $1 }' | { grep -x ${SWAPFILE} || true; });

if [[ -z $EXIST ]] && [ ${TOTAL_MEMORY} -lt ${MEMORY_REQUIREMENTS} ] && [ ${AVAILABLE_DISK_SPACE} -gt ${DISK_REQUIREMENTS} ]; then
touch "${SWAPFILE}"
[[ "$(df -T / | awk 'NR==2{print $2}')" = "btrfs" ]] && chattr +C "${SWAPFILE}"
fallocate -l 6G ${SWAPFILE}
chmod 600 ${SWAPFILE}
mkswap ${SWAPFILE}
Expand Down
5 changes: 1 addition & 4 deletions install/OneClickInstall/install-RedHat/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ function make_swap () {

if [[ -z $EXIST ]] && [ ${TOTAL_MEMORY} -lt ${MEMORY_REQUIREMENTS} ] && [ ${AVAILABLE_DISK_SPACE} -gt ${DISK_REQUIREMENTS} ]; then
touch "$SWAPFILE"
# No Copy-on-Write - no compression
[[ "$DIST" == "fedora" ]] && chattr +C "$SWAPFILE"
# Allocate 6 GB, much faster than: dd if=/dev/zero of=${SWAPFILE} count=6144 bs=1MiB
[[ "$(df -T / | awk 'NR==2{print $2}')" = "btrfs" ]] && chattr +C "$SWAPFILE"
fallocate -l 6G "$SWAPFILE"
chmod 600 "$SWAPFILE"
mkswap "$SWAPFILE"
# Activate, enable upon system boot
swapon "$SWAPFILE"
echo "$SWAPFILE none swap sw 0 0" >> /etc/fstab
fi
Expand Down

0 comments on commit f2a9ac7

Please sign in to comment.