yum install mdadmfdiskn – new partitionp – primary1 … atdt – změnit typ partition na fdfd – Linux raid autodetectw – write and exitMAKEDEV md0 MAKEDEV md1 MAKEDEV md2 # /boot mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 missing /dev/hdc1 # / mdadm -C -v /dev/md1 -l 1 -n 2 missing /dev/hdc3 # /home mdadm -C -v /dev/md2 -l 1 -n 2 missing /dev/hdc4
mkfs.ext2 /dev/md0 mkfs.ext3 /dev/md1 mkfs.ext3 /dev/md2
mkinitrd /boot/initrd-md.img <aktuální verze jádra>
Systém si sám zjistí, že byl vytvořen raid a sám dá podporu do initrd.
grub.conf aby tam byly 2 volby pro boot z obou disků a aby se používal nový initrd s podporou poledefault=0
# pri absenci prvniho disku jdi na druhy
fallback 1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title hd0 - CentOS-4 i386 (2.6.9-22.EL)
root (hd0,0)
kernel /vmlinuz-2.6.9-22.EL ro root=/dev/md1
initrd /initrd-md.img
title hd1 - CentOS-4 i386 (2.6.9-22.EL)
root (hd1,0)
kernel /vmlinuz-2.6.9-22.EL ro root=/dev/md1
linux rescuemkdir /mnt/md mount -t ext3 /dev/md1 /mnt/md mkdir /mnt/md/boot mkdir /mnt/md/home mount -t ext2 /dev/md0 /mnt/md/boot mount -t ext3 /dev/md2 /mnt/md/home
#--delete maze soubory na cíli, které nejsou ve zdroji rsync -avH --delete --progress -x /mnt/sysimage/* /mnt/md
/etc/fstab - nahradit /dev/hdX na /dev/mdXmdadm /dev/md0 -a /dev/hda1 mdadm /dev/md1 -a /dev/hda3 mdadm /dev/md2 -a /dev/hda4
grub> device (hd0) /dev/hda grub> root (hd0,0) grub> setup (hd0,0) grub> device (hd1) /dev/hdc grub> root (hd1,0) grub> setup (hd1,0)
MAILADDR foo@bar.com
mdadm --manage -f /dev/md1 /dev/sdc2
mdadm /dev/md1 -r /dev/sdc2
mdadm /dev/md1 -a /dev/sdc2
mdadm --manage --stop /dev/mdX
mdadm --assemble /dev/md1 /dev/sda1 /dev/sdb1
mdadm --examine --scan >> /etc/mdadm/mdadm.conf
cat /proc/mdstatecho check > /sys/block/mdX/md/sync_action - spustí kontroluecho repair > /sys/block/mdX/md/sync_action - spustí kontrolu a snaží se opravit i případné chybybadblocks -o /var/log/badblock.log -snv /dev/sdb - testuje disk read/write nedestruktivní metodoubadblocks -o /var/log/badblock.log -swv /dev/sdb - testuje disk read/write DESTRUKTIVNÍ metodouumount /mnt/raid/
mdadm --manage /dev/md1 --stop
1258291200 / 5120 = 245 760mdadm --create --verbose /dev/md1 --level=5 --size=245760 --raid-devices=6 /dev/sda2 /dev/sdb2 /dev/sdc2 /dev/sdd2 /dev/sde2 /dev/sdf2
md1 : active raid5 sdf2[5] sde2[4] sdd2[3] sdc2[2] sdb2[1] sda2[0]
1228800 blocks level 5, 64k chunk, algorithm 2 [6/6] [UUUUUU]
Disk /dev/md1: 1258 MB, 1258291200 bytes
2 heads, 4 sectors/track, 307200 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 65536 bytes / 327680 bytes
Disk identifier: 0x0f70020c
mkfs.ext3 /dev/md1
mdadm --grow /dev/md1 --size=705598
md1 : active raid5 sdf2[5] sde2[4] sdd2[3] sdc2[2] sdb2[1] sda2[0]
3527680 blocks level 5, 64k chunk, algorithm 2 [6/6] [UUUUUU]
[==========>..........] resync = 53.5% (378112/705536) finish=0.0min speed=66176K/sec
Disk /dev/md1: 2516 MB, 2516582400 bytes
2 heads, 4 sectors/track, 614400 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 65536 bytes / 327680 bytes
Disk identifier: 0x19a069c8
umount /mnt/raid
e2fsck -f /dev/md1
resize2fs /dev/md1
e2fsck -f /dev/md1
mount /mnt/raid
grub> device (hd0) /dev/hda grub> root (hd0,0) Filesystem type is ext2fs, partition type 0xfd grub> setup (hd0) Checking if "/boot/grub/stage1" exists... yes Checking if "/boot/grub/stage2" exists... yes Checking if "/boot/grub/e2fs_stage1_5" exists... yes Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded succeeded Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/boot/grub/stage2 /boot/grub/grub.conf"... succeeded Done. grub> device (hd1) /dev/hdc grub> root (hd1,0) Filesystem type is ext2fs, partition type 0xfd grub> setup (hd1) Checking if "/boot/grub/stage1" exists... yes Checking if "/boot/grub/stage2" exists... yes Checking if "/boot/grub/e2fs_stage1_5" exists... yes Running "embed /boot/grub/e2fs_stage1_5 (hd1)"... 16 sectors are embedded. succeeded Running "install /boot/grub/stage1 (hd1) (hd1)1+16 p (hd1,0)/boot/grub/stage2 /boot/grub/grub.conf"... succeeded Done. grub> quit