Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Swap File Plugin for unRAID v5 and v6

Featured Replies

TheOne... if you need me to test let me know

 

 

  • Replies 110
  • Views 69.3k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • primeval_god
    primeval_god

    @artafinde Also since you last checked this plugin has been forked and the fork supports swapfiles on BTRFS.   

  • maciekish
    maciekish

    It is controlled by swappiness. I guess you could create a userscript on startup that sets the swappiness. https://askubuntu.com/questions/103915/how-do-i-configure-swappiness   I suggest th

  • On version 6.9.1, the Linux kernel updated to 5.10 and it supports swapfile on BTRFS. On filesystem BTRFS, you should follow this [url] to make a swapfile, and then it will work.  Hope this

Posted Images

Just came back from a long vacation.

Need to understand the exact limitations of the 6.1 security checks.

 

I will update all my plugins to 6.1 - probably not keep 6.0 compatibility.

See here:  http://lime-technology.com/forum/index.php?topic=42259.0

  • 2 weeks later...

i felt adventurous today so i uninstalled this plug... upgraded to 6.1.2.. checked everything was fine

and then installed the plugin again

everything installed fine

 

Sep 17 18:12:18 P8H67 emhttp: cmd: /usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/plugin install https://raw.githubusercontent.com/theone11/swapfile_plugin/master/swapfile.plg (Other emhttp)

Sep 17 18:12:20 P8H67 logger: plugin: creating: /tmp/swapfile-install - from INLINE content

Sep 17 18:12:20 P8H67 logger: plugin: running: /tmp/swapfile-install

 

gui comes up

but starting the plugin is a no go

 

Sep 17 18:12:56 P8H67 emhttp: run_cmd: invalid cmd: /etc/rc.d/rc.swapfile start (Other emhttp)

 

so if you could look into this :)

 

 

updated the unraid version to right version

  • Author

Sep 17 18:12:56 P8H67 emhttp: run_cmd: invalid cmd: /etc/rc.d/rc.swapfile start (Other emhttp)

 

It is the new security changes implemented in unRAID 6.1 - Working on it...

 

i felt adventurous today so i uninstalled this plug... upgraded to 6.2

6.2? The latest public release as of today is 6.1.2.
  • Author

Updated Plugin:

 

2015.09.17

  - Add unRAID 6.1 compatibility and keep backward compatibility

 

Works :)

 

top - 10:01:53 up 21:32,  1 user,  load average: 2.59, 2.95, 2.99
Tasks: 289 total,   3 running, 286 sleeping,   0 stopped,   0 zombie
Cpu(s): 22.8%us, 44.7%sy,  0.0%ni, 31.8%id,  0.7%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   8177440k total,  8106480k used,    70960k free,   147872k buffers
Swap:  4194300k total,   311112k used,  3883188k free,  3601232k cached

 

Thanks Theone

 

 

i felt adventurous today so i uninstalled this plug... upgraded to 6.2

6.2? The latest public release as of today is 6.1.2.

 

LOL got carried away...

Too bad the dashboard don't show swap status in memory section....

 

Myk

 

Just updated to latest unRAID version and needed to reboot.

 

Swapfile was a disaster.  I have my swapfile on a SSD managed by unassigned devices.  The plugin needs to start later in the bootup sequence.  unassigned devices had this problem as well and moved to a different trigger.

 

essentially - needs to wait until all devices are mounted and available - otherwise it tries to make the swapfile in ram, runs out of space and causes everything else to fail.

 

Had to disable for now

 

Thanks

Myk

 

  • Author

Just updated to latest unRAID version and needed to reboot.

 

Swapfile was a disaster.  I have my swapfile on a SSD managed by unassigned devices.  The plugin needs to start later in the bootup sequence.  unassigned devices had this problem as well and moved to a different trigger.

 

essentially - needs to wait until all devices are mounted and available - otherwise it tries to make the swapfile in ram, runs out of space and causes everything else to fail.

 

Had to disable for now

 

Thanks

Myk

 

I will change the start event from "disks_mounted" to "started" and "unmounting_disks" to "stopping_svcs" like I did for the virtualbox plugin and Limetech do for the Docker and VMs.

 

Thanks Much

 

 

Myk

 

  • Author

