Install raid1 and lvm for Kubuntu

Hardware configuration

  • MB : ASUS M2N32 Workstation Professional
  • CPU: Athlon 64 X2 5600+
  • HD : 2xWD 74GB Raptor, 2xSamsung 500GB, 1xSamsung 400GB
  • RAM: 4 GB DDR2-6400
  • Usage: Server

Brief problem description

I started off installing Kubuntu Feisty 7.04. Within the partitioner, I could not set up lvm. I could not get past the error message “Error informing the kernel about modifications to /dev/md2p1 –Invalid argument”, no matter what I did. I even zeroed all partition tables with dd, but whenever I entered LVM config the partitioner recognized md0, md1, md2 and the usage as lvm. I'm not quite sure how this is possible, I even started doubting my new hardware.

After several hours I decided to go back to Kubuntu 6.10, with which I still could not install lvm, but I could properly install the 2 multidisk (raid1) configurations (md0: /, md1: swap, md2: /srv). md2 = /srv was a necessary intermediate step, because lvm did not configure through on Edgy either, so I formatted it with ext3.

Remarks for the walkthrough below

  • “>” means “and then”, next menu item or next step
  • “|” means option, do first or second ( first | second)
  • all commands below as super user. enter sudo -s

Desired configuration of the disks

hdd partition raid1 lvm mount point
sda sda1 md0 - /
sdb sdb1 md0
sda sda2 md1 - swap
sdb sdb2 md1
sdc sdc1 md2 vg1, lv1, lv2 /home, /srv
sdd sdd1 md2
sde sde1 - vg2, lv3 /backup

Install Base

  1. Install Kubuntu Edgy (6.10) Alternate Install: F6-F6-Expert Mode
  2. Install Raid1 with MD package activated
  3. DO NOT install LVM during initial setup
  4. Boot into KDE from HD
  • Note: if MD oder LVM already activated before and need clean: 2nd shell (Alt-F2) > mdadm - -manage - -stop md0 > mdadm - -manage - -remove md0 before writing to disk in partitioner

Install LVM

  1. lvm > pvcreate /dev/sde1 > pvcreate /dev/md2
  2. lvm > vgcreate vg_backup /dev/sde1 > vgcreate vg_data /dev/md2
  3. lvm > vgdisplay vg_backup to check ### of free extents (following steps same for vg_data, but 2 logical volumes)
  4. lvm > lvcreate -l### vg_backup (do not use -LxxGB, use size with -l### which is number of extents)
  5. lvm > lvrename vg_backup lvol0 lv_backup
  6. lvm > vgcfgbackup to backup volume group configurations
  7. lvm > exit
  8. umount /home > umount /srv
  9. mkfs -t ext3 /dev/vg_backup/lv_backup > mkfs -t ext3 /dev/vg_data/lv_home > mkfs -t ext3 /dev/vg_data/lv_srv
  10. mkdir /backup
  11. mount /dev/vg_backup/lv_backup /backup > mount /dev/vg_data/lv_home /home > mount /dev/vg_data/lv_srv /srv
  • As I use this machine as a server I did not consider to upgrade Edgy to Feisty, but I would expect that this can be done without problems. I'm not sure this is the best way or the fastest, but it worked for me.

Done! Everything works now!