Jarry wrote:
Hi,

I'm going to re-install gentoo on a small hobby-server and because
I need both redundancy and flexibility, I thought in addition to
raid1 (2x 160GB ata-disk) this time I would also use lvm2:

/dev/md0 /boot   (~50MB)
/dev/md1 /       (2GB)
/dev/md2 <swap>  (2GB)
/dev/md3 lvm2    (rest for /var /tmp /usr /opt /chroot /home)

Is this generaly advisable solution (lvm2 over raid1), or is there
some risk in using raid1 together with lvm2 ?

One more question concerning partition type:
If I want to use raid1, I have to set all those 2x4 (hda+hdc) primary
partitions as type fd (raid autodetect). Is it not problem later for
lvm2 when preparing and creating volume-group? Because lvm-guide says
something about setting partition type to 8e (linux lvm), which I can
not do, if I want to use raid1...

Jarry
  

I recently set up a server like this.  I have /boot, swap, and root mirrored using linux RAID (md), and swap and root partition is an LVM2 partition.

There's no problem with setting the partition types of 0xfd.  LVM2 doesn't have a problem with it.

One thing you need is a initrd or initramfs setup to get all this stuff up and running during boot.  I found the easiest way to do this was to use genkernel.  Here's are some quick notes on how I got this working using the gentoo-sources-2.6.14-r2 kernel:

Create your partitions using fdisk (/boot, and LVM2 partition for swap and root) on both disks.
Set up RAID1 mirroring for these partitons (/boot md0, LVM2 swap/root md2)

Add the md1 device as a physical volume, and create a volume group and logical volumes for swap and root inside it.

Do high level formats on your new /boot partition and root volume, and mkswap on your swap volume..

Use genkernel to configure your kernel making sure to include this option: --lvm2

Make sure the linux RAID (md) stuff is compiled into the kernel.  The LVM2 (dm) stuff can be modules.

Make sure you include these kernel flags in your grub.conf or lilo.conf file:
 root=/dev/ram0 init=/linuxrc real_root=/dev/vg00/root dolvm2 lvmraid=/dev/md0 lvmraid=/dev/md1
(Those last two flags don't seem to be documented anywhere, but are required for the genkernel produced linuxrc scripts in the initramfs to start up the md devices before it scans for the LVM2 stuff)

All this is probably easier done, if possible, during the install from a livecd.  I did it backwards myself.  I got a basic gentoo system running on one drive with normal partitions, then transformed it into the RAID/LVM system.  I did this by creating the Linux RAID partitons on the second drive with 'missing components' using mdadm (I use mdadm instead of the traditional raidtools).  This allows you to create your RAID1 volumes with only one drive, the volumes coming up in degraded mode.  You can then do your LVM2 volume creation stuff and create your filesystems, etc, get them mounted, and copy your basic system from the non RAID drive to your new volumes.  Then you can update your fstab, set up your bootloader on the RAID drive, and test boot, etc, making sure the system comes up using the RAID/LVM2 setup, while having the original drive for backup in case things don't work.  Once you're confident things will come up on the RAID/LVM2 setup, you can repartition the original drive, and "hotadd" the partitions to your RAID volumes.  Linux RAID will then sync the formerly missing components, and voila, you now have a synced/clean RAID1 system.

Hopefully that all made sense.  I banged my head against it for a while getting this set up to boot up (the final key was the lvmraid= flags which cause the linxrc to start up the md devices.  I had to read through the linuxrc scripts to figure this one out).

Good luck.

-- 
+---------------------------------------------------------------------------+
|         Jim Burwell - Sr. Systems/Network/Security Engineer, JSBC         |
+---------------------------------------------------------------------------+
| "I never let my schooling get in the way of my education." - Mark Twain   |
| "UNIX was never designed to keep people from doing stupid things, because |
|  that policy would also keep them from doing clever things." - Doug Gwyn  |
| "Cool is only three letters away from Fool" - Mike Muir, Suicyco          |
| "..Government in its best state is but a necessary evil; in its worst     |
|  state an intolerable one.." - Thomas Paine, "Common Sense" (1776)        |
+---------------------------------------------------------------------------+
|   Email:  jimb at jay ess bee cee dot com           ICQ UIN:  1695089     |
+---------------------------------------------------------------------------+
|  Reply problems ?  Turn off the "sign" function in email prog.  Blame MS. |
+---------------------------------------------------------------------------+

Reply via email to