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.

[Plugin] Swapfile for 6.9.1

Featured Replies

21 hours ago, primeval_god said:

I am glad it is working for you. I am however not the one to thank. I did not actually write this plugin, I just to over when it was abandoned.

Ture.  Well thanks for taking over the app and keeping it viable than 😊

  • 1 month later...
  • Replies 134
  • Views 40.2k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • This is interesting. . .Under what situations is this useful? How does Unraid manage swap files by default?

  • If you want to get in as early as possible during startup and as late as possible during shutdown then the best place for this would be the config/go and config/stop script files (the latter does not

  • The default for UnRaid is to run without a swap file as it is not needed for built-in functionality.    It only becomes potentially necessary when adding new application functionality to the basic bui

Posted Images

Has anyone had success with swap working in 6.12? I've got a docker container that I use it for and I get the following when updating the container:

WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
WARNING: Your kernel does not support memory swappiness capabilities or the cgroup is not mounted. Memory swappiness discarded.

 

  • Author
35 minutes ago, TheEyeTGuy said:

Has anyone had success with swap working in 6.12? I've got a docker container that I use it for and I get the following when updating the container:

WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
WARNING: Your kernel does not support memory swappiness capabilities or the cgroup is not mounted. Memory swappiness discarded.

 

So far as i know swap works just fine on 6.12, the issue is whether or not docker supports limiting swap access to containers. See my answer here.

 

If it does work, its not working for my docker containers, I can also confirm the docker container is not respecting its memory limit configuration (limited to 8 gigs, but uses more than that). Bug in 6.12.x?

Good day, would the plugin work on a zfs formatted cache drive? 

Thank you 

  • Author
2 hours ago, juan11perez said:

Good day, would the plugin work on a zfs formatted cache drive? 

Thank you 

To my knowledge swapfiles are not supported on the zfs filesystem.

  • Author
2 hours ago, TheEyeTGuy said:

If it does work.

I am almost certain that it does, in that the only thing this plugin does is allow the management of a swapfile and enable swap in unraid.

 

2 hours ago, TheEyeTGuy said:

its not working for my docker containers.

Correct, unRAID 6.12 moved to cgroupv2 and for some reason docker is unable to set swap limits using it. I dont know if it is a configuration issue with docker or cgroups, a limitation of the docker version used, or something else.

 

2 hours ago, TheEyeTGuy said:

Bug in 6.12.x?

So far as I can tell its not a bug in this plugin. Its also unlikely to be considered a bug in unRAID as support for swap has never been an official feature.

If someone knows or can figure out what needs to be changed to restore swap limit support for docker in unRAID 6.12 we can likely get limetech to make a fix. Cgroup stuff however is way above my head.

1 hour ago, primeval_god said:

I am almost certain that it does, in that the only thing this plugin does is allow the management of a swapfile and enable swap in unraid.

 

Correct, unRAID 6.12 moved to cgroupv2 and for some reason docker is unable to set swap limits using it. I dont know if it is a configuration issue with docker or cgroups, a limitation of the docker version used, or something else.

 

So far as I can tell its not a bug in this plugin. Its also unlikely to be considered a bug in unRAID as support for swap has never been an official feature.

If someone knows or can figure out what needs to be changed to restore swap limit support for docker in unRAID 6.12 we can likely get limetech to make a fix. Cgroup stuff however is way above my head.

Thanks for your response. Sorry if I offended you with some of my wording, did not mean any offense.

 

Docker can't control memory either now though, which regardless of swap, I think is something that could be considered a bug.

 

Cgroup stuff is also above my head. I appreciate your quick responses. On an unrelated note, is your source code published anywhere? I'd just like to poke around, for my own curiosity.

 

Thanks!

Edited by TheEyeTGuy

  • Author
1 hour ago, TheEyeTGuy said:

Thanks for your response. Sorry if I offended you with some of my wording, did not mean any offense.

 

Docker can't control memory either now though, which regardless of swap, I think is something that could be considered a bug.

 

Cgroup stuff is also above my head. I appreciate your quick responses. On an unrelated note, is your source code published anywhere? I'd just like to poke around, for my own curiosity.

 

Thanks!

No problem I did not mean to imply offense in my response, just trying to be specific as to where the issue is. The source for this plugin is here https://github.com/dcflachs/swapfile_plugin

  • Author
17 hours ago, TheEyeTGuy said:

I can also confirm the docker container is not respecting its memory limit configuration (limited to 8 gigs, but uses more than that).

How are you measuring how much memory it is using? Is the number you are seeing purely RAM or RAM+SWAP? Just as I am not clear on why swap limits dont work, I am also not clear on how docker containers interact with swap when limits are not settable. It is possible that even with a memory limit set a container has access to unlimited (except by the amount available on the system) swap space. Another possibility, based on how memory limits without swap limits work when swap limiting is available, is that the container has access to as much swap as its configured memory limit (meaning in your case the container would be able to use 8G RAM + 8G SWAP). 

  • 2 weeks later...

I am using UNRAID version 6.12.3 and enale 10Gb swapfile.

wap file exists: ✔

Swap file in use: ✔

Swap file location and filename: /mnt/disks/disco02/swapfile/swapfile
Swap file size: 10000.07 MB

used: 138.05 MB

used 1%

 

 

But Main not show swap memory.

 

 

6.13.3-memory.JPG

You can use the command below to view RAM and Swap usage.

free -m

 

  • Author
12 hours ago, Adriano Frare said:

But Main not show swap memory.

 

6.13.3-memory.JPG

This is correct. The plugin does not provide any integration with the unRAID dashboard, you can view swap usage in the swap plugin settings menu if need be.

Hey Guys, 

 

I got a "Out of Memory" Problem with my Unraid.

image.thumb.png.d31e06330d3386d1ee2d805ab97f061b.png

 

Jorge told me that i can try a Swap File / Plugin.

But I dont have a clue what that Plugin exactly does and what Cons I might get when using it.

 

Would this Plugin help me get rid of that Error?

If yes, maybe someone here can tell me what I need to do without breaking my Config/Machine?

I'm really afraid of losing it :(

 

Thank you in advance

 

  • Author
On 7/23/2023 at 4:02 AM, Zeench said:

But I dont have a clue what that Plugin exactly does and what Cons I might get when using it.

If you are not familiar with swap you should do some googling to better understand computer memory systems (linux specifically). The basic idea though is that the OS can take the least recently used memory pages and move them from RAM into a file on a disk (the swapfile) in order to free up RAM. When the pages stored in the file are needed they get moved back into RAM and something else gets swapped out to disk.

The downside of this is that swapping data out to disk has a significant performance penalty. That is typically not a big deal for normal swap usage where swap contains rarely used data and you are mainly protecting against an app occasional using a ton of memory for a short time. Swap is not a good substituted for additional RAM on a system that is consistently memory constrained however.

 

On 7/23/2023 at 4:02 AM, Zeench said:

Would this Plugin help me get rid of that Error?

Yes it would, how well it performs however depends on exactly why you are running out of memory. If Jorge thinks it could help though its definitely worth a try. There is not really any risk to using this plugin that i can think of. You will need an xfs or btrfs formatted cache drive (preferably sdd) in your system to host the swap file.

Edited by primeval_god

Ty for the answer.

 

The Plugin wont work for me. It doesnt install the swapfile properly i guess.

image.thumb.png.b1a7a5411708f0f1d4de714c1c22c3e2.png

When i clock "Save below.... and install" it still shows the red X on the left side.

 

What did i do wrong?

I read in the help that it wont work on cachepools.

Im not running a pool, but i do run 2 seperate caches.

image.thumb.png.481a53b75c267e3c828edc01c3462772.png

 

What do i do wrong? Can u help me out here.

Thx again.

  • Author
32 minutes ago, Zeench said:

What did i do wrong?

I read in the help that it wont work on cachepools.

Im not running a pool, but i do run 2 seperate caches.

What do i do wrong? Can u help me out here.

Thx again.

The swapfile cannot be placed in the root directory of a cache drive on BTRFS. It must be placed in a subvolume. Best to specify a directory that does not already exist and allow the plugin to create the subvolume itself. I would suggest something like '/mnt/cache/system/swap/' Click the little help icon next to the location for further information on swapfile placement.

I would also recommend setting swappiness to something lower than 10 (i use 1) and setting 'start swapfile during array mount' to true. Finally you will need to click the start button to start the swapfile for the first time.

On 7/26/2023 at 6:08 PM, primeval_god said:

The swapfile cannot be placed in the root directory of a cache drive on BTRFS. It must be placed in a subvolume. Best to specify a directory that does not already exist and allow the plugin to create the subvolume itself. I would suggest something like '/mnt/cache/system/swap/' Click the little help icon next to the location for further information on swapfile placement.

I would also recommend setting swappiness to something lower than 10 (i use 1) and setting 'start swapfile during array mount' to true. Finally you will need to click the start button to start the swapfile for the first time.

Thank you very much.

The File got created, but it cant be used for some reason.

When i click start, nothing happens, just a quick reload of the plugin site...

Edited by Zeench

  • Author
13 hours ago, Zeench said:

Thank you very much.

The File got created, but it cant be used for some reason.

When i click start, nothing happens, just a quick reload of the plugin site...

What does the system log say?

On 7/30/2023 at 1:34 AM, primeval_god said:

What does the system log say?

Just this:

image.png.fcb5e85cf819ed64f8a5eb4e2785a001.png

  • Author
6 hours ago, Zeench said:

Just this:

image.png.fcb5e85cf819ed64f8a5eb4e2785a001.png

That would seem to indicate that the swapfile is active. On the command line you can run 'swapon -s' to confirm. Weird the that webpage does not update.

What swap file size would you recommend if I had 48 gigs total ram? Does the swap file size count as a total across the entire system or is the number inputted per docker? 

  • Author
46 minutes ago, DrSpaldo said:

Does the swap file size count as a total across the entire system or is the number inputted per docker? 

So far as the setting of this plugin are concerned the swap file size is the total amount of swap available to the system. 

48 minutes ago, DrSpaldo said:

What swap file size would you recommend if I had 48 gigs total ram?

I dont consider myself an expert on swap in linux. The amount of swap you need is less about your total amount of ram an more about your ram usage. In general you would want to keep your swap usage low. I wouldnt think you would need more than a few GB of swapspace. 2G-4G maybe?

17 hours ago, primeval_god said:

That would seem to indicate that the swapfile is active. On the command line you can run 'swapon -s' to confirm. Weird the that webpage does not update.

image.png.20c20915a518c83328c35f5752a31d79.png

 

Strange, it really seems to be in use.

But the Page still shows 

image.png.ffa2c7f9f46f1381925ec06d97cb29d4.png

 

While you guys were writing about the size.

I put mine  to 10GB, it doesnt have negative side effects to have it this big, right?

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.