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

I have a Ubuntu 11.10 headless machine setup with Software RAID 1. It has two drives, each drive has a main boot partition (sda1 & sdb1) and a small swap partition. I created a raid for the boot partitions (md0) but not for the swap partitions. OOpps!!?? The machine appears to be running fine, but how is the box handling swap? Is it striped, mirrored, or unused on one of the partitions. Should I create a second RAID for the swap partitions?

share|improve this question
I'm lost. You created the swap partition? or you didn't create a swap partition? – TheCompWiz Dec 14 '11 at 19:30
While installing the OS on that machine I created boot and swap partitions on both physical hardrives. I did not remember to setup RAID for those two swap partitions though...just the boot partitions. – Arwen Dec 14 '11 at 20:06
up vote 1 down vote accepted

swapon -s will show your current active swap setup. If you see both swap-partitions with the same priority the kernel will stripe across these swap-devices.

If you do not need swap (i.e. you have got enough free+cached ram to take up what is currently in swap), you can deactivate swap online: swapoff -a. If swap is in use it will take a moment to load the swapped areas into ram.

Now you can safely build your raid1, mkswap on that device, edit fstab and swapon -a. If you use swap as resume-device you need to reconfigure that as well to the new device.

share|improve this answer
That is exactly what I was looking for. I'll give it a go after doing a backup. Thanks everyone!!! – Arwen Dec 14 '11 at 20:22

Right now I believe it is using them as two separate swap partitions - you can have multiple. I don't think mirroring swap is absolutely essential, considering its just scratch data anyways. However to keep things consistent I'd do it anyways. HTH.

share|improve this answer
Depends on your commitment to "up-time". A failure of a disk with a swap volume = down until you get a replacement drive... or at the very least... a crash/reboot. mirroring your swap means you won't have a nasty crash if your disk fails. – TheCompWiz Dec 14 '11 at 19:41
Very good point. – Matthew Dec 14 '11 at 19:49
Can I create a second RAID for the swap partition now without too much risk of corruption? If so, can you lead me in the right direction? Would I use mdadm --create etc. while machine is running? – Arwen Dec 14 '11 at 19:56
I would definitely like the machine to keep running in the event of a drive failure and have everything perfectly mirrored. I don't care about performance or anything like that on this machine. – Arwen Dec 14 '11 at 19:58

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.