Jump to content
theone

Swap File Plugin for unRAID v5 and v6

90 posts in this topic Last Reply

Recommended Posts

Hello,

 

I am proud to present:

SwapFile plugin for unRAID v5 and v6

 

If you are low on memory and would like to add a Swap File to your unRAID server this plugin makes it simpler.

The plugin enables creation/starting/stopping/changing of a Swap File on your unRAID server.

 

If this is your first plugin upgrade from version 0.5.3 or before to a newer version (supporting unRAID v6 plugin manager) then I suggest deleting the existing swapfile.plg file at /boot/config/plugins and then install as described below for unRAID v6 - all your settings should remain intact.

 

To install under unRAID v6:

1. In the unRAID Plugin Manager under "Install Plugin" tab enter https://raw.githubusercontent.com/theone11/swapfile_plugin/master/swapfile.plg

2. Wait for installation to complete.

3. Go to plugin WEGUI and change initial settings

 

To install under unRAID v5:

1. Initial Download of plugin at https://raw.githubusercontent.com/theone11/swapfile_plugin/master/swapfile.plg

2. Copy plugin to /boot/config/plugins on your flash drive.

3. Reboot unRAID server or Install from command line:

  - installplg /boot/config/plugins/swapfile.plg

  - /etc/rc.d/rc.swapfile boot

4. Go to plugin WEGUI and change initial settings

 

To update the plugin:

* For WEBUI and functionality updates - Use the unRAID Plugin Manager or the VirtualBox Plugin WEBUI

* For new Virtualbox compiled packages - Use the VirtualBox Plugin WEBUI

 

The WEBUI is divided into 3 parts:

----------------------------------

1. Status Summary - Shows status of configured Swap File and plugin version.

2. Actions - Shows all possible actions available to the user depending on the status of the user's server.

  - Start/Stop/Restart Swap File.

  - Update plugin.

3. Configuration - Change settings of the plugin and Swap File.

 

Configuration Notes:

--------------------

1. Boot and Startup options - Change what happens during boot or installplg.

2. Swap file settings - Change Swap File location, name, etc...

  - Default Swap File location is on the Cache Drive - Change it if you must.

 

Please comment on any problems encountered and any enhancements or missing features, that you would like added.

(Here if possible: https://github.com/theone11/swapfile_plugin/issues)

 

Changelog:

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

2015.09.17

  - Add unRAID 6.1 compatibility and keep backward compatibility

2015.06.05

  - Added launch option from plugin manager (unRAID v6)

  - Changed package version to same as plugin version

2015.04.22 - Added support for unRAID v6 Plugin Manager and Architecture

                - Changed timeout to 10 seconds for all network connections (was 60 seconds)

0.5.3 - Added 60 second timeout to all network accesses[/b]

        - Added comment regarding swap file location in WEBUI[/b]

0.5.2 - Fixed bottom of page is sometimes not visible due to unRAID progressframe

0.5.1 - Fixed division by zero in usage percentage calculation for usage bar

0.5  - Added existance check before deleting swap file

        - Cleaned up temporary file.

0.4.4 - Fixed: Icon file couldn't be saved because plugin folder doesn't exist on first run

0.4.3 - Fixed: Icon file deleted when upgrading plugin without restarting server

0.4.1 - Fixed: local plugin version not shown

0.4    - Workaround for downloading non exiting icon file

0.3    - Fixed startup sequence - Swap file must be activated only after array mounted

0.2.1 - Changed SWAP_ENABLE_ON_BOOT default value to "false"

0.2    - Initial Release

 

Enjoy the plugin  :)

 

Note:

-----

I used cofin's initial plugin (http://lime-technology.com/forum/index.php?topic=23515.0) and Joe L's unmenu swap file plugin as reference.

Swap_File.png.ad94aa28bb18dbd2c977fdae753affe4.png

Swap_File_screenshot.png.c9115df192ff4e952be46ea3e85428d6.png

Share this post


Link to post

Working for me. At first I tried to increase the size but I closed the page before it finished and that didn't work so I tried again and waited for it and it works.

 

Thanks

 

Share this post


Link to post

suggestion - the start swap on boot/installplg should prob default to off upon initial install - that way it dont sit there and create a swap file on the cache drive that if the user does not correct will get moved off via the mover.....?

 

Otherwise - nice plugin

 

Myk

 

Share this post


Link to post

suggestion - the start swap on boot/installplg should prob default to off upon initial install - that way it dont sit there and create a swap file on the cache drive that if the user does not correct will get moved off via the mover.....?

 

Otherwise - nice plugin

 

Myk

 

Thank you for the comment - done

 

Share this post


Link to post

New plugin version 0.3.

 

Please update - startup sequence changed (previous version caused my server to slow down).

 

Share this post


Link to post

I'm having an issue with this, perhaps it's on my end since my power went out twice today...

 

installing plugin: swapfile
file /tmp/swapfile-cleanup: successfully wrote INLINE file contents
  /bin/bash /tmp/swapfile-cleanup ... success
file /boot/config/plugins/swapfile/swapfile.cfg: successfully wrote INLINE file contents
file /etc/rc.d/rc.swapfile: successfully wrote INLINE file contents
  successfully changed file mode
file /usr/local/emhttp/plugins/swapfile/event/disks_mounted: successfully wrote INLINE file contents
  successfully changed file mode
file /usr/local/emhttp/plugins/swapfile/event/unmounting_disks: successfully wrote INLINE file contents
  successfully changed file mode
