= Software Raid on CentOS # Add harddisk # Check the disk that you add > fdisk -l Disk /dev/sda: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 2610 20860402+ 8e Linux LVM Disk /dev/sdb: 21.4 GB, 21474836480 bytes ######!!!! Added 20G Hard !!!!!######## 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdb doesn't contain a valid partition table > fdisk /dev/sdb n p 1 1 ### for same with sda1 ### 13 ### for same with sda1 ### n p 2 14 ### for same with sda2 ### 2610 ### for same with sda2 ### t 1 fd ### for RIAD ### t 2 fd ### for RIAD ### a ### for boot ### 1 p w ## Make RAID ## > mdadm --create /dev/md0 --auto=yes --level=raid1 --raid-devices=2 missing /dev/sdb1 > mdadm --create /dev/md1 --auto=yes --level=raid1 --raid-devices=2 missing /dev/sdb2 > echo 'DEVICE /dev/hd[a-z]* /dev/sd[a-z]*' > /etc/mdadm.conf > mdadm --detail --scan >> /etc/mdadm.conf > echo MAILADDR root >> /etc/mdadm.conf ## RAID for boot ## > mkfs -t ext3 /dev/md0 > mount /dev/md0 /mnt/ > rsync -avz -e ssh --delete /boot/ /mnt/ > umount /mnt/ > umount /boot/ > mount /dev/md0 /boot/ > vi /etc/fstab #LABEL=/boot /boot ext3 defaults 1 2 ### comment out ### /dev/md0 /boot ext3 defaults 1 2 ### ADD ### ## RAID FOR Volume ## > pvcreate /dev/md1 > vgextend VolGroup00 /dev/md1 > pvmove /dev/sda2 /dev/md1 > vgreduce VolGroup00 /dev/sda2 ## Reboot > mkinitrd -f /boot/initrd-`uname -r`.img `uname -r` ## when linux boot type e key grub edit> root (hd0,0) change hd0 to hd1 grub edit> root (hd1,0) #boot b > pvremove /dev/sda2 > fdisk -l /dev/sdb > fdisk /dev/sda p d 1 d p n p 1 1 13 p 2 14 2610 t 1 fd t 2 fd a 1 p w # ADD sda to md0 > mdadm /dev/md0 --add /dev/sda1 > mdadm /dev/md1 --add /dev/sda2 > watch cat /proc/mdstat # Instal grub > grub grub> root (hd1,0) grub> setup (hd1) grub> root (hd0,0) grub> setup (hd0) grub> quit > reboot > mount /dev/md0 /boot/