All Projects → Nefelim4ag → Systemd Swap

Nefelim4ag / Systemd Swap

Licence: gpl-3.0
Script for creating hybrid swap space from zram swaps, swap files and swap partitions.

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to Systemd Swap

Btrfs Swapon
Btrfs doesn't allow to swap on a file. This script allows you do swap on a file anyway.
Stars: ✭ 42 (-91.12%)
Mutual labels:  btrfs, swap
Mkinitcpio Systemd Tool
Provisioning tool for systemd in initramfs (systemd-tool)
Stars: ✭ 60 (-87.32%)
Mutual labels:  btrfs, systemd
zramd
Automatically setup swap on zram ✨ with optional systemd support, a simpler alternative to zram-generator and systemd-swap
Stars: ✭ 45 (-90.49%)
Mutual labels:  systemd, swap
modern-linux.info
Learning Modern Linux book website
Stars: ✭ 35 (-92.6%)
Mutual labels:  systemd
btrfs
Btrfs library in a pure Go
Stars: ✭ 24 (-94.93%)
Mutual labels:  btrfs
Dmenu Extended
An extension to dmenu for quickly opening files and folders.
Stars: ✭ 334 (-29.39%)
Mutual labels:  systemd
Embiggen Disk
embiggden-disk live-resizes a filesystem after first live-resizing any necessary layers below it: an optional LVM LV and PV, and an MBR or GPT partition table
Stars: ✭ 440 (-6.98%)
Mutual labels:  btrfs
powersave
Linux power save settings, compatible with systemd
Stars: ✭ 79 (-83.3%)
Mutual labels:  systemd
Dotfiles
Configuration for Arch Linux, sway, kitty, kakoune, zsh and more + scripted installation guide
Stars: ✭ 385 (-18.6%)
Mutual labels:  btrfs
Restic Systemd Automatic Backup
My restic backup solution using Backblaze B2 storage, systemd timers (or cron) and email notifications on failure.
Stars: ✭ 314 (-33.62%)
Mutual labels:  systemd
Ip2unix
Turn IP sockets into Unix domain sockets
Stars: ✭ 295 (-37.63%)
Mutual labels:  systemd
Btrfs Progs
Development of userspace BTRFS tools
Stars: ✭ 260 (-45.03%)
Mutual labels:  btrfs
Ecominit
eComInit is a free init system and service manager designed to scale from lightweight desktops to web-scale cloud deployments. It aims to offer feature-parity with systemd but with a modular, portable architecture compliant with software engineering best-practice.
Stars: ✭ 352 (-25.58%)
Mutual labels:  systemd
xmr-btc-atomic-swap
Cross-chain atomic swap protocol between Monero and Bitcoin
Stars: ✭ 67 (-85.84%)
Mutual labels:  swap
Kubernetes Ansible
🎄ansible多网卡机器上一键部署高可用Kubernetes(systemd)
Stars: ✭ 402 (-15.01%)
Mutual labels:  systemd
lightning-xchain-atomic-swap
Lightning Cross Chain Atomic Swap
Stars: ✭ 16 (-96.62%)
Mutual labels:  swap
Clight
A C daemon that turns your webcam into a light sensor. It will adjust screen backlight based on ambient brightness.
Stars: ✭ 371 (-21.56%)
Mutual labels:  systemd
Rotatable
Helper class to make any view rotatable
Stars: ✭ 295 (-37.63%)
Mutual labels:  swap
Supervizer
NodeJS Application Manager
Stars: ✭ 278 (-41.23%)
Mutual labels:  systemd
Jetstrap
A Laravel 8 package to easily switch TailwindCSS resources generated by Laravel Jetstream and Breeze to Bootstrap 4.
Stars: ✭ 320 (-32.35%)
Mutual labels:  swap

systemd-swap

Code Style: Black

⚠️ Current code quality and commit frequency is low ⚠️

Users should migrate to systemd/zram-generator since zram should be enough in most systems

Script to manage swap on:

  • zswap - Enable/Configure
  • zram - Autoconfigurating for swap
  • files - (sparse files for saving space, supports btrfs)
  • block devices - auto find and do swapon

ℹ️ It is configurable in /etc/systemd/swap.conf.

Additional terms:

  • SwapFC (File Chunked) - provides a dynamic swap file allocation/deallocation

File location

/etc/systemd/swap.conf
/usr/lib/systemd/system/systemd-swap.service
/usr/bin/systemd-swap

Please don't forget to enable and start with

sudo systemctl enable --now systemd-swap

Install

  • Arch Linux: in the community repo.

  • Debian based distros

    git clone https://github.com/Nefelim4ag/systemd-swap.git
    cd systemd-swap
    make deb
    sudo apt install ./systemd-swap_*_all.deb
    
  • Fedora based distros

    sudo dnf copr enable zeno/systemd-swap
    sudo dnf install systemd-swap
    

    or

    git clone https://github.com/Nefelim4ag/systemd-swap.git
    cd systemd-swap
    make rpm
    sudo dnf install ./systemd-swap-*noarch.rpm
    
    
  • Manual

    Install dependencies:

    • python3 >= 3.7
    • python3 packages: systemd-python and sysv_ipc
    git clone https://github.com/Nefelim4ag/systemd-swap.git
    cd systemd-swap
    sudo make install
    
    # or into /usr/local:
    sudo make prefix=/usr/local install
    

About configuration

Q: Do we need to activate both zram and zswap?
A: Nope, it's useless, as zram is a compressed RAM DISK, but zswap is a compressed "writeback" CACHE on swap file/disk. Also having both activated can lead to inverse LRU as noted here

Q: Do I need to use swapfc_force_use_loop on swapFC?
A: Nope, as you wish really, native swapfile should work faster and it's safer in OOM condition in comparison to loop backed scenario.

Q: When would we want a certain configuration?
A: In most cases zram is enough since it on average compresses 2-3x and is much faster than disk based swap.

Q: How many zram devices should one use? A: If you are not using an ancient kernel (pre 4.7) there's no benefit from using multiple zram devices.

Q: Can we use this to enable hibernation?
A: Nope as hibernation wants a persistent fs blocks and wants access to swap data directly from disk, this will not work on: swapfc (without some magic of course, see #85).

Switch on systemd-swap:s automatic swap management

  • Enable swapfc if wanted (note, you should never use zram and zswap at the same time)

    vim /etc/systemd/swap.conf.d/overrides.conf
    
    swapfc_enabled=1
    
  • Stop any external swap:

    sudo swapoff -a
    
  • Remove swap entry from fstab:

    vim /etc/fstab
    
  • Remove your swap

    # For Ubuntu
    sudo rm -f /swapfile
    
    # For Centos 7 (if using a swap partition and lvm)
    lvremove -Ay /dev/centos/swap
    lvextend -l +100%FREE centos/root
    
  • Remove swap from Grub:

    # For Ubuntu remove resume* in grub
    vim /etc/default/grub
    
    # For Centos 7 remove rd.lvm.lv=centos/swap*
    vim /etc/default/grub
    
    # For Manjaro remove resume* in grub & mkinitcpio
    vim /etc/default/grub
    vim /etc/mkinitcpio.conf
    
    # For Ubuntu
    update-grub
    
    # For Centos 7
    grub2-mkconfig -o /boot/grub2/grub.cfg
    
    # For Manjaro
    update-grub
    mkinitcpio -P
    
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].