Swap File Plugin for unRAID v5 and v6


theone

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

  • Upvote 2
Link to comment

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

 

Link to comment

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

Link to comment

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.

 

Link to comment

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";

Link to comment

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.

Link to comment

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

Link to comment

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  ;))

Link to comment
  • 3 months later...

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.