This is the exact steps I took for anyone needing them:
1 (install mdadm and set up kernel modules):
Code:
apt-get install mdadm
modprobe linear
modprobe multipath
modprobe raid0
modprobe raid1
modprobe raid5
modprobe raid6
modprobe raid10
2 (set up RAID partitions on first drive):
Code:
fdisk /dev/sdb
n, p, 1, default, 31, a
n, p, 2, default, +2G
n, p, 3, default, default
t, 1, fd, t, 2, fd, t, 3, fd
w
3 (copy RAID partitions to second drive):
Code:
sfdisk -d /dev/sdb | sfdisk --force /dev/sdc
4 (set up the mdadm devices):
Code:
mdadm --create /dev/md0 --level=1 --raid-disks=2 /dev/sdb1 /dev/sdc1
mdadm --create /dev/md1 --level=1 --raid-disks=2 /dev/sdb2 /dev/sdc2
mdadm --create /dev/md2 --level=1 --raid-disks=2 /dev/sdb3 /dev/sdc3
5 (set up the filesystems):
Code:
mkfs.ext4 /dev/md0
mkswap /dev/md1
mkfs.ext4 /dev/md2
6 (set up mdadm auto configure):
Code:
mdadm --examine --scan >> /etc/mdadm/mdadm.conf
7 (mount the mdadm devices):
Code:
mkdir /mnt/md0
mkdir /mnt/md2
mount /dev/md0 /mnt/md0
mount /dev/md2 /mnt/md2
8 (set up fstab):
Edit so /, /boot and swap point to the arrays.
Code:
/dev/md2 / ext4 errors=remount-ro 0 1
/dev/md0 /boot ext4 defaults 0 2
/dev/md1 none swap sw 0 0
9 (set up mtab):
Edit so that / and /boot point to the arrays.
Code:
/dev/md2 / ext4 rw,errors=remount-ro 0 0
/dev/md0 /boot ext4 rw 0 0
10 (set up grub2 custom entry):
Code:
cp /etc/grub.d/40_custom /etc/grub.d/09_swraid1_setup
nano /etc/grub.d/09_swraid1_setup
Add to the bottom:
Code:
menuentry 'Ubuntu, with Linux 2.6.38-8-server' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod raid
insmod mdraid1x
insmod ext2
set root='(md/0)'
linux /vmlinuz-2.6.38-8-server root=/dev/md2 ro quiet
initrd /initrd.img-2.6.38-8-server
}
11 (set up grub2):
Code:
nano /etc/default/grub
Uncomment:
Code:
GRUB_DISABLE_LINUX_UUID=true
12 (update grub2 and initrd):
Code:
update-grub
update-initramfs -u
13 (copy the data over to the RAID array):
Code:
cp -dpRx / /mnt/md2
cd /boot
cp -dpRx . /mnt/md0
14 (install grub2 on the RAID array member disks):
Code:
grub-install /dev/sdb
grub-install /dev/sdc
15 (booting into the RAID environment):
set boot device in BIOS to a RAIDed disk and continue booting.
15 (remove the grub2 custom entry (no longer needed)):
Code:
rm /etc/grub.d/09*
update-grub
update-initramfs -u
16 (ensure grub2 is installed on the RAID array member disks one last time):
Code:
grub-install /dev/sdb
grub-install /dev/sdc
17 (finish up):
Bookmarks