I just installed Arch Linux on a RAID1+LVM, which involved some work. There already is a nice article about it, but I wanted to summarize for myself.
Arch has no GUI or menu for you to do this. So, when the installer has started, just go to another VT and create the RAID+LVM.
In my first attempt, I created one RAID partition with LVM, from which I intended to boot using Grub2, since it understands LVM and RAID. However, the grub installer kept saying there was no mapping for /dev/mapper/lvmroot or something, so I decided to make two partitions: one boot and one rest, which was meant as physical volume for the LVM. The advantage of linux software raid (when you store the superblock at the end of the partition, at least), is that grub can access it like a normal disk; it doesn’t need to know RAID).
After the array was made using something like:
mdadm --create /dev/md0 -l 1 -n 2 -x 0 -e 1.0 /dev/sda1 /dev/sdb1 mdadm --create /dev/md1 -l 1 -n 2 -x 0 -e 1.0 /dev/sda2 /dev/sdb2
It was time to create the LVM. So, I ran (don’t know the exact syntax, so this is an abstraction):
pvcreate /dev/md1 # In my research for my initial lvm problem, I found people who had # problems with dashes in the volume group name, so I don't # use those anymore... vgcreate lvmonraid /dev/md1 lvcreate -n root -l [wanted size/extentsize] lvmonraid lvcreate -n home -l [wanted size/extentsize] lvmonraid lvcreate -n swap -l [wanted size/extentsize] lvmonraid
Extent size is normally 4 MB, so a 40MB partition would have “-l 10″. You can also supply sizes in bytes, but that is not only inprecise because it gets rounded to the extent size, but I also noticed bugs in what metric and binary units were supposed to be; it seemed like the command line options don’t differentiate between G and g, for instance, and they’re all GiBi, whereas the –units option does.
When this is done, you can configure the block devices in arch to assign the purpose.
When the installation is almost done, it asks to modify some configuration files. This is important, otherwise the initramfs won’t load the LVM. You need to:
- Make an mdadm.conf in /etc (of the live CD) with “mdadm –examine –scan > /etc/mdadm.conf”.
- Add the raid1 and dm_mod module to the MODULES list in /etc/mkinitcpio.conf.
- Add the mdadm and lvm2 hook to the HOOKS list in /etc/mkinitcpio.conf, before ‘filesystems’
- Edit your /etc/rc.conf, and set the USELVM parameter to “yes”
Then it will create the ramdisk. The next thing is installing Grub. The config file it makes is fine, except you need to add (hd0,0) after the empty “root” directive, twice. Installing grub fails because of the RAID, so you have to do that by hand:
# grub grub> root (hd0,0) grub> setup(hd0) grub> root (hd1,0) grub> setup (hd1)
That should be it, basically. I actually did a lot more because of my new Western Digital WD15EARS disk with 4 kB sectors, but I’ll write about that soon.