file /usr/local/emhttp/plugins/swapfile/swapfile.page: successfully wrote INLINE file contents
file /usr/local/emhttp/plugins/swapfile/swapfile.png: 
Warning: copy(/boot/config/plugins/swapfile/swapfile.png): failed to open stream: No such file or directory in /usr/local/sbin/installplg on line 42
unable to copy LOCAL file

Share this post


Link to post

Working great, thank you! Is there any benefit to deleting the swap file when I stop the array? Can I continue to use the one I already created? And I would assume I want "Start Swap file during array mount" on that way it's enabled when I start up?

Share this post


Link to post

Working great, thank you! Is there any benefit to deleting the swap file when I stop the array? Can I continue to use the one I already created? And I would assume I want "Start Swap file during array mount" on that way it's enabled when I start up?

 

From testing done here: http://lime-technology.com/forum/index.php?topic=23515.0

It seems OK to keep previous file - I added the option if future problems occur.

 

The option to enable the swapfile upon mount should usually be set to "YES" unless you don't want to automatically use a swap file.

 

Share this post


Link to post

New version 0.4.3 - Fixed: Icon file deleted when upgrading plugin without restarting server

Share this post


Link to post

Tried to install on unRAID 5.0rc11 and got this:

 

root@Tower1:/boot/config/plugins# installplg swapfile

installing plugin: swapfile

xml parse error

 

Thanks, Reed

Share this post


Link to post

Tried to install on unRAID 5.0rc11 and got this:

 

root@Tower1:/boot/config/plugins# installplg swapfile

installing plugin: swapfile

xml parse error

 

Thanks, Reed

 

Try: installplg swapfile.plg

 

Share this post


Link to post

Tried to install on unRAID 5.0rc11 and got this:

 

root@Tower1:/boot/config/plugins# installplg swapfile

installing plugin: swapfile

xml parse error

 

Thanks, Reed

 

Try: installplg swapfile.plg

 

 

That did the trick.

 

Thanks again, Reed

Share this post


Link to post

New version:

0.4.4 - Fixed: Icon file couldn't be saved because plugin folder doesn't exist on first run.

Share this post


Link to post

New version:

0.5  - Added existance check before deleting swap file

      - Cleaned up temporary file.

Share this post


Link to post

with swap file not in use - get the following error:

 

Warning: Division by zero in /usr/local/emhttp/plugins/swapfile/swapfile.php on line 38

 

when swap- file is use - error does not show up

 

Myk

 

Share this post


Link to post

with swap file not in use - get the following error:

 

Warning: Division by zero in /usr/local/emhttp/plugins/swapfile/swapfile.php on line 38

 

when swap- file is use - error does not show up

 

Myk

 

I get the same thing but didn't worry about it as everything seems to be working correctly.

Share this post


Link to post

I didnt really either - but the error pushing everything down and puts some of the buttons below the bottom of my firefox screen where i cant click them.

 

Myk

 

Share this post


Link to post

Here's a patch for the division by zero problem:

 

--- swapfile.php.orig	2013-02-24 12:43:02.000000000 -0500
+++ swapfile.php	2013-02-24 12:43:02.000000000 -0500
@@ -35,7 +35,9 @@
}
shell_exec("rm --force /tmp/swapfile_summary.txt");

-$percentage = round(((float)$swapfile_usage)/((float)$swapfile_size)*100);
+$percentage = 0;
+if ($swapfile_size > 0)
+  $percentage = round(((float)$swapfile_usage)/((float)$swapfile_size)*100);

$control_actions_exist = "false";
$version_actions_exist = "false";

Share this post


Link to post

Here's a patch for the division by zero problem:

 

--- swapfile.php.orig	2013-02-24 12:43:02.000000000 -0500
+++ swapfile.php	2013-02-24 12:43:02.000000000 -0500
@@ -35,7 +35,9 @@
}
shell_exec("rm --force /tmp/swapfile_summary.txt");

-$percentage = round(((float)$swapfile_usage)/((float)$swapfile_size)*100);
+$percentage = 0;
+if ($swapfile_size > 0)
+  $percentage = round(((float)$swapfile_usage)/((float)$swapfile_size)*100);

$control_actions_exist = "false";
$version_actions_exist = "false";

 

New version released:

0.5.1 - Fixed division by zero in usage percentage calculation for usage bar.

Share this post


Link to post

ok, still getting bottom of screen cut off, - this happens in moth my firebox and chrome browsers.

 

Its even worse if there is a button there to install a newer plugin version

 

screen shot attached

 

Myk

 

ps even tho its a different plugin - this problem is also in the virtual box one - just need to add some black space below everthing

errorscreen.png.4fe3fb06927818df46657e085ab44334.png

Share this post


Link to post

ok, still getting bottom of screen cut off, - this happens in moth my firebox and chrome browsers.

 

Its even worse if there is a button there to install a newer plugin version

 

screen shot attached

 

Myk

 

ps even tho its a different plugin - this problem is also in the virtual box one - just need to add some black space below everthing

 

New version 0.5.2 - Fixed bottom of page is sometimes not visible due to unRAID progressframe

 

(also for virtualbox plugin  ;))

Share this post


Link to post

Anyone else getting

 

swapon: swapfile has holes

 

in their syslog when attempting to start the swapfile?  It used to work, but I had to replace my cache after a drive failure, and now no matter how many times I try, i get this error...

Share this post


Link to post

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.