Plugin updated:

 

2015.09.21

- Changed start and stop events to "started" and "stopping_svcs" instead of "disks_mounted" and "unmounting_disks" to allow all array and non-array disks to be mounted before creating/using swap file

 

  • 2 months later...

Plugin updated:

 

2015.09.21

- Changed start and stop events to "started" and "stopping_svcs" instead of "disks_mounted" and "unmounting_disks" to allow all array and non-array disks to be mounted before creating/using swap file

 

I'm running with this (clean install after removing swapfile.plg file and dir) and still having the same problem as MyKroFt. It starts on boot and not after the array is mounted. This is on unraid 6.1.6.

Kindly request ability to change vm.swappiness value from plugin GUI.  Thanks.

  • 1 month later...

Had some issues with my cache drive yesterday and ended up reformatting it. Now when I try to start the swap I get "swapon failed: Invalid argument". I am creating the swap on /mnt/cache as recommended and I didn't have any issues with the plugin until I reformatted the cache drive.

Any ideas?

 

Tried to do it manually via SSH and encountered the same error:

 

root@VOID:~# swapon -v /mnt/cache/swapfile

swapon on /mnt/cache/swapfile

swapon: /mnt/cache/swapfile: found swap signature: version 1, page-size 4, same byte order

swapon: /mnt/cache/swapfile: pagesize=4096, swapsize=4294967296, devsize=4294967296

swapon: /mnt/cache/swapfile: swapon failed: Invalid argument

 

  • Author

Had some issues with my cache drive yesterday and ended up reformatting it. Now when I try to start the swap I get "swapon failed: Invalid argument". I am creating the swap on /mnt/cache as recommended and I didn't have any issues with the plugin until I reformatted the cache drive.

Any ideas?

 

Tried to do it manually via SSH and encountered the same error:

 

root@VOID:~# swapon -v /mnt/cache/swapfile

swapon on /mnt/cache/swapfile

swapon: /mnt/cache/swapfile: found swap signature: version 1, page-size 4, same byte order

swapon: /mnt/cache/swapfile: pagesize=4096, swapsize=4294967296, devsize=4294967296

swapon: /mnt/cache/swapfile: swapon failed: Invalid argument

 

Try running swapoff on this swapfile and then swapon again.

 

Had some issues with my cache drive yesterday and ended up reformatting it. Now when I try to start the swap I get "swapon failed: Invalid argument". I am creating the swap on /mnt/cache as recommended and I didn't have any issues with the plugin until I reformatted the cache drive.

Any ideas?

 

Tried to do it manually via SSH and encountered the same error:

 

root@VOID:~# swapon -v /mnt/cache/swapfile

swapon on /mnt/cache/swapfile

swapon: /mnt/cache/swapfile: found swap signature: version 1, page-size 4, same byte order

swapon: /mnt/cache/swapfile: pagesize=4096, swapsize=4294967296, devsize=4294967296

swapon: /mnt/cache/swapfile: swapon failed: Invalid argument

 

Try running swapoff on this swapfile and then swapon again.

Same issue. It will create the swap file fine but it won't start it. Let me know what info you might need from me to troubleshoot.

 

root@VOID:~# swapoff -v /mnt/cache/swapfile

swapoff on /mnt/cache/swapfile

swapoff: /mnt/cache/swapfile: swapoff failed: Invalid argument

root@VOID:~# swapon -v /mnt/cache/swapfile

swapon on /mnt/cache/swapfile

swapon: /mnt/cache/swapfile: found swap signature: version 1, page-size 4, same byte order

swapon: /mnt/cache/swapfile: pagesize=4096, swapsize=4294967296, devsize=4294967296

swapon: /mnt/cache/swapfile: swapon failed: Invalid argument

 

 

  • 3 weeks later...

Had some issues with my cache drive yesterday and ended up reformatting it. Now when I try to start the swap I get "swapon failed: Invalid argument". I am creating the swap on /mnt/cache as recommended and I didn't have any issues with the plugin until I reformatted the cache drive.

Any ideas?

 

Tried to do it manually via SSH and encountered the same error:

 

root@VOID:~# swapon -v /mnt/cache/swapfile

swapon on /mnt/cache/swapfile

