Upgrading a non-raid system to raid is fairly easy and consists of several discrete steps described below. The description is for a system with a boot partition, root partition and swap partition.
OLD disk in the existing system: /dev/hda1 boot, may be dos+lodlin or lilo /dev/hda2 root /dev/hda3 swapWe will add an additional disk and convert the entire system to RAID1. You could easily add several disks and make a RAID5 set instead using the same procedure.
Download a clean kernel, raidtools-0.90 (or the most recent version), and the kernel patch to upgrade the kernel to 0.90 raid.
Compile and install the raidtools and READ the documentation.
Compile and install the kernel to support all the flavors (0/1/4/5 ?) of raid that you will be using. Make sure to specify autostart of raid devices in the kernel configuration. Test that the kernel boots properly and examine /proc/mdstat to see that the raid flavors you will use are supported by the new kernel.
The new disk will be added to an additional IDE controller as the master device, thus becomming /dev/hdc
/dev/hdc1 16megs -- more than enough for several kernel images /dev/hdc2 most of the disk /dev/hdc3 some more swap space, if needed. otherwise add to hdc2
Change the partition types for /dev/hdc1 and /dev/hdc2 to "fd" for raid-autostart.
Using the failed-disk parameter, create a raidtab for the desired RAID1 configuration. The failed disk must be the last entry in the table.
# example raidtab # md0 is the root array raiddev /dev/md0 raid-level 1 nr-raid-disks 2 chunk-size 32 # Spare disks for hot reconstruction nr-spare-disks 0 persistent-superblock 1 device /dev/hdc2 raid-disk 0 # this is our old disk, mark as failed for now device /dev/hda2 failed-disk 1 # md1 is the /boot array raiddev /dev/md1 raid-level 1 nr-raid-disks 2 chunk-size 32 # Spare disks for hot reconstruction nr-spare-disks 0 persistent-superblock 1 device /dev/hdc1 raid-disk 0 # boot is marked failed as well device /dev/hda1 failed-disk 1
Create the md devices with the commands:
mkraid /dev/md0 mkraid /dev/md1
The raid devices should be created and start. Examination of /proc/mdstat should show the raid personalities in the kernel and the raid devices running.
Format the boot and root devices with:
mke2fs /dev/md0 mke2fs /dev/md1Mount the new root device somewhere handy and create the /boot directory and mount the boot partition.
mount /dev/md0 /mnt mkdir /mnt/boot mount /dev/md1 /mnt/boot
This is pretty straightforward.
cd / # set up a batch file to do this cp -a /bin /mnt cp -a /dev /mnt cp -a /etc /mnt cp -a (all directories except /mnt, /proc, and nsf mounts) /mntThis operation can be tricky if you have mounted or linked other disks to your root file system. The example above assumes a very simple system, you may have to modify the procedure somewhat.
Make a boot floppy and rdev the kernel.
dd if=kernal.image of=/dev/fd0 bs=2k rdev /dev/fd0 /dev/md0 rdev -r /dev/fd0 0 rdev -R /dev/fd0 1
Modify the fstab on the RAID device to reflect the new mount points as follows:
/dev/md0 / ext2 defaults 1 1 /dev/md1 /boot ext2 defaults 1 1
Dismount the raid devices and boot the new file system to see that all works correctly.
umount /mnt/boot umount /mnt raidstop /dev/md0 raidstop /dev/md1 shutdown -r now
Your RAID system should now be up and running in degraded mode with a floppy boot disk. Carefully check that you transferred everything to the new raid system. If you mess up here without a backup, YOU ARE DEAD!
If something did not work, reboot your old system and go back and fix things up until you successfully complete this step.
Success in the previous step means that the raid array is now operational, but without redundancy. We must now re-partition the old drive(s) to fit into the new raid array. Remember that if the geometries are not the same, the the partition size on the old drive must be the same or larger than the raid partitions or they can not be added to the raid set.
Re-partition the old drive as required. Example:
/dev/hda1 same or larger than /dev/hdc1 /dev/hda2 same or larger than /dev/hdc2 /dev/hda3 anything left over for swap or whatever...
Change the failed-disk parameter in the raidtab to raid-disk and hot add the new (old) disk partitions to the raid array.
raidhotadd /dev/md1 /dev/hda1 raidhotadd /dev/md0 /dev/hda2Examining /proc/mdstat should show one or more of the raid devices reconstructing the data for the new partitions. After a minute or two... or so, the raid arrays should be fully synchronized (this could take a while for a large partition).
Using the procedure described in the first sections of this document, set up bootable raid on the new raid pair. Hang on to that boot floppy while setting up and testing this last step.
Закладки на сайте
Проследить за страницей
Created 1996-2023 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру