How to disable properly swap partition?

  • Hi there,
    Back in the OMV5 days I recall that the flasmemory plugin advised to disable swap and that's what I did back then.


    OMV6 flasmemory plugin does not give any advice, but I realized I have a swap partition that is running off my USB stick, and I believe this is the cause of the slowdowns I'm facing.


    How do I permanently disable the swap partition?


    I already edited /etc/fstab to comment out the swap partition and executed swapoff /dev/sdXY with the correct partition. On the fly the swap partition is emptied and disabled, but after a reboot the swap is enabled again.


    There must be a salt config or some other default that is turning it on again
    , can you assist?


    I'm surprised that nobody has reported this before, but what's the point of using the flashmemory plugin if the swap partition is kept on by default on the same usb flash drive we're trying to preserve?


    I could re-enable swap by using swapfile on my NVMe drive used for apps and docker, but let's do one step at the time.

    OMV BUILD - MY NAS KILLER - OMV 6.x + omvextrasorg (updated automatically every week)

    NAS Specs: Core i3-8300 - ASRock H370M-ITX/ac - 16GB RAM - Sandisk Ultra Flair 32GB (OMV), 256GB NVME SSD (Docker Apps), 2x16TB HDDs w/ SnapRAID - Fractal Design Node 304 - Be quiet! Pure Power 11 350W


    My all-in-one SnapRAID script!

    Edited once, last by auanasgheps ().

  • Posting here to provide an update.


    I ended up not disabling swap, but switching to swapfile on another drive.


    It's fairly easy to setup and does not require formatting or creating a partition.


    In this example, I created a 4GB swapfile. Use an SSD if you can, you can store the file anywhere on the disk, I did in the root.


    These steps are only for x86/64 systems

    • Check the current swap configuration by running swapon -s
    • Execute the following commands to create the swapfile, assign the right permissions and enable it to be a swapfile
    Code
    fallocate -l 4G /path/to/swapfile
    chmod 600 /path/to/swapfile
    mkswap /path/to/swapfile
    swapon /path/to/swapfile
    • Edit fstab with your favorite editor, like nano /etc/fstab
    • Comment out the existing swap partition
    • Add the new swap file like this:
    Code
    /path/to/swapfile none swap sw 0 0
    • Restart the OS
    • Check that the file has replaced the previous partition by executing swapon -s

    OMV BUILD - MY NAS KILLER - OMV 6.x + omvextrasorg (updated automatically every week)

    NAS Specs: Core i3-8300 - ASRock H370M-ITX/ac - 16GB RAM - Sandisk Ultra Flair 32GB (OMV), 256GB NVME SSD (Docker Apps), 2x16TB HDDs w/ SnapRAID - Fractal Design Node 304 - Be quiet! Pure Power 11 350W


    My all-in-one SnapRAID script!

    Edited 2 times, last by auanasgheps ().

  • Can you also make a small mention to what architecture this applies?


    Saying this because it won't work on Raspberry PIS, for eg.


    Raspberry uses dphys-swapfile instead and the procedure is a bit different.


    I can give you a run-down, if needed

    • Official Post

    /etc/initramfs-tools/conf.d/resume should get the update swap uuid as well.

    omv 7.4.7-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.14 | compose 7.2.3 | k8s 7.2.0-1 | cputemp 7.0.2 | mergerfs 7.0.5 | scripts 7.0.8


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • an you also make a small mention to what architecture this applies?

    In my signature I have listed my hardware, so my experience as this procedure is limited to x86/64.


    I hoping I'm not the only one running OMV on a thumbdrive with an x86/64 system :)

    OMV BUILD - MY NAS KILLER - OMV 6.x + omvextrasorg (updated automatically every week)

    NAS Specs: Core i3-8300 - ASRock H370M-ITX/ac - 16GB RAM - Sandisk Ultra Flair 32GB (OMV), 256GB NVME SSD (Docker Apps), 2x16TB HDDs w/ SnapRAID - Fractal Design Node 304 - Be quiet! Pure Power 11 350W


    My all-in-one SnapRAID script!

  • In my signature I have listed my hardware, so my experience as this procedure is limited to x86/64.

    Most of the time, i'm on phone and am unable to see signatures, 😉

  • Most of the time, i'm on phone and am unable to see signatures, 😉

    No problem, I updated the post mentioning it's only for x86/64.


    I never pretended to make a full guide, but just describe what I did.

    OMV BUILD - MY NAS KILLER - OMV 6.x + omvextrasorg (updated automatically every week)

    NAS Specs: Core i3-8300 - ASRock H370M-ITX/ac - 16GB RAM - Sandisk Ultra Flair 32GB (OMV), 256GB NVME SSD (Docker Apps), 2x16TB HDDs w/ SnapRAID - Fractal Design Node 304 - Be quiet! Pure Power 11 350W


    My all-in-one SnapRAID script!

    • Official Post

    I hoping I'm not the only one running OMV on a thumbdrive with an x86/64 system

    I do. And the swap is still on the thumb drive : )

    omv 7.4.7-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.14 | compose 7.2.3 | k8s 7.2.0-1 | cputemp 7.0.2 | mergerfs 7.0.5 | scripts 7.0.8


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • I do. And the swap is still on the thumb drive : )

    You must be crazy, or just have lots of ram :)

    OMV BUILD - MY NAS KILLER - OMV 6.x + omvextrasorg (updated automatically every week)

    NAS Specs: Core i3-8300 - ASRock H370M-ITX/ac - 16GB RAM - Sandisk Ultra Flair 32GB (OMV), 256GB NVME SSD (Docker Apps), 2x16TB HDDs w/ SnapRAID - Fractal Design Node 304 - Be quiet! Pure Power 11 350W


    My all-in-one SnapRAID script!

    • Official Post

    You must be crazy, or just have lots of ram

    8GB. It just a backup machine that receives files from a main server via rsync. It runs a borgbackup job hourly too. But now that I look, I did disable swap on it.

    omv 7.4.7-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.14 | compose 7.2.3 | k8s 7.2.0-1 | cputemp 7.0.2 | mergerfs 7.0.5 | scripts 7.0.8


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • ryecoaaron I've checked my machine and I have no files under /etc/initramfs-tools/conf.d/


    My real machine is a UEFI install, while my OMV VM I use for testing has such file, but has a Legacy BIOS.


    Another cause could be that I disabled hybernation on the real machine by running systemctl mask hibernate.target ?


    I don't know what resume file is used form, but it's missing.

    OMV BUILD - MY NAS KILLER - OMV 6.x + omvextrasorg (updated automatically every week)

    NAS Specs: Core i3-8300 - ASRock H370M-ITX/ac - 16GB RAM - Sandisk Ultra Flair 32GB (OMV), 256GB NVME SSD (Docker Apps), 2x16TB HDDs w/ SnapRAID - Fractal Design Node 304 - Be quiet! Pure Power 11 350W


    My all-in-one SnapRAID script!

    • Official Post

    Not sure. I don't have a real machine I want to test this on.

    omv 7.4.7-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.14 | compose 7.2.3 | k8s 7.2.0-1 | cputemp 7.0.2 | mergerfs 7.0.5 | scripts 7.0.8


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Not sure. I don't have a real machine I want to test this on.

    Fine, I won't dig deeper. After all the OS is not complaining about that.

    OMV BUILD - MY NAS KILLER - OMV 6.x + omvextrasorg (updated automatically every week)

    NAS Specs: Core i3-8300 - ASRock H370M-ITX/ac - 16GB RAM - Sandisk Ultra Flair 32GB (OMV), 256GB NVME SSD (Docker Apps), 2x16TB HDDs w/ SnapRAID - Fractal Design Node 304 - Be quiet! Pure Power 11 350W


    My all-in-one SnapRAID script!

  • /etc/initramfs-tools/conf.d/resume should get the update swap uuid as well.

    It seems I missed the removal of the swap disable instructions in OMV 6 and apparently successfully disabled swap under OMV 5 which then carried over to 6 with my in-place upgrade.


    I completed all the other steps in the OP's instructions and swapon -s, and cat /proc/swaps all appear to be accurately referencing the swapfile indicated in place of /path/to/swapfile. However, it appears that the resume file doesn't currently exist on my system.


    Is this a significant issue? if so would I create and populate that file with /path/to/swapfile or would I reference the UUID that was returned from the mkswap command?


    If it is the latter I assume it would need to follow the form found here: https://ubuntuforums.org/showt…2&p=13800490#post13800490


    Code
    RESUME=UUID=MY-SWAPFILE-UUID

    Would i need to run any update commands or would i then just need to reboot my system?


    Thanks!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!