Migrating RAID Volumes Built Under the 0.4x (Old) Raid Tools to the 0.90
(New) Raid Tools
To test and illustrate this procedure I booted a brand new machine into the
2.2.16nfs3 kernel which uses the old RAID software, built a level 0 array
and populated it with data. I then booted the same machine into 2.2.16-cfht
which uses the new RAID software and converted the array using the following
procedure. I believe that there are other ways to do this operation but I've
tested this one and it does work; I "diff"ed the files in the array against
an identical file structure on another volume and there was no data corruption
and e2fsck reported no errors.
The old RAID software configures itself each time at startup via the /etc/mdtab
file which is created manually or by using the mdcreate utility. The new
software uses the /etc/raidtab file and self initializes at bootime using
persistent superblocks and the "linux raid autodetect" partition type, which
is mostly valuable for root filesystem arrays, and means the raidtab file
is no longer used after the array is first created.
The general technique I used was to create a raidtab file that described
the same array as the old mdtab file, then "create" the array with the new
raidtools. Since the interleaving algorithm is the same for both, a new array
is created which is identical to the old one and contains the original data.
Removing the mdtab file prevents the old raid software from being invoked
and the array is henceforth treated as a new type volume.
The mdtab and raidtab files are different syntactically but one can be manually
translated to the other. An mdtab type description specifies a level 0 array
like this:
/dev/md0 raid0,64k,0,cbb29e52 /dev/hda2
/dev/hdc2 /dev/hdd2 /dev/hde2 /dev/hdf2 /dev/hdg2 /dev/hdh2
Whereas a raidtab description of the same array would look like this:
raiddev /dev/md0
raid-level 0
nr-raid-disks 7
nr-spare-disks 0
chunk-size 64
# persistent-superblock 1
device /dev/hda2
raid-disk 0
device /dev/hdc2
raid-disk 1
device /dev/hdd2
raid-disk 2
device /dev/hde2
raid-disk 3
device /dev/hdf2
raid-disk 4
device /dev/hdg2
raid-disk 5
device /dev/hdh2
raid-disk 6
Note that the interleaving factor, or chunk-size is the same for both (64k),
and that a persistent-superblock is not used. I tried it and it works but
e2fsck complains about the superblock being incorrect though it shows no
other errors.
Partition types for the old arrays did not need to be "linux RAID autodetect"
because the software initialized the array via the mdtab file at startup.
For the new RAID tools to initialize however the partition types must be
set to autodetect, otherwise you will need to manually start the array after
each reboot or via an rc script. The partition type can be changed without
loosing any data.
To migrate and array such as the one above, first make a raidtab file from
the mdtab file. Move the mdtab file out of the way:
mv /etc/mdtab /etc/mdtab.old
Change the system to boot from the new kernel and reboot. When it is up simply
initialize the array with the new raidtools:
mkraid /dev/md0
Check it:
cat /proc/mdstat
Change the partition types to autodetect at this point if you feel comfortable
with it and reboot to make sure it starts itself O.K. Check dmesg to make
sure you have no errors.
-Kanoa