primeval_god Posted May 27, 2021 Share Posted May 27, 2021 (edited) Swapfile (Unraid 6.9.0 and up) This plugin adds swapfile creation and management to unRAID. This is a fork of the original "Swap File Plugin for unRAID" by @theone. The goal of this fork is to revamp the plugin for unRAID 6.9.0 and add support for swapfile creation on BTRFS drives. Notes: You must remove the original Swap File Plugin before installing this plugin. This plugin no longer contains the feature to auto-update on startup. Dont forget to check the help text. Limitations: When using BTRFS swapfiles should only be placed on single disk BTRFS drives. BTRFS drive pools with RAID will not work correctly. When using a BTRFS disk the swapfile must be in a subvolume. The plugin will automatically create a subvolume if it is allowed to create the folder in which the swapfile will be placed. Better handling of this requirement will be added soon. Edited December 2, 2021 by primeval_god Quote Link to comment
tk40 Posted May 30, 2021 Share Posted May 30, 2021 This is interesting. . .Under what situations is this useful? How does Unraid manage swap files by default? 2 Quote Link to comment
BVD Posted May 31, 2021 Share Posted May 31, 2021 18 hours ago, tk40 said: This is interesting. . .Under what situations is this useful? How does Unraid manage swap files by default? I'd foresee this being useful for memory constrained environments, especially when there's *fast* storage available. Say you have a system that's limited to 16GB of ram, whether that's because you're limited to dual channel memory on your platform, or because finding memory for your system just isn't cheap/easy (unbuffered ECC DIMMs can be difficult sometimes). You still want to use RAM transcoding, prefer to keep larger chunks in RAM with your preferred downloader to save writes to your NVME device, etc, but if you find that you're doing a couple transcodes at the same time you have a large-ish download coming through, you're bound to run out of RAM. Having a swap saves you from those situations - these days, and especially with PCIe gen 4, storage is approaching (far closer than ever before at least) RAM-like speeds. If you run a system that would only ever need 8-16GB of RAM like 90-95% of the time, it doesn't make much sense to double your memory when you can simply utilize NVMe storage you've already got to cover the gap. Quote Link to comment
itimpi Posted May 31, 2021 Share Posted May 31, 2021 19 hours ago, tk40 said: This is interesting. . .Under what situations is this useful? How does Unraid manage swap files by default? 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 built-in capabilities that can demand more RAM in aggregate than is physically present. 1 Quote Link to comment
EricD Posted June 3, 2021 Share Posted June 3, 2021 Could this be used to allow usenet to download directly to ram, and when the ram is full to continue via the swapfile? Quote Link to comment
itimpi Posted June 3, 2021 Share Posted June 3, 2021 17 minutes ago, EricD said: Could this be used to allow usenet to download directly to ram, and when the ram is full to continue via the swapfile? Probably not as the swap file is only used to swap out applications Quote Link to comment
primeval_god Posted June 3, 2021 Author Share Posted June 3, 2021 11 hours ago, itimpi said: 11 hours ago, EricD said: Could this be used to allow usenet to download directly to ram, and when the ram is full to continue via the swapfile? Probably not as the swap file is only used to swap out applications Actually I believe that when ram space is low any pages in ram (except maybe for some kernel stuff) are eligible to be written to swap. Theoretically if you have a swapfile active and are writing data to tmpfs those pages could make there way into the swapfile. That said i dont imagine performance would be that great, my experience with very large swapfiles (as big or bigger than system ram) hasnt been great. Might be worth trying though. Quote Link to comment
Adriano Frare Posted June 7, 2021 Share Posted June 7, 2021 I forget that remove the original Swap File Plugin before installing this plugin. And now, I the new app dont create swapfile and not save configuration. How I solve ? Thanks Quote Link to comment
primeval_god Posted June 7, 2021 Author Share Posted June 7, 2021 3 minutes ago, Adriano Frare said: I forget that remove the original Swap File Plugin before installing this plugin. And now, I the new app dont create swapfile and not save configuration. How I solve ? Thanks I suggest uninstalling both the new and old swap plugins, rebooting, and then installing the new plugin. That should clear things out. Quote Link to comment
Adriano Frare Posted June 8, 2021 Share Posted June 8, 2021 14 hours ago, primeval_god said: I suggest uninstalling both the new and old swap plugins, rebooting, and then installing the new plugin. That should clear things out. Dear friend, I put information but not save and this software information that file swap exist. Is there access log of plugin and verify problem ? Thanks for all. Quote Link to comment
primeval_god Posted June 8, 2021 Author Share Posted June 8, 2021 1 hour ago, Adriano Frare said: I put information but not save and this software information that file swap exist. Is there access log of plugin and verify problem ? The plugin logs to the main system log. Quote Link to comment
JibbsIsMe Posted June 9, 2021 Share Posted June 9, 2021 (edited) 13 hours ago, Adriano Frare said: Dear friend, I put information but not save and this software information that file swap exist. Is there access log of plugin and verify problem ? Thanks for all. I have the same problem. Don't see anything useful in the logs, as far as I can tell. Clicking save just resets everything. Swap file is never marked in use, no matter what I do. Unraid 6.9.2. All I get in logs is: Jun 8 21:04:30 Tower emhttpd: cmd: /usr/local/emhttp/plugins/swapfile/scripts/rc.swapfile start Jun 8 21:04:30 Tower rc.swapfile[48338]: Creating swap file / please wait ... Jun 8 21:04:30 Tower rc.swapfile[48344]: Swap file / created and started Edited June 9, 2021 by JibbsIsMe Quote Link to comment
primeval_god Posted June 9, 2021 Author Share Posted June 9, 2021 @JibbsIsMe @Adriano Frare I have made an update to the plugin that i believe will address your issues. It is live now, try it out when you get a chance. Quote Link to comment
JibbsIsMe Posted June 9, 2021 Share Posted June 9, 2021 Saving works now, but now I get the error: swapfile must not be copy-on-write I am trying to put it on a "Pool Device" named "working" by using /mnt/working. It is a single disk. I am thinking that this might break one of the limitations mentioned in the first post, but I'm not sure. Quote Link to comment
primeval_god Posted June 9, 2021 Author Share Posted June 9, 2021 1 hour ago, JibbsIsMe said: Saving works now, but now I get the error: swapfile must not be copy-on-write I am trying to put it on a "Pool Device" named "working" by using /mnt/working. It is a single disk. I am thinking that this might break one of the limitations mentioned in the first post, but I'm not sure. No i think you have it correct, if using a BTRFS file system it MUST be a single device (rather than a BTRFS RAID pool). In this case you are hitting one of the limitations of the UI/Help that i havent figured out how to address (mostly inform the user of) yet. For swapfile to be used on BTRFS they must be placed in a non-COW subvolume of a BTRFS file system. I assume you are trying to do something like this /mnt/working/swapfile where swapfile is in the file name field and /mnt/working is in the path field. Instead you should have something like this /mnt/working/swapfile_dir/swapfile where swapfile_dir is a BTRFS subvolume (swapfile_dir can be whatever folder name you want). To achieve this put /mnt/working/swapfile_dir (note no trailing /) in the path field and the plugin will create the subvolume for you if no swapfile_dir folder exists. I am still trying to figure out the best way to guide the user through these steps in the plugin interface but i havent had much time to look at it. Quote Link to comment
JibbsIsMe Posted June 9, 2021 Share Posted June 9, 2021 You were exactly right! Subvolume is not a familiar term for me, if it said subfolder I might have understood better. I simply changed my path from /mnt/working to /mnt/working/swapfolder, and it worked! Quote Link to comment
primeval_god Posted June 10, 2021 Author Share Posted June 10, 2021 7 hours ago, JibbsIsMe said: You were exactly right! Subvolume is not a familiar term for me, if it said subfolder I might have understood better. Yeah thats part of what i need to figure out how to express in the plugin interface. It looks like a simple subfolder, but when we are talking about BTRFS it has to be a subvolume which is created differently than a normal subfolder. That is why it is important to let the plugin create the subfolder when the underlying filesystem is BTRFS. That said creating the subvolume manually is possible just a pain. Quote Link to comment
Debarka Banik Posted June 20, 2021 Share Posted June 20, 2021 Thank you for this. A couple of questions. What happens if I set "Delete Swap file upon Stop" to No? Is there any undesirable effect from this? I'm thinking from the perspective of avoiding unnecessary writes to an SSD. After setup, my status says swap file exists but not in use. I hope this means that the swap is ready to be used when needed and I don't have to do anything else? Quote Link to comment
primeval_god Posted June 22, 2021 Author Share Posted June 22, 2021 On 6/20/2021 at 1:13 PM, Debarka Banik said: What happens if I set "Delete Swap file upon Stop" to No? Is there any undesirable effect from this? That is how I use it. I am honestly not certain of the advantages of deleting it every on stop. This plugin is a fork of an existing swapfile plugin and that setting was carried over. On 6/20/2021 at 1:13 PM, Debarka Banik said: After setup, my status says swap file exists but not in use. I hope this means that the swap is ready to be used when needed and I don't have to do anything else? Unfortunately that likely means that something went wrong in attempting to start swap, check your logs for messages logged by the swapfile plugin. 1 Quote Link to comment
PeteAsking Posted August 25, 2021 Share Posted August 25, 2021 Can we use zram with unraid at all? Quote Link to comment
primeval_god Posted August 25, 2021 Author Share Posted August 25, 2021 Sorry @PeteAsking I do not know the answer to that other than to say that zram support is not part of this plugin. 1 Quote Link to comment
jerry49 Posted November 17, 2021 Share Posted November 17, 2021 @primeval_god Hi, I am new to unraid, where can I find URL of remote plugin file? Quote Link to comment
trurl Posted November 17, 2021 Share Posted November 17, 2021 51 minutes ago, jerry49 said: new to unraid, where can I find URL of remote plugin file? You should install CA (Community Applications) then install any plugins or dockers from the Apps page. https://unraid.net/community/apps 1 Quote Link to comment
Recommended Posts
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.