-   Linux - Software (
-   -   Software Raid Reconfiguration (

griffinmt 01-25-2007 02:36 PM

Software Raid Reconfiguration
Running Fedora V6

During the build, I configured to run software raid on my two scsi drives.
The boot partion was set for raid 1,
the swap partion was set as raid 0 on two identical partitions, and the remainder was set as raid 1.

I would like to completely reconfigure, in a somewhat non-disruptive manner.

As such I would like to stop the boot raid1 and result in just an ordinary boot partion on the hardware boot device, leaving the other piece unused and available to be 'reconfigured'. Not sure of the correct and safe way to do this.

Also would like to stop the raid0 setup for the swap partion, freeing up the second half and just use the first part as a normal swap space. Recognize that I will have to (likely) reboot when I do this!

Can anyone suggest the correct plan of attack. I am not used to the Linux 'mindset' yet, but do have experience with other platforms.


macemoneta 01-25-2007 04:38 PM

To remove a device from a RAID1 array (for example, /dev/hdb1 from /dev/md0):

Mark the device failed: mdadm /dev/md0 --fail /dev/hdb1
Remove the device from the array: mdadm /dev/md0 --remove /dev/hdb1

This will leave the array as if one of the devices failed (fully functioning, but degraded).

To remove the swap fram RAID0, (no reboot needed), assuming the RAID0 device is /dev/md1 composed of /dev/hda2 and /dev/hdb2:

Turn off swapping: swapoff -a
Stop the array: mdadm -S /dev/md1
Reinitialize the one device to use for swap: mkswap /dev/hda2
Change the swap device in the fstab: vi /etc/fstab
Start swapping in the device: swapon -a

That should do it.

griffinmt 01-25-2007 05:05 PM

Thanks for that simple straight forward answer.

I have done what you indicated and the results are as expected.

But it still leaves me with one remaining task.

I would like to remove the reference to md0 (and md2 in my case).
Rather than running as a failed set of raid 1 volumes, I would really like to revert it back to native volumes on sda1 and sda3.

I assume that I cannot just change the fstab entries from /dev/md0 to /dev/sda1 etc and reboot??!!


macemoneta 01-25-2007 05:22 PM

Actually, I suggest you leave it as is. There's no functional difference between a single device and a degraded RAID1, and this way you have the option of going back by adding a mirror drive again.

You could always copy the data to a newly formatted partition (remember to re-install grub if it's going to be a boot partition), but the only difference will be the name of the device, and the loss of the option to mirror.

You can always wipe it and do a clean install when you next upgrade (FC7 in April). :)

griffinmt 01-25-2007 06:06 PM

What will happen if I wish to alter one of those partition sizes (via gpartd or similar). Will it let me reference md2 and automagically adjust its single member sda3.

Or do I directly alter sd3 and md2 will automagically tag along (so to speak) :p

Either way, I feel a bit better about it all now.

macemoneta 01-25-2007 06:18 PM

I've never attempted to resize that way. Instead, I'd:

- split a mirror,
- create a new (resized) degraded array on one of the drives,
- copy the files over,
- redo the other drive,
- add the drive to the new array.

That way I'm always in a safe state.

griffinmt 01-26-2007 08:37 AM

Ok, when the time comes I'll cross my fingers;) and do it that way.


All times are GMT -5. The time now is 06:19 PM.