swapon: /mnt/cache/swapfile: found swap signature: version 1, page-size 4, same byte order

swapon: /mnt/cache/swapfile: pagesize=4096, swapsize=4294967296, devsize=4294967296

swapon: /mnt/cache/swapfile: swapon failed: Invalid argument

 

Try running swapoff on this swapfile and then swapon again.

Same issue. It will create the swap file fine but it won't start it. Let me know what info you might need from me to troubleshoot.

 

root@VOID:~# swapoff -v /mnt/cache/swapfile

swapoff on /mnt/cache/swapfile

swapoff: /mnt/cache/swapfile: swapoff failed: Invalid argument

root@VOID:~# swapon -v /mnt/cache/swapfile

swapon on /mnt/cache/swapfile

swapon: /mnt/cache/swapfile: found swap signature: version 1, page-size 4, same byte order

swapon: /mnt/cache/swapfile: pagesize=4096, swapsize=4294967296, devsize=4294967296

swapon: /mnt/cache/swapfile: swapon failed: Invalid argument

 

Exactly the same problem. It was working before I change my cache drive (SSD on XFS to SSD on btrfs)

 

Is there any problem with btrfs format ??

Is there any problem with btrfs format ??

 

Swapfiles aren't supported on btrfs format disks. Look back a couple of pages in this thread.

  • 2 weeks later...

Hopefully in the future

 

https://btrfs.wiki.kernel.org/index.php/FAQ#Does_btrfs_support_swap_files.3F

 

best way on a btrfs right now they say is to do it via a loop file - like the current docker/vm images are mounted

 

dont know if that method can be easily added to this plugin or not

 

Sounds like not a good idea on btrfs at all according to this:

 

Swap file

 

As an alternative to creating an entire partition, a swap file offers the ability to vary its size on-the-fly, and is more easily removed altogether. This may be especially desirable if disk space is at a premium (e.g. a modestly-sized SSD).

 

Warning: Btrfs does not support swap files. Failure to heed this warning may result in file system corruption. While a swap file may be used on Btrfs when mounted through a loop device, this will result in severely degraded swap performance.

 

Swap file creation

 

As root use fallocate to create a swap file the size of your choosing (M = Megabytes, G = Gigabytes). For example, creating a 512 MB swap file:

 

# fallocate -l 512M /swapfile

 

Note: fallocate may cause problems with some file systems such as F2FS or XFS.[1] As an alternative, using dd is more reliable, but slower:

 

# dd if=/dev/zero of=/swapfile bs=1M count=512

 

Set the right permissions (a world-readable swap file is a huge local vulnerability)

 

# chmod 600 /swapfile

 

After creating the correctly sized file, format it to swap:

 

# mkswap /swapfile

 

Activate the swap file:

 

# swapon /swapfile

 

Myk

 

  • 2 months later...

Just as a confirmation to anyone needing it, i'm running the latest beta 21 and have just set up a 32GB swap file on my NVMe drive with no issues, htop reports the 32GB correctly so all seems to be working as expected

  • 5 months later...

I am also having the same problem with this plugin (invalid argument).

 

For now I just upgraded my ram to take care of hitting the old cap occasionally.

  • 4 months later...

Just installed this because my unraid server keeps crashing and I feel like its to do with running out of memory, it has created a 4gb swapfile on the btrfs cache drive, a few posts up suggests that this shouldn't work, is that still the case today?

 

Top shows the following:

Tasks: 433 total,   1 running, 432 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.1 us,  0.6 sy,  0.0 ni, 97.1 id,  1.1 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem : 20568732 total,   305412 free, 15428820 used,  4834500 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  4048564 avail Mem

 

Just changed it to /mnt/disk4/cache and now it shows:

 

Tasks: 454 total,   2 running, 452 sleeping,   0 stopped,   0 zombie
%Cpu(s):  2.3 us,  3.1 sy,  0.0 ni, 90.1 id,  4.4 wa,  0.0 hi,  0.2 si,  0.0 st
KiB Mem : 20568732 total,   943764 free, 15212644 used,  4412324 buff/cache
KiB Swap:  4194300 total,  3877760 free,   316540 used.  4246276 avail Mem

 

So I guess that means its working, could you put the swapfile on a flash drive formatted as vfat?

Edited by Spies

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.