Interleaved swap

Matthew Dillon dillon at
Mon May 2 10:04:35 PDT 2016

Yup, that's exactly how it works.  But there are some caveats... since it
is used as swap any disruption on the underlying drives can cause the
system to lock-up (i.e. system can get stuck trying to page-in random
programs).  So swap should only be configured on permanent storage devices
and not on things like usb keys (unless the usb drive is the only storage
for the entire system).

The second caveat is that although you can configure multiple swap devices
of dissimilar size, the interleaving mechanisms only work well when the
swap devices are each roughly the same size.

There are very few situations where one might need more than one swap
drive, particularly if the swap device is a SSD.  We generally configure
one swap device (on the SSD) even on our builder machines which use swap
heavily for tmpfs mounts.  The only machine we have two swap devices
configured for is our 48-core opteron.  That is mainly used in conjuction
with the 128G of ram as a disk cache (aka swapcache) to help cache a couple
of terrabytes of hard drive storage for the grok data sets.


On Mon, May 2, 2016 at 9:17 AM, Freddie Cash <fjwcash at> wrote:

> On Mon, May 2, 2016 at 12:56 AM, PeerCorps Trust Fund <
> ipc at> wrote:
>> Reading the online man pages concerning swapcache, there are a few
>> references to the interleaving of swap devices.
>> I am curious as to how this works in practice and how is it set up? Is
>> this somehow similar to striping swap across the two devices?
> ​Create a swap partition on diskA.
> Create a swap partition on diskB.
> Create a swap partition on diskC.
> Kernel will write swap data out to ​
> ​diskA, then diskB, then diskC, in parallel, similar to how a RAID0 stripe
> works.​  It's all handled automatically inside the kernel swap subsystem.
> --
> Freddie Cash
> fjwcash at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Users mailing list