[Nottingham] swap on md raid?

Sergiusz Pawlowicz sergiusz at pawlowicz.name
Mon Aug 24 22:14:50 UTC 2009


On Mon, Aug 24, 2009 at 22:50, Martin<martin at ml1.co.uk> wrote:
> Folks,
>
> Anyone know if it is still a bad idea to put your swap partition on a
> linux md raid device (partition)?
>
> I remember reading of a corner case whereby the kernel can be forced
> into panic if the md raid requires a swap operation when the kernel is
> needing to service a pending swap operation... Is that still the case?
>
> How are you supposed to protect the swap from a disk death? Or is your
> system always doomed if you're using swap?

No, I have swap not only on MD raid, but looking higher also on LVM
and then encrypted partition, as swap often contents passwords and
other sensitive data:

# cat /etc/crypttab
# <target name> <source device>         <key file>      <options>
cswap /dev/vg/lvm1 /dev/urandom swap

#cat /etc/fstab | grep cswap
/dev/mapper/cswap       none            swap    sw              0       0

Of course we are talking about modern 2.6.x kernel, where x>=8

BTW, I use raid10,f2 for MD, as it looks it is currently the fastest
from safe arrays (reading is twice faster then raid1)

S.



More information about the Nottingham mailing list