Round-robin SWAP

Linux specific questions/information are gathered here. The main thrust of topics are applied to Centos/RedHat(RH)/Debian/Ubuntu/Gentoo distributives

Round-robin SWAP

Postby lik » Sun Sep 20, 2009 6:42 pm

One useful thing in adding more swap on different disks is that you can have the kernel use the different locations in round-robin as RAID0 partition.

You can do that by editing the lines for the swap in /etc/fstab. You have to change the defaults option to pri=0 on all lines defining swap.

The trick aroung pri=0 is this:
Pri comes from priority, and thus defining the priority of the swap partition/file which will be used. Every swap partition has its own unique priority which tells the kernel when it will start using this swap partition/file. Using the defaults option causes every line defined in fstab to be with a lesser priority then the one before. This means that if you have three lines for swap in fstab the first line will be with greatest priority and the last line will be with lowest priority. The kernel starts writing to the swap partitions from the greatest(0) to the lowest priority and it switches to the next priority partitions/files only if the first one is already filled.

But if you have two or more lines defined with the same priority you will tell the kernel to use all of the partitions/files in a round-robin for reads/writes, this makes the swap faster.
lik
Founder
Founder
 
Posts: 497
Joined: Wed Dec 15, 2010 3:21 am

Return to Linux specific

 


  • Related topics
    Replies
    Views
    Last post
cron