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
- the representation of the data on disk not changing
- there being space to make a complete second copy
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
- dismount, fsck, and dump (just in case!) the FS in question.
- resize the FS down to make space for a 4K aligned 4K Persistent Super Block
at the end of the partition.
- 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.
- create a raidtab entry with the two disks, and mkraid it.
- manually fsck the new partition
- update /etc/fstab to use the new device name
- 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.
The alternative needs minor HACKs to the code to allow mkraid to set
up a raidset in degraded mode, with a failed (non) disk.
- Apply the patches.
- create a RAID1 partition with one disk and one `failed' disk.
- mount it, and copy (dump|restore, tar, or whatever) over the old data.
- set the new partition type to 0xfd.
- update /etc/fstab to use the new device name.
- unmount the old, raw partition (or reboot if that can't be done).
- `raidhotadd' the old partition.
- set the old partition type to 0xfd.