Swap File Plugin for unRAID v5 and v6


theone

Recommended Posts

  • 2 weeks later...
  • 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 comment

@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 comment
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
  • Like 1
Link to comment
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 comment
  • 2 months later...
On 5/3/2021 at 4:28 PM, primeval_god said:

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.

Last I checked which was 2-3 months ago I noticed the same, no support for swap file on BTRFS. As a workaround I've made a User Script to perform the commands from Archlinux wiki (some conditionally) during Array startup.

Edited by artafinde
Link to comment

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.