Common Misconcentions and Understanding `mkraid aborted'
How to convert an existing file system to RAID1: neat and BFI copy
There are some questions which keep getting asked on linux-raid@vger.rutgers.edu so I thought I'd put my private answers here for those who are interested. See also some thoughts on HW RAID. For mainline info, see the definitive document.

Note that this related to raidtools 0.90 with the raid0145 patches available from http://www.(your country code).kernel.org/pub/linux/daemons/raid/alpha.

Common Misconcentions

mkraid is like fdisk, not like mkfs. It manipulate meta data outside the filing system, and does not touch the data of the partition itself (other than redundant [145] partitions, on which it will cause a resync).

Understanding `mkraid aborted'

This is Linux RAID speak for `go look in /var/log/messages to see why it failed'.

How to convert an existing file system to RAID1

This approach cannot be used for any other RAID system. It only works for RAID1, as it depends on one of

neat: resize2fs

I find this the more pleasing approach, but it requires a commercial program. Power Quest's Partition Magic is an excellent product, the only commercial package I have bought (other than Linux Distributions). It allows partitions (M$, ext2, etc) to be resized and (to some extent) moved. If you have to work with M$ at all, go get a copy !

It includes a Linux programme resize2fs which allows you to change the size of an (unmounted) ext2 FS. With this you can

  1. dismount, fsck, and dump (just in case!) the FS in question.
  2. resize the FS down to make space for a 4K aligned 4K Persistent Super Block at the end of the partition.
  3. as I am never 100% convinced that I know which way the kernel will `sync' mirrored disks, do a raw dd of the FS disk to the new disk.
  4. create a raidtab entry with the two disks, and mkraid it.
  5. manually fsck the new partition
  6. update /etc/fstab to use the new device name
  7. set the partition types to 0xfd
Things are a bit harder if it isn't `pure data' but is a root or /usr partition (e.g. you'll have to use a `rescue disk' or standalone Partition Magic), but it's much the same.

BFI: use `failed-disk' and copy the data

The alternative needs minor HACKs to the code to allow mkraid to set up a raidset in degraded mode, with a failed (non) disk.
  1. Apply the patches.
  2. create a RAID1 partition with one disk and one `failed' disk.
  3. mount it, and copy (dump|restore, tar, or whatever) over the old data.
  4. set the new partition type to 0xfd.
  5. update /etc/fstab to use the new device name.
  6. unmount the old, raw partition (or reboot if that can't be done).
  7. `raidhotadd' the old partition.
  8. set the old partition type to 0xfd.