/usr/share/doc/mdadm/README.recipes.gz
10. convert existing filesystem to RAID 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# The idea is to create a degraded RAID 1 on the second partition, move
# data, then hot add the first. This seems safer to me than simply to
# force-add a superblock to the existing filesystem.
#
# Assume /dev/sda1 holds the data (and let's assume it's mounted on
# /home) and /dev/sdb1 is empty and of the same size...
#
mdadm --create /dev/md0 -l1 -n2 /dev/sdb1 missing
mkfs -t /dev/md0
mount /dev/md0 /mnt
tar -cf- -C /home . | tar -xf- -C /mnt -p
# consider verifying the data
umount /home
umount /mnt
mount /dev/md0 /home # also change /etc/fstab
mdadm --add /dev/md0 /dev/sda1
Warren Togami has a document explaining how to convert a filesystem on
a remote system via SSH: http://togami.com/~warren/guides/remoteraidcrazies/
10b. convert existing filesystem to RAID 1 in-place
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In-place conversion of /dev/sda1 to /dev/md0 is effectively
mdadm --create /dev/md0 -l1 -n2 /dev/sda1 missing
however, do NOT do this, as you risk filesystem corruption.
If you need to do this, first unmount and shrink the filesystem by
a megabyte (if supported). Then run the above command, then (optionally)
again grow the filesystem as much as possible.
Do make sure you have backups. If you do not yet, consider method (10)
instead (and make backups anyway!).
11. convert existing filesystem to RAID 5/6
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# See (10) for the basics.
mdadm --create /dev/md0 -l5 -n3 /dev/sdb1 /dev/sdc1 missing
#mdadm --create /dev/md0 -l6 -n4 /dev/sdb1 /dev/sdc1 /dev/sdd1 missing
mkfs -t /dev/md0
mount /dev/md0 /mnt
tar -cf- -C /home . | tar -xf- -C /mnt -p
# consider verifying the data
umount /home
umount /mnt
mount /dev/md0 /home # also change /etc/fstab
mdadm --add /dev/md0 /dev/sda1
------------------------------------------------------------------------------
www.woodmann.com/searchlores/welcome.htm