/[gentoo]/xml/htdocs/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml
Gentoo

Contents of /xml/htdocs/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.28 - (hide annotations) (download) (as text)
Mon May 9 20:15:47 2011 UTC (3 years, 6 months ago) by nightmorph
Branch: MAIN
Changes since 1.27: +3 -3 lines
File MIME type: application/xml
add metadata option, patch from swift on bug 359593

1 neysx 1.1 <?xml version='1.0' encoding="UTF-8"?>
2 nightmorph 1.28 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml,v 1.27 2011/05/09 19:59:08 nightmorph Exp $ -->
3 neysx 1.1 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
4    
5 nightmorph 1.25 <guide>
6 neysx 1.1 <title>Gentoo Linux x86 with Software Raid and LVM2 Quick Install Guide</title>
7    
8 neysx 1.20 <values>
9     <key id="raid+lvm">yes</key>
10     <key id="root">/dev/md3</key>
11     </values>
12    
13 neysx 1.1 <author title="Author">
14 neysx 1.20 <mail link="neysx"/>
15 neysx 1.1 </author>
16     <author title="Author">
17 neysx 1.20 <mail link="swift"/>
18 neysx 1.1 </author>
19     <author title="Author">Steven Wagner</author>
20    
21     <abstract>
22 nightmorph 1.25 The Quick Install guide covers the Gentoo install process in a non-verbose
23 neysx 1.1 manner. Its purpose is to allow users to perform a stage3 install with software
24 nightmorph 1.25 RAID and LVM2 in no time. Users should already have prior experience with
25 neysx 1.1 installing Gentoo Linux if they want to follow this guide.
26     </abstract>
27    
28     <!-- The content of this document is licensed under the CC-BY-SA license -->
29     <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
30     <license/>
31    
32 nightmorph 1.28 <version>18</version>
33 nightmorph 1.27 <date>2011-05-09</date>
34 neysx 1.1
35     <chapter>
36     <title>Introduction</title>
37     <section>
38     <body>
39    
40     <p>
41     This guide contains all commands you should use to complete a stage3
42 rane 1.3 installation including LVM2 on top of software RAID. This guide is targeted at
43 neysx 1.1 experienced users. You need a connection to the Internet to download the stage3
44     and Portage snapshots.
45     </p>
46    
47 nightmorph 1.25 <impo>
48 neysx 1.20 New users should read the <uri link="/doc/en/handbook/index.xml">Handbook</uri>
49 nightmorph 1.25 as it gives a better overview about the installation process. The Quick Install
50     guide is designed for experienced users who just need a checklist to follow.
51     </impo>
52 neysx 1.20
53     <p>
54 neysx 1.1 Timing output follows all commands that take more than a couple of seconds to
55     finish. Commands were timed on an AMD 2000 1.66 Ghz PC with 512 Mb of RAM and
56     two SATA disks connected to a hardware controller configured as JBOD (i.e. two
57     separate hard disks are seen by Gentoo). If you have a "hardware" RAID
58     controller on your motherboard, it is most likely <b>not</b> a hardware
59     controller.
60     </p>
61    
62     <pre caption="Test box specs">
63     <comment>(The following specs and the timing information should help you determine
64     a rough estimate of the time you need to complete your install)</comment>
65    
66     # <i>grep bogo /proc/cpuinfo</i>
67 rane 1.3 bogomips : 3337.81
68 neysx 1.1
69     # <i>hdparm -tT /dev/sda /dev/sdb</i>
70     /dev/sda:
71     reads: 1048 MB in 2.00 seconds = 524.00 MB/sec
72     Timing buffered disk reads: 152 MB in 3.01 seconds = 50.50 MB/sec
73    
74     /dev/sdb:
75     Timing cached reads: 1048 MB in 2.00 seconds = 524.00 MB/sec
76     Timing buffered disk reads: 152 MB in 3.01 seconds = 50.50 MB/sec
77    
78     # <i>grep MemTotal /proc/meminfo</i>
79     MemTotal: 509248 kB
80     </pre>
81    
82     </body>
83     </section>
84     </chapter>
85    
86     <chapter>
87     <title>Quick Install Guide</title>
88     <section>
89 neysx 1.20 <include href="gentoo-x86-quickinstall-media.xml"/>
90 neysx 1.1 </section>
91     <section>
92     <title>Preparing the Disks</title>
93     <body>
94    
95     <p>
96     Load the software RAID and LVM2 modules.
97     </p>
98    
99     <pre caption="Load RAID and LVM2 modules">
100     livecd ~ # <i>modprobe raid0</i>
101     livecd ~ # <i>modprobe raid1</i>
102     <comment>(raid5, raid6 and raid10 are also available)</comment>
103    
104     livecd ~ # <i>modprobe dm-mod</i>
105     </pre>
106    
107     <p>
108     Use <c>fdisk</c> or <c>cfdisk</c> to create your partition layout. The device
109     names are likely to be either <path>/dev/sda</path> and <path>/dev/sdb</path>
110     for a SATA or SCSI disks, or <path>/dev/hda</path> and <path>/dev/hdb</path>
111     for IDE disks. The following layout will be used in this guide:
112     </p>
113    
114     <table>
115     <tr>
116     <ti/>
117     <th><path>/dev/sda</path></th>
118     <th><path>/dev/sdb</path></th>
119     <th>Type</th>
120     </tr>
121     <tr>
122     <th><path>/dev/md1</path></th>
123     <th><path>/boot</path></th>
124     <th><path>/boot</path></th>
125     <ti>Raid-1 (mirroring)</ti>
126     </tr>
127     <tr>
128     <th/>
129     <th>swap</th>
130     <th>swap</th>
131     <ti>Normal partitions</ti>
132     </tr>
133     <tr>
134     <th><path>/dev/md3</path></th>
135     <th><path>/</path></th>
136     <th><path>/</path></th>
137     <ti>Raid-1 (mirroring)</ti>
138     </tr>
139     <tr>
140     <th><path>/dev/md4</path></th>
141     <th colspan="2">LVM2 volumes</th>
142     <ti>Raid-0 (striped)</ti>
143     </tr>
144     </table>
145    
146 neysx 1.7 <impo>
147 neysx 1.1 The partition you boot from must not be striped. It may not be raid-5 or
148     raid-0.
149 neysx 1.7 </impo>
150 neysx 1.1
151     <note>
152     On the one hand, if you want extra stability, consider using raid-1 (or even
153     raid-5) for your swap partition(s) so that a drive failure would not corrupt
154     your swap space and crash applications that are using it. On the other hand, if
155     you want extra performance, just let the kernel use distinct swap partitions as
156     it does striping by default.
157     </note>
158    
159     <pre caption="Create the partitions">
160     livecd ~ # <i>fdisk /dev/sda</i>
161 neysx 1.23 <comment>(Make sure you use type fd and set the bootable flag)</comment>
162 neysx 1.1
163     <comment>(The rest of this guide uses the following partitioning scheme)</comment>
164     livecd ~ # <i>fdisk -l /dev/sda</i>
165    
166     Disk /dev/sda: 299.9 GB, 299989204992 bytes
167     255 heads, 63 sectors/track, 36471 cylinders
168     Units = cylinders of 16065 * 512 = 8225280 bytes
169    
170     Device Boot Start End Blocks Id System
171 neysx 1.23 /dev/sda1 * 1 11 88326 fd Linux raid autodetect
172 neysx 1.1 /dev/sda2 12 61 401625 82 Linux swap / Solaris
173     /dev/sda3 62 311 2008125 fd Linux raid autodetect
174     /dev/sda4 312 36471 290455200 fd Linux raid autodetect
175    
176     <comment>(Partition the second disk exactly as the first)</comment>
177     livecd ~ # <i>fdisk /dev/sdb</i>
178     </pre>
179    
180     <p>
181 jkt 1.26 Then create the RAID device nodes and devices. Please bear in mind that the
182     <c>/boot</c> and <c>/</c> mount points should use an older metadata format which
183     can be specified by the <c>--metadata=0.90</c> flag:
184 neysx 1.1 </p>
185    
186     <pre caption="Create device nodes and devices">
187     livecd ~ # <i>mknod /dev/md1 b 9 1</i>
188     livecd ~ # <i>mknod /dev/md3 b 9 3</i>
189     livecd ~ # <i>mknod /dev/md4 b 9 4</i>
190    
191 jkt 1.26 livecd ~ # <i>mdadm --create /dev/md1 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda1 /dev/sdb1</i>
192 neysx 1.1 mdadm: array /dev/md1 started.
193 nightmorph 1.28 livecd ~ # <i>mdadm --create /dev/md3 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda3 /dev/sdb3</i>
194 neysx 1.1 mdadm: array /dev/md3 started.
195     livecd ~ # <i>mdadm --create /dev/md4 --level=0 --raid-devices=2 /dev/sda4 /dev/sdb4</i>
196     mdadm: array /dev/md4 started.
197    
198     <comment>(Wait until all units are ready)</comment>
199     livecd ~ # <i>cat /proc/mdstat</i>
200     Personalities : [raid0] [raid1]
201     md4 : active raid0 sdb4[1] sda4[0]
202     581006592 blocks 64k chunks
203    
204     md3 : active raid1 sdb3[1] sda3[0]
205     1959808 blocks [2/2] [UU]
206    
207     md1 : active raid1 sdb1[1] sda1[0]
208     88256 blocks [2/2] [UU]
209     </pre>
210    
211     <p>
212     Then create the LVM2 volumes in <path>/dev/md4</path>. The following scheme is
213     used as an <b>example</b>:
214     </p>
215    
216     <table>
217     <tr>
218     <th>Directory</th>
219     <th>Size</th>
220     <th>File system</th>
221     </tr>
222     <tr>
223     <ti>/usr</ti>
224     <ti>8 GB</ti>
225     <ti>ext3</ti>
226     </tr>
227     <tr>
228     <ti>/usr/portage</ti>
229     <ti>2 GB</ti>
230     <ti>ext2, small block size, many inodes</ti>
231     </tr>
232     <tr>
233     <ti>/usr/portage/distfiles</ti>
234     <ti>4 GB</ti>
235 nightmorph 1.22 <ti>ext2, large block size, less inodes</ti>
236 neysx 1.1 </tr>
237     <tr>
238     <ti>/home</ti>
239     <ti>10 GB</ti>
240     <ti>ext3</ti>
241     </tr>
242     <tr>
243     <ti>/opt</ti>
244     <ti>4 GB</ti>
245     <ti>ext3</ti>
246     </tr>
247     <tr>
248     <ti>/var</ti>
249     <ti>4 GB</ti>
250     <ti>ext3</ti>
251     </tr>
252     <tr>
253     <ti>/var/tmp</ti>
254     <ti>6 GB</ti>
255     <ti>ext2</ti>
256     </tr>
257     <tr>
258     <ti>/tmp</ti>
259     <ti>2 GB</ti>
260     <ti>ext2</ti>
261     </tr>
262     </table>
263    
264     <pre caption="Create LVM2 volumes">
265     livecd ~ # <i>vgscan</i>
266     Reading all physical volumes. This may take a while...
267     No volume groups found
268     livecd ~ # <i>vgchange -a y</i>
269     No volume groups found
270    
271     <comment>(Create physical volumes, we have only one in our example)</comment>
272     livecd ~ # <i>pvcreate /dev/md4</i>
273     Physical volume "/dev/md4" successfully created
274    
275     <comment>(Create volume groups, again, we have only one in our example)</comment>
276     livecd ~ # <i>vgcreate vg /dev/md4</i>
277     Volume group "vg" successfully created
278    
279     <comment>(Create logical volumes)</comment>
280     livecd ~ # <i>lvcreate -L8G -nusr vg</i>
281     /dev/cdrom: open failed: Read-only file system
282     Logical volume "usr" created <comment>(Further similar messages not displayed)</comment>
283     livecd ~ # <i>lvcreate -L2G -nportage vg</i>
284     livecd ~ # <i>lvcreate -L4G -ndistfiles vg</i>
285     livecd ~ # <i>lvcreate -L10G -nhome vg</i>
286     livecd ~ # <i>lvcreate -L4G -nopt vg</i>
287     livecd ~ # <i>lvcreate -L4G -nvar vg</i>
288     livecd ~ # <i>lvcreate -L6G -nvartmp vg</i>
289     livecd ~ # <i>lvcreate -L2G -ntmp vg</i>
290    
291     <comment>(Display volume groups and logical volumes)</comment>
292     livecd ~ # <i>vgs</i>
293     VG #PV #LV #SN Attr VSize VFree
294     vg 1 8 0 wz--n 554.09G 514.09G
295     livecd ~ # <i>lvs</i>
296     LV VG Attr LSize Origin Snap% Move Copy%
297     distfiles vg -wi-a- 4.00G
298     home vg -wi-a- 10.00G
299     opt vg -wi-a- 4.00G
300     portage vg -wi-a- 2.00G
301     tmp vg -wi-a- 2.00G
302     usr vg -wi-a- 8.00G
303     var vg -wi-a- 4.00G
304     vartmp vg -wi-a- 6.00G
305     </pre>
306    
307     <p>
308     Use <c>mke2fs</c>, <c>mke2fs -j</c>, <c>mkreiserfs</c>, <c>mkfs.xfs</c> and
309     <c>mkfs.jfs</c> to create file systems. Initialize swap using <c>mkswap</c> and
310     <c>swapon</c>.
311     </p>
312    
313     <pre caption="Create the file systems and activate swap">
314     <comment>(ext2 is all you need on the /boot partition)</comment>
315     livecd ~ # <i>mke2fs /dev/md1</i>
316    
317     <comment>(Let's use ext3 on the root partition)</comment>
318 nightmorph 1.13 livecd ~ # <i>mke2fs -j /dev/md3</i>
319 neysx 1.1
320     <comment>(Create file systems on logical volumes)</comment>
321     livecd ~ # <i>mke2fs -b 4096 -T largefile /dev/vg/distfiles</i>
322 nightmorph 1.13 livecd ~ # <i>mke2fs -j /dev/vg/home</i>
323     livecd ~ # <i>mke2fs -j /dev/vg/opt</i>
324 neysx 1.1 livecd ~ # <i>mke2fs -b 1024 -N 200000 /dev/vg/portage</i>
325     livecd ~ # <i>mke2fs /dev/vg/tmp</i>
326 nightmorph 1.13 livecd ~ # <i>mke2fs -j /dev/vg/usr</i>
327     livecd ~ # <i>mke2fs -j /dev/vg/var</i>
328 neysx 1.1 livecd ~ # <i>mke2fs /dev/vg/vartmp</i>
329    
330     <comment>(Create and activate swap)</comment>
331     livecd ~ # <i>mkswap /dev/sda2 &amp;&amp; mkswap /dev/sdb2</i>
332     livecd ~ # <i>swapon -p 1 /dev/sda2 &amp;&amp; swapon -p 1 /dev/sdb2</i>
333     <comment>(Check that all swap partitions use the same priority)</comment>
334     livecd ~ # <i>swapon -v -s</i>
335     Filename Type Size Used Priority
336     /dev/sda2 partition 401616 0 1
337     /dev/sdb2 partition 401616 0 1
338     </pre>
339    
340     <p>
341     Mount the freshly created file systems on <path>/mnt/gentoo</path>. Create
342     directories for the other mount points and mount them too.
343     </p>
344    
345     <pre caption="Mount the file systems">
346     livecd ~ # <i>mount /dev/md3 /mnt/gentoo</i>
347     livecd ~ # <i>cd /mnt/gentoo</i>
348     livecd gentoo # <i>mkdir boot home usr opt var tmp</i>
349     livecd gentoo # <i>mount /dev/md1 /mnt/gentoo/boot</i>
350     livecd gentoo # <i>mount /dev/vg/usr /mnt/gentoo/usr</i>
351     livecd gentoo # <i>mount /dev/vg/home /mnt/gentoo/home</i>
352     livecd gentoo # <i>mount /dev/vg/opt /mnt/gentoo/opt</i>
353     livecd gentoo # <i>mount /dev/vg/tmp /mnt/gentoo/tmp</i>
354     livecd gentoo # <i>mount /dev/vg/var /mnt/gentoo/var</i>
355     livecd gentoo # <i>mkdir usr/portage var/tmp</i>
356     livecd gentoo # <i>mount /dev/vg/vartmp /mnt/gentoo/var/tmp</i>
357     livecd gentoo # <i>mount /dev/vg/portage /mnt/gentoo/usr/portage</i>
358     livecd gentoo # <i>mkdir usr/portage/distfiles</i>
359     livecd gentoo # <i>mount /dev/vg/distfiles /mnt/gentoo/usr/portage/distfiles</i>
360    
361     <comment>(Set proper perms on tmp directories)</comment>
362     livecd gentoo # <i>chmod 1777 /mnt/gentoo/tmp /mnt/gentoo/var/tmp</i>
363     </pre>
364    
365     </body>
366     </section>
367    
368     <section>
369 neysx 1.20 <include href="gentoo-x86-quickinstall-stage.xml"/>
370 neysx 1.1 </section>
371    
372     <section>
373     <title>Kernel Configuration</title>
374     <body>
375    
376     <p>
377 nightmorph 1.11 Install a kernel source (usually <c>gentoo-sources</c>), configure it, compile
378     it and copy the <path>arch/i386/boot/bzImage</path> file to <path>/boot</path>.
379 neysx 1.1 </p>
380    
381     <pre caption="Install a kernel source, compile it and install the kernel">
382     livecd etc # <i>time emerge gentoo-sources</i>
383    
384     real 3m3.110s
385     user 1m2.320s
386     sys 0m34.990s
387     livecd etc # <i>cd /usr/src/linux</i>
388     livecd linux # <i>make menuconfig</i>
389    
390 neysx 1.2 <comment>(Configure your kernel as usual and make sure the raid and lvm modules you need are
391     compiled in, i.e. <b>not</b> as modules. The same applies to the disk drivers and filesystems.)</comment>
392 neysx 1.1 Multi-device support (RAID and LVM) --->
393     [*] Multiple devices driver support (RAID and LVM)
394     &lt;*&gt; RAID support
395     &lt; &gt; Linear (append) mode (NEW)
396     &lt;*&gt; RAID-0 (striping) mode
397     &lt;*&gt; RAID-1 (mirroring) mode
398     &lt; &gt; RAID-10 (mirrored striping) mode (EXPERIMENTAL) (NEW)
399     &lt; &gt; RAID-4/RAID-5 mode (NEW)
400     &lt; &gt; RAID-6 mode (NEW)
401     &lt; &gt; Multipath I/O support (NEW)
402     &lt; &gt; Faulty test module for MD (NEW)
403     &lt;*&gt; Device mapper support
404     &lt; &gt; Crypt target support (NEW)
405     &lt; &gt; Snapshot target (EXPERIMENTAL) (NEW)
406     &lt; &gt; Mirror target (EXPERIMENTAL) (NEW)
407     &lt; &gt; Zero target (EXPERIMENTAL) (NEW)
408     &lt; &gt; Multipath target (EXPERIMENTAL) (NEW)
409     &lt; &gt; Bad Block Relocation Device Target (EXPERIMENTAL) (NEW)
410    
411     livecd linux # <i>time make -j2</i>
412    
413     <comment>(Elapsed time depends highly on the options you selected)</comment>
414     real 5m5.869s
415     user 4m32.320s
416     sys 0m32.930s
417    
418     livecd linux # <i>make modules_install</i>
419     livecd linux # <i>cp arch/i386/boot/bzImage /boot/kernel</i>
420     </pre>
421    
422     </body>
423     </section>
424    
425     <section>
426 neysx 1.20 <include href="gentoo-x86-quickinstall-system.xml"/>
427 neysx 1.1 </section>
428    
429 neysx 1.20 <section id="reboot">
430 neysx 1.1 <title>Reboot</title>
431     <body>
432    
433     <p>
434     Exit the chrooted environment, unmount all file systems and reboot:
435     </p>
436    
437     <pre caption="Reboot">
438     livecd conf.d # <i>exit</i>
439 nightmorph 1.27 livecd / # <i>umount -l /mnt/gentoo/usr{/portage/distfiles,/portage,}</i>
440     livecd / # <i>umount -l /mnt/gentoo/dev{/pts,/shm,}</i>
441     livecd / # <i>umount -l /mnt/gentoo{/usr,/var/tmp,/tmp,/var,/opt,/dev,/proc,/home,/boot,}</i>
442 neysx 1.1 livecd / # <i>reboot</i>
443     <comment>(Don't forget to remove the CD)</comment>
444     </pre>
445    
446 neysx 1.20 </body>
447     </section>
448 neysx 1.1
449 neysx 1.20 <section>
450     <include href="gentoo-x86-quickinstall-after-reboot.xml"/>
451 neysx 1.1 </section>
452 neysx 1.20
453 neysx 1.1 </chapter>
454     </guide>

  ViewVC Help
Powered by ViewVC 1.1.20