Closed TommyTran732 closed 3 years ago
All right, looking to implement it. :D
added a btrfs swapfile the other day, for a suggestion:
# optional: retroactively add a swap subvolume on an existing btrfs disk
mkdir -p /mnt/btrfs
mount /dev/mapper/cryptroot /mnt/btrfs
cd /mnt/btrfs
btrfs subvol create @swap
umount /mnt/btrfs
mkdir -p /swap
# /etc/fstab
/dev/mapper/cryptroot /swap btrfs subvol=@swap,noatime,compress=no,nodatasum,nodatacow 0 0
mount -a
# man 5 btrfs
truncate -s 0 file
chattr +C file
# man mkswap
dd if=/dev/zero of=file bs=1MiB count=$((8*1024))
chmod 0600 file
mkswap file
swapon file
# /etc/fstab
/swap/file none swap sw 0 0
Edit: as /swap is mounted with nodatacow and cow disabled by chattr, the use of fallocate
instead of dd
is fine, as initially suggested in man 5 btrfs
. For a recent discussion of "swap on btrfs" see https://old.reddit.com/r/btrfs/comments/mtg3ll/swapfile_on_btrfs/
I am in favor of ZRAM since its reported to be better for SSDs. The Fedora implementation looks to be good.
There used to be a swapfile but the way I implemented it was kind of inefficient. @wbob
@iSparsh I'm in favor of ZRAM as well, currently I'm reading about how to implement it. Looks like there's a systemd unit for that but AUR has a package for it too.
I'm not sure how helpful this is but this has implementation of Zram. You can take a look at this at 24:00 minute mark roughly
Ok from some research i've found that zram-generator from the official repositories is the way to go. However, the script would need to leave a note (post-install) telling the user to adjust the values of zram in the config file. Is that okay @classy-giraffe
And nope, we don't need systemd-zram-generator :P
That package is nice and all, but we don't need it. I just followed the Arch wiki for this instead ;)
Okay the PR is merged so I am closing this
I don't think the way it sets up unencrypted swap right now is a good idea. I think its better to encrypt it using dmcrypt or just to switch to zram and use the same configuration as Fedora does.