Page 1 of 1

Two swap space on two attached usb devices

Posted: Wed Jan 03, 2018 12:15 am
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!

Re: Two swap space on two attached usd devices

Posted: Wed Jan 03, 2018 3:10 am
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.

Re: Two swap space on two attached usb devices

Posted: Wed Jan 03, 2018 7:24 am
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?

Re: Two swap space on two attached usd devices

Posted: Wed Jan 03, 2018 8:28 am
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