Is there anyway we can get the Installation script to install a @SWAP partition? i am having problems creating one after the install and turning on during boot. I have created one, but I always have to do a swapon after boot. I have followed the wiki, but it doesn’t really explain how to make a @SWAP, just a swapfile.
Should be as simple as adding the appropriate entry in /etc/fstab. This is mine:
UUID=f0eef397-b328-4c1e-997b-546af5354ed6 none swap sw 0 0
I’m not sure what you mean by “@SWAP” partition.
btrfs sub create /mnt/@swap
That’s a subvolume and not a partition.
This is a subvolume, not a partition. If this is the route you want to go, then you’ll need to create a swapfile inside the @swap subvolume, then add it to your
You have (2) sets of instructions that must be followed:
From https://wiki.archlinux.org/title/Btrfs#Swap_file, you create a zero-length file that will be used to create the swapfile
From https://wiki.archlinux.org/title/Swap#Swap_file_creation, you create/activate the swapfile, then add it to
While I totally understand the convenience of using swapfiles over swap partitions, it was way easier setting up a swap partition.
I need to type faster!
Does the swap file need to be in a separate subvolume?
Wiki only says that it only needs to be not in a snapshotted subvolume.
But then wiki adds this line:
The proper procedure is to create a new subvolume to place the swap file in.
It can be on any subvolume, as long as it’s not snapshotted. For example, it could reside on
/var/cache because it’s not included in snapshots (by default, anyway). Creating a new subvolume is just a way to guarantee that it’s not going to be snapshotted.
cat /etc/fstab lsblk -f sudo btrfs subvolume list -p /
could give the forum some “hard” info to go by.
So, If I wanted to create the subvolume @SWAP on the standard RPI4 install I would do:
sudo btrfs sub create /var/swap/@swap cd /var/swap sudo truncate -s 0 ./swapfile sudo chattr +C ./swapfile sudo btrfs property set ./swapfile compression none sudo dd if=/dev/zero of=./swapfile bs=1M count=512 status=progress sudo chmod 0600 ./swapfile sudo mkswap -U clear ./swapfile sudo swapon ./swapfile
Then change my /etc/fstab by adding:
UUID=XXXXXXXXXXXXXXX /swap btrfs subvol=@swap 0 0 /var/swap/swapfile none swap sw 0 0
Or am I missing any steps? Also, do I need to do this from another system and mount the usb inside it to create the subvolume and such?
i no use btrfs . I have litte dig + find this .
sudo truncate -s 0 /swapfile sudo chattr +C /swapfile sudo btrfs property set /swapfile compression none
If you are using a subvol for swap like current default BTRFS installs will do your swapfile location needs to be changed to
/swap/swapfile instead of
Swap file is supported on Btrfs. That is the way to go. No issue.
You’ve got the wrong location for your swapfile:
cd /var/swap/@swap: this is the subvolume that you created, not
/etc/fstab should look like this; no need to mount @swap as it’s already under a mounted filesystem (/@):
/var/swap/@swap/swapfile none swap sw 0 0
The article at that link states
Just a note, it’s not recommended to make a swap partition on an SSD, this can damage the medium.
I never heard of that… and I can’t see why that should be the case…
It is on a PNY 128GB Atache usb drive attached to a RPI400.