Stop making swap partitions–use swap files instead
9 hours ago
- #Linux
- #Swap File
- #System Administration
- Swap files have performed as well as swap partitions for over 20 years, but many Linux distributions still promote swap partitions during installation.
- Swap files are more user-friendly than swap partitions, allowing easier addition, removal, modification, and extension after setup.
- To set up a swap file, use `fallocate` to create it, set proper permissions with `chmod`, format it with `mkswap`, enable it with `swapon`, and add it to `/etc/fstab` for persistence.
- For Btrfs filesystems, refer to specific documentation to ensure swap file compatibility and proper configuration.