Server Fault is a question and answer site for system and network administrators. 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

On some of my Linux servers, the swap partition is misaligned. I understand how partition alignment affects performance on mounted file systems with 4k block sizes, but I am unsure if the same considerations apply to swap.

Does it even have a "block size" as such? Is there any performance benefit to aligning a swap partition one way or another?

share|improve this question
up vote 1 down vote accepted

Yes, swap partition alignment is important, but not very important.

Memory pages can be swapped only in whole. Considering that they can be 4k or 8k in most cases (depending on CPU architecture), you need to make sure that the partition has at least this kind of alignment.

With current disks it's best to align to 4MiB boundaries though. So you won't even need to know the size of your memory pages.

The system shouldn't swap under regular load, so swap alignment will have no visible difference, if it will have any effect at all.

share|improve this answer
All good, except for "The system shouldn't swap under regular load" -- while you shouldn't have a high swap rate, putting unused pages out to disk is a good thing, as it leaves more RAM for disk cache. – womble Mar 11 '12 at 11:57
The system may dribble swap out under normal load a bit. But the system shouldn't swap enough for swap performance to make any difference at all. But there is a myth that literally no swapping should occur under normal load, and that's false for precisely the reason womble mentioned. – David Schwartz Mar 11 '12 at 14:04

One more thing is that if you only have moderate load and a caching raidcontroller then the controller will happily work out the alignment issues for you. I've run into that when benchmarking well- and misaligned partitions on raid10. There was no difference ever at all, because the controller had enough idle time to cover up for it.

So, as with answer #0, it depends on your swap in/out ratio and system load. If the system's idle, it will all be fine, while if it's always under memory pressure then you should think about fixing it since it can cut your swap performance in half.

share|improve this answer

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.