Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Can anyone point in the right direction on how to remove SWAP out of a RAID1 configuration on Ubuntu 10.04 server? According to the Ubuntu Advanced installation guide, here, it said to add swap to the raid but I am having some serious performance issues. I would like to remove it from the array and recreate it, with the same size, on the two separate drives. Zero data loss on the other array is a must.

It's a remote computer so I would prefer to do it via command line if possible.

Here is the output from cat /proc/mdstat

md0 : active raid1 sdb1[1] sda1[0]
19530688 blocks [2/2] [UU]

md1 : active raid1 sdb21 sda2[0]
957230016 blocks [2/2] [UU]
share|improve this question
    
Err... is the swap partition one of the md0 or md1 arrays? What does swapon -s give you? –  Paul Oct 13 '11 at 5:25
    
The swap device is md0. –  thiesdiggity Oct 13 '11 at 12:56

1 Answer 1

up vote 0 down vote accepted

Assuming /dev/md0 is your swap as it is the smaller of the two, you can just disable swap, stop the array, and delete it:

swapoff -a

mdadm --stop /dev/md0
mdadm --remove /dev/md0

Then you can just fdisk sdb1 and sda1 and change their type to 82 (swap). Then swapon -a to activate. Change the fstab swap settings from /dev/md0 to /dev/sdb1 and duplicate the line for /dev/sda1.

None of this will impact /dev/md1.

share|improve this answer
    
Cool. Another question, do I need to do this by live cd or can I do it with a normal boot? –  thiesdiggity Oct 13 '11 at 12:57
    
You can do all of this in a normal session. The swapoff will reduce available "memory" - so if your physical ram is low this might impact running processes. But in general this is a low risk operation. –  Paul Oct 13 '11 at 22:25
    
Why not create them as RAID0 and get some performance out of it? –  Canadian Luke Mar 6 at 22:37
    
there is no need to RAID them. swap devices are striped by the kernel if they have equal priority. –  rogerovo Aug 17 at 19:17

Your Answer

 
discard

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.