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]
link|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
feedback

1 Answer

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.

link|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
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.