RAID boot

From Smop.co.uk

Jump to: navigation, search

Due to a broken motherboard I've bought a new motherboard and some more disks to move away from BIOS-level RAID to proper linux software RAID.

partition the disk using cfdisk:

  • /dev/sdc1, /dev/sdd1 (100MB, bootable, type=FD (linux raid)) - this will be /boot
  • /dev/sdc2, /dev/sdd2 (rest of disks, type=FD (linux raid)) - this will be LVMd into the rest

build arrays:

  • mdadm -C --level=1 --name=bootmd /dev/md/0 --raid-devices=2 /dev/sd[cd]1
  • mdadm -C --level=1 --name=bootmd /dev/md/1 --raid-devices=2 /dev/sd[cd]2

setup volume group:

  • pvcreate /dev/md/1
  • vgcreate rootvg /dev/md/1
  • lvcreate -L 5G -n rootlv rootvg
  • lvcreate -L 1G -n varlv rootvg
  • lvcreate -L 5G -n homelv rootvg

create filesystems:

  • mkfs.ext3 /dev/md0
  • mkfs.ext3 /dev/rootvg/rootlv
  • mkfs.ext3 /dev/rootvg/varlv
  • mkfs.ext3 /dev/rootvg/homelv

remove root only limts:

  • tune2fs -m0 /dev/rootvg/homelv

copy files across:

  • mount everything under /mnt
  • copy files using "cp -ax"

setup booting:

  • chroot /mnt
  • edit /etc/fstab appropriately
  • create MD raid array information
    • mdadm --detail --scan >> /etc/mdadm/mdadm.conf
  • rebuild initramfs (with mdadm, fstab information):
    • mkinitramfs -o /boot/initrd.img-`uname -r` `uname -r`
  • rebuild grub device map:
    • mv /boot/grub/device.map /boot/grub/device.map.old
    • grub (just quit)
  • edit /boot/grub/menu.lst:
  • # kopt=root=/dev/rootvg/rootlv ro
  • # groot=(hd2,0) (hd3,0) (look at device.map for these values)
  • grub-install /dev/sdc
  • grub-install /dev/sdd
  • reboot and change BIOS to boot off these disks
Personal tools