/[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.30 - (show annotations) (download) (as text)
Sat Mar 31 13:27:30 2012 UTC (2 years, 6 months ago) by swift
Branch: MAIN
Changes since 1.29: +12 -3 lines
File MIME type: application/xml
Updates regarding bug #407959 - Update on initramfs needs when using a separate /usr or other requirements

1 <?xml version='1.0' encoding="UTF-8"?>
2 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml,v 1.29 2011/08/23 15:12:17 swift Exp $ -->
3 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
4
5 <guide>
6 <title>Gentoo Linux x86 with Software Raid and LVM2 Quick Install Guide</title>
7
8 <values>
9 <key id="raid+lvm">yes</key>
10 <key id="root">/dev/md3</key>
11 </values>
12
13 <author title="Author">
14 <mail link="neysx"/>
15 </author>
16 <author title="Author">
17 <mail link="swift"/>
18 </author>
19 <author title="Author">Steven Wagner</author>
20
21 <abstract>
22 The Quick Install guide covers the Gentoo install process in a non-verbose
23 manner. Its purpose is to allow users to perform a stage3 install with software
24 RAID and LVM2 in no time. Users should already have prior experience with
25 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 <version>20</version>
33 <date>2012-03-31</date>
34
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 installation including LVM2 on top of software RAID. This guide is targeted at
43 experienced users. You need a connection to the Internet to download the stage3
44 and Portage snapshots.
45 </p>
46
47 <impo>
48 New users should read the <uri link="/doc/en/handbook/index.xml">Handbook</uri>
49 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
53 <p>
54 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 bogomips : 3337.81
68
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 <include href="gentoo-x86-quickinstall-media.xml"/>
90 </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 <impo>
147 The partition you boot from must not be striped. It may not be raid-5 or
148 raid-0.
149 </impo>
150
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 <comment>(Make sure you use type fd and set the bootable flag)</comment>
162
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 /dev/sda1 * 1 11 88326 fd Linux raid autodetect
172 /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 Then create the RAID device nodes and devices. Please bear in mind that, if you
182 are not using an initramfs to help during boot, the
183 <c>/boot</c> and <c>/</c> mount points should use an older metadata format which
184 can be specified by the <c>--metadata=0.90</c> flag:
185 </p>
186
187 <pre caption="Create device nodes and devices">
188 livecd ~ # <i>mknod /dev/md1 b 9 1</i>
189 livecd ~ # <i>mknod /dev/md3 b 9 3</i>
190 livecd ~ # <i>mknod /dev/md4 b 9 4</i>
191
192 livecd ~ # <i>mdadm --create /dev/md1 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda1 /dev/sdb1</i>
193 mdadm: array /dev/md1 started.
194 livecd ~ # <i>mdadm --create /dev/md3 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda3 /dev/sdb3</i>
195 mdadm: array /dev/md3 started.
196 livecd ~ # <i>mdadm --create /dev/md4 --level=0 --raid-devices=2 /dev/sda4 /dev/sdb4</i>
197 mdadm: array /dev/md4 started.
198
199 <comment>(Wait until all units are ready)</comment>
200 livecd ~ # <i>cat /proc/mdstat</i>
201 Personalities : [raid0] [raid1]
202 md4 : active raid0 sdb4[1] sda4[0]
203 581006592 blocks 64k chunks
204
205 md3 : active raid1 sdb3[1] sda3[0]
206 1959808 blocks [2/2] [UU]
207
208 md1 : active raid1 sdb1[1] sda1[0]
209 88256 blocks [2/2] [UU]
210 </pre>
211
212 <p>
213 If you use an initramfs, then it is responsible for assembling the RAID arrays
214 during boot. When using a genkernel initramfs, this can be triggered using the
215 <c>domdadm</c> boot option.
216 </p>
217
218 <p>
219 Then create the LVM2 volumes in <path>/dev/md4</path>. The following scheme is
220 used as an <b>example</b>:
221 </p>
222
223 <table>
224 <tr>
225 <th>Directory</th>
226 <th>Size</th>
227 <th>File system</th>
228 </tr>
229 <tr>
230 <ti>/usr</ti>
231 <ti>8 GB</ti>
232 <ti>ext3</ti>
233 </tr>
234 <tr>
235 <ti>/usr/portage</ti>
236 <ti>2 GB</ti>
237 <ti>ext2, small block size, many inodes</ti>
238 </tr>
239 <tr>
240 <ti>/usr/portage/distfiles</ti>
241 <ti>4 GB</ti>
242 <ti>ext2, large block size, less inodes</ti>
243 </tr>
244 <tr>
245 <ti>/home</ti>
246 <ti>10 GB</ti>
247 <ti>ext3</ti>
248 </tr>
249 <tr>
250 <ti>/opt</ti>
251 <ti>4 GB</ti>
252 <ti>ext3</ti>
253 </tr>
254 <tr>
255 <ti>/var</ti>
256 <ti>4 GB</ti>
257 <ti>ext3</ti>
258 </tr>
259 <tr>
260 <ti>/var/tmp</ti>
261 <ti>6 GB</ti>
262 <ti>ext2</ti>
263 </tr>
264 <tr>
265 <ti>/tmp</ti>
266 <ti>2 GB</ti>
267 <ti>ext2</ti>
268 </tr>
269 </table>
270
271 <pre caption="Create LVM2 volumes">
272 livecd ~ # <i>vgscan</i>
273 Reading all physical volumes. This may take a while...
274 No volume groups found
275 livecd ~ # <i>vgchange -a y</i>
276 No volume groups found
277
278 <comment>(Create physical volumes, we have only one in our example)</comment>
279 livecd ~ # <i>pvcreate /dev/md4</i>
280 Physical volume "/dev/md4" successfully created
281
282 <comment>(Create volume groups, again, we have only one in our example)</comment>
283 livecd ~ # <i>vgcreate vg /dev/md4</i>
284 Volume group "vg" successfully created
285
286 <comment>(Create logical volumes)</comment>
287 livecd ~ # <i>lvcreate -L8G -nusr vg</i>
288 /dev/cdrom: open failed: Read-only file system
289 Logical volume "usr" created <comment>(Further similar messages not displayed)</comment>
290 livecd ~ # <i>lvcreate -L2G -nportage vg</i>
291 livecd ~ # <i>lvcreate -L4G -ndistfiles vg</i>
292 livecd ~ # <i>lvcreate -L10G -nhome vg</i>
293 livecd ~ # <i>lvcreate -L4G -nopt vg</i>
294 livecd ~ # <i>lvcreate -L4G -nvar vg</i>
295 livecd ~ # <i>lvcreate -L6G -nvartmp vg</i>
296 livecd ~ # <i>lvcreate -L2G -ntmp vg</i>
297
298 <comment>(Display volume groups and logical volumes)</comment>
299 livecd ~ # <i>vgs</i>
300 VG #PV #LV #SN Attr VSize VFree
301 vg 1 8 0 wz--n 554.09G 514.09G
302 livecd ~ # <i>lvs</i>
303 LV VG Attr LSize Origin Snap% Move Copy%
304 distfiles vg -wi-a- 4.00G
305 home vg -wi-a- 10.00G
306 opt vg -wi-a- 4.00G
307 portage vg -wi-a- 2.00G
308 tmp vg -wi-a- 2.00G
309 usr vg -wi-a- 8.00G
310 var vg -wi-a- 4.00G
311 vartmp vg -wi-a- 6.00G
312 </pre>
313
314 <p>
315 Use <c>mke2fs</c>, <c>mke2fs -j</c>, <c>mkreiserfs</c>, <c>mkfs.xfs</c> and
316 <c>mkfs.jfs</c> to create file systems. Initialize swap using <c>mkswap</c> and
317 <c>swapon</c>.
318 </p>
319
320 <pre caption="Create the file systems and activate swap">
321 <comment>(ext2 is all you need on the /boot partition)</comment>
322 livecd ~ # <i>mke2fs /dev/md1</i>
323
324 <comment>(Let's use ext3 on the root partition)</comment>
325 livecd ~ # <i>mke2fs -j /dev/md3</i>
326
327 <comment>(Create file systems on logical volumes)</comment>
328 livecd ~ # <i>mke2fs -b 4096 -T largefile /dev/vg/distfiles</i>
329 livecd ~ # <i>mke2fs -j /dev/vg/home</i>
330 livecd ~ # <i>mke2fs -j /dev/vg/opt</i>
331 livecd ~ # <i>mke2fs -b 1024 -N 200000 /dev/vg/portage</i>
332 livecd ~ # <i>mke2fs /dev/vg/tmp</i>
333 livecd ~ # <i>mke2fs -j /dev/vg/usr</i>
334 livecd ~ # <i>mke2fs -j /dev/vg/var</i>
335 livecd ~ # <i>mke2fs /dev/vg/vartmp</i>
336
337 <comment>(Create and activate swap)</comment>
338 livecd ~ # <i>mkswap /dev/sda2 &amp;&amp; mkswap /dev/sdb2</i>
339 livecd ~ # <i>swapon -p 1 /dev/sda2 &amp;&amp; swapon -p 1 /dev/sdb2</i>
340 <comment>(Check that all swap partitions use the same priority)</comment>
341 livecd ~ # <i>swapon -v -s</i>
342 Filename Type Size Used Priority
343 /dev/sda2 partition 401616 0 1
344 /dev/sdb2 partition 401616 0 1
345 </pre>
346
347 <p>
348 Mount the freshly created file systems on <path>/mnt/gentoo</path>. Create
349 directories for the other mount points and mount them too.
350 </p>
351
352 <pre caption="Mount the file systems">
353 livecd ~ # <i>mount /dev/md3 /mnt/gentoo</i>
354 livecd ~ # <i>cd /mnt/gentoo</i>
355 livecd gentoo # <i>mkdir boot home usr opt var tmp</i>
356 livecd gentoo # <i>mount /dev/md1 /mnt/gentoo/boot</i>
357 livecd gentoo # <i>mount /dev/vg/usr /mnt/gentoo/usr</i>
358 livecd gentoo # <i>mount /dev/vg/home /mnt/gentoo/home</i>
359 livecd gentoo # <i>mount /dev/vg/opt /mnt/gentoo/opt</i>
360 livecd gentoo # <i>mount /dev/vg/tmp /mnt/gentoo/tmp</i>
361 livecd gentoo # <i>mount /dev/vg/var /mnt/gentoo/var</i>
362 livecd gentoo # <i>mkdir usr/portage var/tmp</i>
363 livecd gentoo # <i>mount /dev/vg/vartmp /mnt/gentoo/var/tmp</i>
364 livecd gentoo # <i>mount /dev/vg/portage /mnt/gentoo/usr/portage</i>
365 livecd gentoo # <i>mkdir usr/portage/distfiles</i>
366 livecd gentoo # <i>mount /dev/vg/distfiles /mnt/gentoo/usr/portage/distfiles</i>
367
368 <comment>(Set proper perms on tmp directories)</comment>
369 livecd gentoo # <i>chmod 1777 /mnt/gentoo/tmp /mnt/gentoo/var/tmp</i>
370 </pre>
371
372 </body>
373 </section>
374
375 <section>
376 <include href="gentoo-x86-quickinstall-stage.xml"/>
377 </section>
378
379 <section>
380 <title>Kernel Configuration</title>
381 <body>
382
383 <p>
384 Install a kernel source (usually <c>gentoo-sources</c>), configure it, compile
385 it and copy the <path>arch/i386/boot/bzImage</path> file to <path>/boot</path>.
386 </p>
387
388 <pre caption="Install a kernel source, compile it and install the kernel">
389 livecd etc # <i>time emerge gentoo-sources</i>
390
391 real 3m3.110s
392 user 1m2.320s
393 sys 0m34.990s
394 livecd etc # <i>cd /usr/src/linux</i>
395 livecd linux # <i>make menuconfig</i>
396
397 <comment>(Configure your kernel as usual and make sure the raid and lvm modules you need are
398 compiled in, i.e. <b>not</b> as modules. The same applies to the disk drivers and filesystems.)</comment>
399 Multi-device support (RAID and LVM) --->
400 [*] Multiple devices driver support (RAID and LVM)
401 &lt;*&gt; RAID support
402 &lt; &gt; Linear (append) mode (NEW)
403 &lt;*&gt; RAID-0 (striping) mode
404 &lt;*&gt; RAID-1 (mirroring) mode
405 &lt; &gt; RAID-10 (mirrored striping) mode (EXPERIMENTAL) (NEW)
406 &lt; &gt; RAID-4/RAID-5 mode (NEW)
407 &lt; &gt; RAID-6 mode (NEW)
408 &lt; &gt; Multipath I/O support (NEW)
409 &lt; &gt; Faulty test module for MD (NEW)
410 &lt;*&gt; Device mapper support
411 &lt; &gt; Crypt target support (NEW)
412 &lt; &gt; Snapshot target (EXPERIMENTAL) (NEW)
413 &lt; &gt; Mirror target (EXPERIMENTAL) (NEW)
414 &lt; &gt; Zero target (EXPERIMENTAL) (NEW)
415 &lt; &gt; Multipath target (EXPERIMENTAL) (NEW)
416 &lt; &gt; Bad Block Relocation Device Target (EXPERIMENTAL) (NEW)
417
418 livecd linux # <i>time make -j2</i>
419
420 <comment>(Elapsed time depends highly on the options you selected)</comment>
421 real 5m5.869s
422 user 4m32.320s
423 sys 0m32.930s
424
425 livecd linux # <i>make modules_install</i>
426 livecd linux # <i>cp arch/i386/boot/bzImage /boot/kernel</i>
427 </pre>
428
429 <p>
430 Next build an initramfs to boot the system with.
431 </p>
432
433 <pre caption="Building an initramfs">
434 # <i>emerge genkernel</i>
435 # <i>genkernel --install --no-ramdisk-modules --lvm --mdadm initramfs</i>
436 </pre>
437
438 </body>
439 </section>
440
441 <section>
442 <include href="gentoo-x86-quickinstall-system.xml"/>
443 </section>
444
445 <section id="reboot">
446 <title>Reboot</title>
447 <body>
448
449 <p>
450 Exit the chrooted environment, unmount all file systems and reboot:
451 </p>
452
453 <pre caption="Reboot">
454 livecd conf.d # <i>exit</i>
455 livecd / # <i>umount -l /mnt/gentoo/usr{/portage/distfiles,/portage,}</i>
456 livecd / # <i>umount -l /mnt/gentoo/dev{/pts,/shm,}</i>
457 livecd / # <i>umount -l /mnt/gentoo{/usr,/var/tmp,/tmp,/var,/opt,/dev,/proc,/home,/boot,}</i>
458 livecd / # <i>reboot</i>
459 <comment>(Don't forget to remove the CD)</comment>
460 </pre>
461
462 </body>
463 </section>
464
465 <section>
466 <include href="gentoo-x86-quickinstall-after-reboot.xml"/>
467 </section>
468
469 </chapter>
470 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20