RAID on old CentOS 5.6 (boot and root partitions)

Old machine with CentOS 5.6 dies, and i make a decision to copy this system to a new mirroring raid array.
Lets starting…

--fdisk partitions with !!REQUIRED type (fd)!! (sd{a,b}1 for /boot, sd{a,b}2 for /)
fdisk /dev/sd{a,b}
--clean superblock
mdadm --zero-superblock /dev/sda{1,2}
mdadm --zero-superblock /dev/sdb{1,2}
--create arrays
mdadm --create --level=1 --raid-devices=2 /dev/md0 /dev/sda1 /dev/sdb1
mdadm --create --level=1 --raid-devices=2 /dev/md1 /dev/sda2 /dev/sdb2
--create filesystems
mkfs.ext3 -I 128 /dev/md0 (-I 128 required for /boot partition)
mkfs.ext3 /dev/md1 (for root partition)
--mount partitions
mkdir /123
mount /dev/md1 /123
mkdir /123/boot
mount /dev/md0 /123/boot
--rsync data
..... !!!--numeric-ids!!!
--mount proc sys dev
mkdir /123/proc /123/sys /123/dev
mount -o bind /dev /123/dev/
mount -t sysfs none /123/sys
mount -t proc none /123/proc
chroot /123
--edit fstab
!!first line --> partition for root!!
!!second line --> partition fot boot!!
...another partitions
--edit grub
--install grub
device (hd0) /dev/sda
device (hd1) /dev/sdb
root (hd0,0)
setup (hd0)
root (hd1,0)
setup (hd1)
--create mdadm config and flush mtab
mdadm --detail --scan > /etc/mdadm.conf
> /etc/mtab
--generate mkinitrd
mkinitrd -v --preload raid1 --force-raid-probe --with=raid1 --with=ata_piix --with=libata --fstab=/etc/fstab -f /boot/initrd-2.6.18-238.19.1.el5PAE.img 2.6.18-238.19.1.el5PAE

Leave a Reply