summaryrefslogtreecommitdiff
path: root/install-artix.sh
diff options
context:
space:
mode:
authorBlake Romero <blake@blkrom.com>2024-04-17 21:04:47 +0100
committerBlake Romero <blake@blkrom.com>2024-04-17 21:04:47 +0100
commitb9df3fd7322713dba0a18a92d213f1c24e5cfa0b (patch)
tree8f51a483cdc739a9cf6d7e48dc65f7fcd33f7c5e /install-artix.sh
parenteeb3ebfc822768161b9ceec75c67af912e279e03 (diff)
Manually set label for swapfile for grub config
Diffstat (limited to 'install-artix.sh')
-rwxr-xr-xinstall-artix.sh27
1 files 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