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

Can you remake the swap file?

Or is it a swap partition?

  • 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

It's a swapfile made by this plugin... 

 

I've tried deleting and using the GUI to recreate numerous times (about to try manually).

 

but as best as I can tell, the plugin is using the correct commands (as per a google search and what's in the plugin/rc.swapfile code):

 

# Create swap file
logger -trc.swapfile -plocal7.info -is "Creating swap file ${SWAP_LOCATION}/${SWAP_FILENAME} please wait ..."
dd if=/dev/zero of=${SWAP_LOCATION_NEW}/${SWAP_FILENAME_NEW} bs=1M count=${SWAP_SIZE_MB_NEW}
# Assign SWAP_NAME to the swap file
mkswap -L ${SWAP_NAME_NEW} ${SWAP_LOCATION_NEW}/${SWAP_FILENAME_NEW}
# Change swap file permissions as required
chmod 600 ${SWAP_LOCATION_NEW}/${SWAP_FILENAME_NEW}
# Turn on swap file usage
swapon -v ${SWAP_LOCATION_NEW}/${SWAP_FILENAME_NEW}
logger -trc.swapfile -plocal7.info -is "Swap file ${SWAP_LOCATION_NEW}/${SWAP_FILENAME_NEW} created and started"

There's a user-controllable flag in the plugin UI to control whether the swap lasts past array stop.  I have tried both deleting the swapfile on stop & keeping it.

 

The swap file is being created in /mnt/user/apps (which is a cache-only share).

 

The file's complete path is:

 

/mnt/user/apps/swapfile

 

It's on a brand-new, precleared drive (5400rpm laptop - don't think that matters) that was added when my old cache drive died (and when the plugin worked for me - i kept the swap file between array stop/starts)

OK that makes sense now.

Try creating on the disk mount point instead of the user share.

 

/mnt/cache/.swapfile or something like that.

 

What I've just read, is that it could be that the file system does not support swap.

 

usershare being a filesystem in user space.

 

I just created a swapfile manually on my /mnt/disk1/.swapfile and I was successful

well that did it :).  man, i wish i had my hours back...

 

I forgot to mention that OCD forced me to consolidate my plugins to always reference the same base path for app data:

 

/mnt/user/apps/

 

Prior to my drive crash, it was /mnt/cache/apps.  now that same ocd is wondering if I should switch them all to /mnt/cache...

 

Thanks so much!!!

I just tested this by hand, here are my results.

 

root@unRAID2:/# dd if=/dev/zero of=/mnt/user/swapfile bs=1M count=256

256+0 records in

256+0 records out

268435456 bytes (268 MB) copied, 3.08609 s, 87.0 MB/s

 

root@unRAID2:/# mkswap -L SWAP /mnt/user/swapfile

mkswap: /mnt/user/swapfile: warning: don't erase bootbits sectors

        on whole disk. Use -f to force.

Setting up swapspace version 1, size = 262140 KiB

LABEL=SWAP, UUID=77b9d51f-163b-43a8-8977-71b3e709470e

 

root@unRAID2:/# swapon -v /mnt/user/swapfile

swapon on /mnt/user/swapfile

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

swapon: /mnt/user/swapfile: pagesize=4096, swapsize=268435456, devsize=268435456

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

 

root@unRAID2:/# swapon -v /mnt/disk1/swapfile

swapon on /mnt/disk1/swapfile

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

swapon: /mnt/disk1/swapfile: pagesize=4096, swapsize=268435456, devsize=268435456

 

root@unRAID2:/# top -b | head

top - 20:16:42 up 2 days,  1:24,  3 users,  load average: 0.22, 0.12, 0.08

Tasks:  72 total,  1 running,  71 sleeping,  0 stopped,  0 zombie

Cpu(s):  0.0%us,  0.1%sy,  0.0%ni, 99.7%id,  0.1%wa,  0.0%hi,  0.0%si,  0.0%st

Mem:  4146032k total,  616828k used,  3529204k free,    7608k buffers

Swap:  262140k total,        0k used,  262140k free,  498764k cached

 

  • Author

I will add the comment for the limitation of not using a user share as a location to the plugin WEBUI for clarity.

 

Thank you WeeboTech for testing and finding this limitation.

  • Author

New version 0.5.3

  • Added 60 second timeout to all network accesses
  • Added comment regarding swap file location in WEBUI

New version 0.5.3

  • Added 60 second timeout to all network accesses
  • Added comment regarding swap file location in WEBUI

88892-thumbs_up.jpg

thx and HURRAY for the autoupdate feature :)

  • 2 weeks later...

does the file system need to be reiserfs for the swap file, or can I use ext?

  • 5 months later...

Works perfect, just what i was looking for. Thanks

  • 1 year later...
  • Author

Updated plugin. Now also supports unRAID v6 Plugin Manager.

 

Changes:

2015.04.22 - Added support for unRAID v6 Plugin Manager and Architecture
           - Changed timeout to 10 seconds for all network connections (was 60 seconds)

  • 3 months later...

Trying to get this to work.... will it work if the swapfile is in a hard drive that is ReiserFS (array drive) or BTRFS (my cache drive). My array drives are old and I rather not reformat.... I do have a new cache drive which is btrfs.

 

I created a new unRAID system for my sister, and it works perfectly if I store it to XFS formatted drive (array).

 

But I need this to work on my old system.

 

Please help.

 

Thanks!

 

 

  • Author

Mine is reiserfs and works perfectly. I actually never tried it on anything else.

Mine is reiserfs and works perfectly. I actually never tried it on anything else.

 

Thank you... going to re-install.

  • 3 weeks later...

Mine is reiserfs and works perfectly. I actually never tried it on anything else.

 

The plug-in is essentially broken under unRAID 6 because it defaults to creating the swap file on the cache drive without checking the filesystem format on that drive. The cache drive in turn now defaults to being btrfs formatted, which according to the swapon manpage does not support swap files. It gives the "swap file has holes" error. It would be nice if the plug-in checked first before creating the swap file and, on detecting an incompatible filesystem, warned the user and exited gracefully.

I've been searching this board for a reliable way to implement a swap space but I'm struggling because it contains a lot of outdated information. I don't want to use reiserfs at all and will stick with the default use of XFS on my data disks and btrfs on my cache disk so after a little thought I came up with the idea of using a swap partition on my cache disk. So I did a bit of searching to see if unRAID supports the idea.

 

This thread suggests that multiple partitions are supported as long as the cache is on partition 1. However this message, while confirming that it is theoretically possible, says that a bug was introduced back in 2011 that prevented it from working. Does anyone know the position with version 6.0.1 in 2015, please?

 

  • 2 weeks later...

is this plugin going to be updated to be 6.1 compat with the new security requirements?

 

Thanks

Myk

 

is this plugin going to be updated to be 6.1 compat with the new security requirements?

 

Thanks

Myk

 

Same question as my machines don't have that much ram

so before i upgrade i want to be sure about this

 

For the time being you can manual create the swap, http://lime-technology.com/forum/index.php?topic=39341, preferably on a cache drive

 

EDIT: Doing it this way, you'll have problems stopping the array if the swap file is located on the cache drive, so I guess we'll need an update to this plugin.

 

I'm assuming this plugin unmounts the swap file during array shutdown?

  • Author

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.

 

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.

 

THX.. waiting for the swap file one to be verified to upgrade to 6.1

 

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.