Two swap space on two attached usb devices

General discussion about Gargoyle, OpenWrt or anything else even remotely related to the project

Moderator: Moderators

Post Reply
ysy
Posts: 56
Joined: Sat Oct 28, 2017 12:24 pm
Location: Hong Kong !!

Two swap space on two attached usb devices

Post by ysy »

Hi All,

I created two swap partitions but cannot assign the same priority to both of them. With /dev/sda2 already setup as swap with priority -1, the command "swapon -p -1 /dev/sdb2" will only setup sdb2 at priority -2.

Quote: "One great thing about the Linux swapping subsystem is that if you mount two (or more) swap spaces (preferably on two different devices) with the same priority, Linux will interleave its swapping activity between them, which can greatly increase swapping performance. https://www.linux.com/news/all-about-linux-swap-space"

Thanks!
Last edited by ysy on Wed Jan 03, 2018 10:37 am, edited 1 time in total.

Lantis
Moderator
Posts: 6735
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Two swap space on two attached usd devices

Post by Lantis »

-p, --priority priority
Specify the priority of the swap device. priority is a value between 0 and 32767. Higher numbers indicate higher priority. See swapon(2) for a full description of swap priorities. Add pri=value to the option field of /etc/fstab for use with swapon -a.
Try it with positive numbers instead of negative as per the manual.
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

ysy
Posts: 56
Joined: Sat Oct 28, 2017 12:24 pm
Location: Hong Kong !!

Re: Two swap space on two attached usb devices

Post by ysy »

it worked!! thanks.

just found a site that says: If two or more areas have the same priority, and it is the highest priority available, pages are allocated on a round-robin basis between them.

btw, when the router reboots the priorities will be different again, right? is there a way to make this change permanent?
Last edited by ysy on Wed Jan 03, 2018 10:38 am, edited 1 time in total.

Lantis
Moderator
Posts: 6735
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Two swap space on two attached usd devices

Post by Lantis »

Find swap definition in /etc/config/fstab and add
priority 1

As an option. It is supported in the latest LEDE version, unsure about Gargoyle.
Try it and see
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

Post Reply