Swap File Plugin for unRAID v5 and v6


theone

109 posts in this topic Last Reply

Recommended Posts

  • 2 weeks later...
  • Replies 108
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

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

No you definitely need to run mkswap on the file before using it. I didnt notice that the steps you had posted skipped that. Your missing steps are (note 1G for a 1GB swapfile).  

Posted Images

  • 4 weeks later...

Im having the same issue. 

 

Mine is set to "/mnt/cache-nvme/swap/" so I ran the below commands;

- cd /mnt/cache-nvme/swap/
- truncate -s 0 ./swapfile
- chattr +C ./swapfile
- btrfs property set ./swapfile compression none

 

everything looks fine, and I don't get any errors.

 

I see "Swap file exists: " but when I click "start" nothing happens and it still shows "Swap file in use: "

Link to post

@primeval_god thanks for the tip, I tried running the command and got the following output, and the swap is still not enabled. 
 

swapon: /mnt/cache-nvme/swap/swapfile: insecure permissions 0666, 0600 suggested.
swapon: /mnt/cache-nvme/swap/swapfile: read swap header failed


After some googling I see people using other Linux distorts running “mkswap”, but they are all referring to a swap partition. I’m not sure if that’s the correct fix for unraid. 

Link to post
Posted (edited)
On 5/1/2021 at 9:57 PM, relink said:

@primeval_god thanks for the tip, I tried running the command and got the following output, and the swap is still not enabled. 
 



swapon: /mnt/cache-nvme/swap/swapfile: insecure permissions 0666, 0600 suggested.
swapon: /mnt/cache-nvme/swap/swapfile: read swap header failed


After some googling I see people using other Linux distorts running “mkswap”, but they are all referring to a swap partition. I’m not sure if that’s the correct fix for unraid. 

No you definitely need to run mkswap on the file before using it. I didnt notice that the steps you had posted skipped that. Your missing steps are (note 1G for a 1GB swapfile).

Quote

fallocate -l 1G /mnt/cache-nvme/swap/swapfile

chmod 600 /mnt/cache-nvme/swap/swapfile

mkswap /mnt/cache-nvme/swap/swapfile

swapon /mnt/cache-nvme/swap/swapfile

 

Edited by primeval_god
Link to post
1 hour ago, primeval_god said:

No you definitely need to run mkswap on the file before using it.

Thank you for laying that out for me, I had no idea those steps were required to make this plugin work. But it is definitely working now.

 

oom errors are rare, but it's nice to have a safety net now. 

 

Screen Shot 2021-05-03 at 11.04.40 AM.png

Link to post
5 minutes ago, relink said:

I had no idea those steps were required to make this plugin work.

They are not meant to be required, I believe that this plugin just hasn't been updated to account for swap file support in BTRFS.

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.