1 |
Jarry wrote: |
2 |
|
3 |
>Hi, |
4 |
> |
5 |
>I'm going to re-install gentoo on a small hobby-server and because |
6 |
>I need both redundancy and flexibility, I thought in addition to |
7 |
>raid1 (2x 160GB ata-disk) this time I would also use lvm2: |
8 |
> |
9 |
>/dev/md0 /boot (~50MB) |
10 |
>/dev/md1 / (2GB) |
11 |
>/dev/md2 <swap> (2GB) |
12 |
>/dev/md3 lvm2 (rest for /var /tmp /usr /opt /chroot /home) |
13 |
> |
14 |
>Is this generaly advisable solution (lvm2 over raid1), or is there |
15 |
>some risk in using raid1 together with lvm2 ? |
16 |
> |
17 |
>One more question concerning partition type: |
18 |
>If I want to use raid1, I have to set all those 2x4 (hda+hdc) primary |
19 |
>partitions as type fd (raid autodetect). Is it not problem later for |
20 |
>lvm2 when preparing and creating volume-group? Because lvm-guide says |
21 |
>something about setting partition type to 8e (linux lvm), which I can |
22 |
>not do, if I want to use raid1... |
23 |
> |
24 |
>Jarry |
25 |
> |
26 |
> |
27 |
|
28 |
I recently set up a server like this. I have /boot, swap, and root |
29 |
mirrored using linux RAID (md), and swap and root partition is an LVM2 |
30 |
partition. |
31 |
|
32 |
There's no problem with setting the partition types of 0xfd. LVM2 |
33 |
doesn't have a problem with it. |
34 |
|
35 |
One thing you need is a initrd or initramfs setup to get all this stuff |
36 |
up and running during boot. I found the easiest way to do this was to |
37 |
use genkernel. Here's are some quick notes on how I got this working |
38 |
using the gentoo-sources-2.6.14-r2 kernel: |
39 |
|
40 |
Create your partitions using fdisk (/boot, and LVM2 partition for |
41 |
swap and root) on both disks. |
42 |
Set up RAID1 mirroring for these partitons (/boot md0, LVM2 |
43 |
swap/root md2) |
44 |
|
45 |
Add the md1 device as a physical volume, and create a volume group |
46 |
and logical volumes for swap and root inside it. |
47 |
|
48 |
Do high level formats on your new /boot partition and root volume, |
49 |
and mkswap on your swap volume.. |
50 |
|
51 |
Use genkernel to configure your kernel making sure to include this |
52 |
option: --lvm2 |
53 |
|
54 |
Make sure the linux RAID (md) stuff is compiled into the kernel. |
55 |
The LVM2 (dm) stuff can be modules. |
56 |
|
57 |
Make sure you include these kernel flags in your grub.conf or |
58 |
lilo.conf file: |
59 |
|
60 |
root=/dev/ram0 init=/linuxrc real_root=/dev/vg00/root dolvm2 |
61 |
lvmraid=/dev/md0 lvmraid=/dev/md1 |
62 |
|
63 |
(Those last two flags don't seem to be documented anywhere, but are |
64 |
required for the genkernel produced linuxrc scripts in the initramfs to |
65 |
start up the md devices before it scans for the LVM2 stuff) |
66 |
|
67 |
All this is probably easier done, if possible, during the install from a |
68 |
livecd. I did it backwards myself. I got a basic gentoo system running |
69 |
on one drive with normal partitions, then transformed it into the |
70 |
RAID/LVM system. I did this by creating the Linux RAID partitons on the |
71 |
second drive with 'missing components' using mdadm (I use mdadm instead |
72 |
of the traditional raidtools). This allows you to create your RAID1 |
73 |
volumes with only one drive, the volumes coming up in degraded mode. |
74 |
You can then do your LVM2 volume creation stuff and create your |
75 |
filesystems, etc, get them mounted, and copy your basic system from the |
76 |
non RAID drive to your new volumes. Then you can update your fstab, set |
77 |
up your bootloader on the RAID drive, and test boot, etc, making sure |
78 |
the system comes up using the RAID/LVM2 setup, while having the original |
79 |
drive for backup in case things don't work. Once you're confident |
80 |
things will come up on the RAID/LVM2 setup, you can repartition the |
81 |
original drive, and "hotadd" the partitions to your RAID volumes. Linux |
82 |
RAID will then sync the formerly missing components, and voila, you now |
83 |
have a synced/clean RAID1 system. |
84 |
|
85 |
Hopefully that all made sense. I banged my head against it for a while |
86 |
getting this set up to boot up (the final key was the lvmraid= flags |
87 |
which cause the linxrc to start up the md devices. I had to read |
88 |
through the linuxrc scripts to figure this one out). |
89 |
|
90 |
Good luck. |
91 |
|
92 |
-- |
93 |
+---------------------------------------------------------------------------+ |
94 |
| Jim Burwell - Sr. Systems/Network/Security Engineer, JSBC | |
95 |
+---------------------------------------------------------------------------+ |
96 |
| "I never let my schooling get in the way of my education." - Mark Twain | |
97 |
| "UNIX was never designed to keep people from doing stupid things, because | |
98 |
| that policy would also keep them from doing clever things." - Doug Gwyn | |
99 |
| "Cool is only three letters away from Fool" - Mike Muir, Suicyco | |
100 |
| "..Government in its best state is but a necessary evil; in its worst | |
101 |
| state an intolerable one.." - Thomas Paine, "Common Sense" (1776) | |
102 |
+---------------------------------------------------------------------------+ |
103 |
| Email: jimb at jay ess bee cee dot com ICQ UIN: 1695089 | |
104 |
+---------------------------------------------------------------------------+ |
105 |
| Reply problems ? Turn off the "sign" function in email prog. Blame MS. | |
106 |
+---------------------------------------------------------------------------+ |