LukeShortCloud / rootpages

Root Pages is a collection of easy-to-reference tutorials and guides primarily for Linux and other UNIX-like systems.
Other
55 stars 6 forks source link

[storage][swap] Create thin provisioned swap on Btrfs #1131

Open LukeShortCloud opened 3 months ago

LukeShortCloud commented 3 months ago
$ sudo touch /swapfile
$ sudo chattr +C /swapfile
$ sudo btrfs property set /swapfile compression none
$ sudo fallocate -l 16G /swapfile
$ sudo chmod 0600 /swapfile
$ sudo mkswap /swapfile
$ sudo swapon /swapfile

https://superuser.com/questions/539287/swapon-failed-invalid-argument-on-a-linux-system-with-btrfs-filesystem

LukeShortCloud commented 3 months ago

fallocate does not for swap files on Btrfs, ext4, and XFS.

https://askubuntu.com/questions/1017309/fallocate-vs-dd-for-swapfile