Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I only recently realised that you can specify multiple swap partition, spreading them across drives. Well that's great for me as my desktop system often uses swap space and I have three different drives spread across two controllers. One of which is a dedicated raid5.If your curious, it's a retired server. :)

If you set them to the same priority it will "round-robin" them, or spread the workload between them. At least as I understand it.

Nonetheless, I can't seem to get both swap partitions to the same priority. Here is my fstab:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
/dev/sda1       /               ext4    errors=remount-ro,user_xattr 0       1
/dev/sdb1       none            swap    sw pri=1        0       0
/dev/sda3       none            swap    sw pri=1        0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0

I'm using swapoff -a and swapon -a to turn off then back on the swap files. When I use swapon -s I get:

Filename                Type        Size    Used    Priority
/dev/sdb1               partition   5855656 1408        -1
/dev/sda3               partition   2093052 0           -2

Any ideas why it's not setting the priority the same?

Thanks for any help.

share|improve this question

migrated from serverfault.com Dec 6 '11 at 23:17

This question came from our site for system and network administrators.

swapon -p 1 in order to do the changes without the fstab file, after it is working with that you change the fstab. – Hanan N. Dec 6 '11 at 23:28
up vote 7 down vote accepted

The options field in fstab is comma-delimited (note every other (non-swap) line). You have spaces.
Fix that and it should work as intended.

Red freehand circles!

share|improve this answer
after you change the fstab file, you shouldn't reboot your computer, just do swapon -a. – Hanan N. Dec 6 '11 at 23:25
Ah that worked great. I just need another pair of eyes to look at it. Thank you. – Alan B. Dee Dec 6 '11 at 23:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.