diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2022-08-30 11:57:44 +0200 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2022-08-30 11:57:44 +0200 |
commit | ac04e05a8c8d3d98b25b9ea35a0d888be8200046 (patch) | |
tree | dc36c442577fbe82c0d1c22e1378c4494864f4dc | |
parent | d3883d04e3f5963d835606e27115c894282b3ce2 (diff) |
Compute swap size based on RAM size
-rwxr-xr-x | artixinstall | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/artixinstall b/artixinstall index 79a6d04..980c304 100755 --- a/artixinstall +++ b/artixinstall @@ -20,8 +20,10 @@ mount -o compress=zstd /dev/sda2 /btrfs btrfs subvolume create /btrfs/root btrfs subvolume create /btrfs/swap +SWAPSIZE=$(( ($(free -g | grep Mem | awk '{print $2}') + 1) * 2048 )) + chattr +C /btrfs/swap -dd if=/dev/zero of=/btrfs/swap/swapfile bs=1M count=4096 status=progress +dd if=/dev/zero of=/btrfs/swap/swapfile bs=1M count=${SWAPSIZE} status=progress chmod 0600 /btrfs/swap/swapfile mkswap -U clear /btrfs/swap/swapfile swapon /btrfs/swap/swapfile |