From b9df3fd7322713dba0a18a92d213f1c24e5cfa0b Mon Sep 17 00:00:00 2001 From: Blake Romero Date: Wed, 17 Apr 2024 21:04:47 +0100 Subject: Manually set label for swapfile for grub config --- install-artix.sh | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/install-artix.sh b/install-artix.sh index 059f92d..a45ecba 100755 --- a/install-artix.sh +++ b/install-artix.sh @@ -189,12 +189,29 @@ mount -o "${options},subvol=@snapshots" "${root}" /mnt/.snapshots \ mount -o "nodatacow,subvol=@swap" "${root}" /mnt/.swap # Create swap file -btrfs filesystem mkswapfile \ - --size "$swap_size" \ - --uuid clear \ - /mnt/.swap/swapfile +# btrfs filesystem mkswapfile \ +# --size "$swap_size" \ +# --uuid clear \ +# /mnt/.swap/swapfile +# btrfs property set /mnt/.swap compression none +# swapon /mnt/.swap/swapfile + +# SWAP FILE +swapfile=/mnt/.swap/swapfile +# create an empty file +truncate -s 0 $swapfile +# set to copy-on-write +chattr +C $swapfile +# preallocate file size to swap size +fallocate -l $swap_size $swapfile +# restrict access to swap file +chmod 0600 $swapfile +# initialise the swap file +mkswap -L SWAP $swapfile +# ensure swap sub-volume does not use compression btrfs property set /mnt/.swap compression none -swapon /mnt/.swap/swapfile +# enable the swap file +swapon $swapfile # Mount boot partition. mount "${boot}" /mnt/boot -- cgit