Swap partition on SD card

  • Hi everyone.
    I'll make a new installation of OMv on a new 32GB SD card. Should I make a swap partition, or I should just create a 32GB ext4 partition?

    Intel G4400 - Asrock H170M Pro4S - 8GB ram - Be Quiet Pure Power 11 400 CM - Nanoxia Deep Silence 4 - 6TB Seagate Ironwolf - RAIDZ1 3x10TB WD - OMV 5 - Proxmox Kernel

  • I looked around a little, for what I've read I need the swap partition to hibernate my computer right? It has other use? I read that without swap partition the OS will kill process more often in case of OOM.
    If possible I would avoid a swap partition to reduce the writing on SD card. Since I have 8gb of ram I don't fear to finish my ram, and I use sleep over hibernation so that wake-on-lan will work

    Intel G4400 - Asrock H170M Pro4S - 8GB ram - Be Quiet Pure Power 11 400 CM - Nanoxia Deep Silence 4 - 6TB Seagate Ironwolf - RAIDZ1 3x10TB WD - OMV 5 - Proxmox Kernel

  • Swap on SD card (same with USB thumdbrives) is a bad idea. So if you have to use a swap partition (if that's needed for hibernation -- no idea) you simply adjust "swappiness":

    Code
    echo "vm.swappiness=0" >> /etc/sysctl.conf


    This will lead to swap being used only in emergency situations any more (most likely never). Needs a reboot.


    In case you're low an RAM (this does NOT affect your box with 8GB RAM but eg. small ARM boards that have 1GB or even less) a pretty good idea is to not use swap at all but better approaches that exist in the meantime. For example zram. In case you have a swap partition, uncomment it and ensure zram is being used. On all OMV3 images for ARM devices this is done by this simple instruction (pulling in an Ubuntu packet which doesn't matter since it's essentially just a simple startscript that sets up zram):


    Code
    FILE=$(mktemp)
    wget https://mirrors.kernel.org/ubuntu/pool/universe/z/zram-config/zram-config_0.5_all.deb -qO $FILE && dpkg -i $FILE

    Starting with Debian Stretch / OMV4 there's a 'zram-config' package available which is then the preferred method.


    We should keep in mind that 'stuff on the Internet' is mostly outdated. Swap recommendations date back to last century (copy&paste over and over again). It's 2018 and with all modern kernels we have way better options to deal with low-memory situations today than swap (fine a decade ago, questionable today on almost all devices).


    People fearing anything that has been developed in this century: there's no need to put the swap partition on the drive the OS will be booted from. You can always get your system slow by letting the swap partition or file reside on a connected HDD (also great to prevent disk sleep)

  • thanks a lot!
    I'll try to use OMV4 without swap and check if hibernation is working. If I don't have a swap partition I don't need to use the command "echo "vm.swappiness=0" >> /etc/sysctl.conf" right?

    Intel G4400 - Asrock H170M Pro4S - 8GB ram - Be Quiet Pure Power 11 400 CM - Nanoxia Deep Silence 4 - 6TB Seagate Ironwolf - RAIDZ1 3x10TB WD - OMV 5 - Proxmox Kernel

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!