/[gentoo]/xml/htdocs/doc/en/gentoo-x86-tipsntricks.xml
Gentoo

Contents of /xml/htdocs/doc/en/gentoo-x86-tipsntricks.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (show annotations) (download) (as text)
Sat Jul 2 12:12:46 2005 UTC (9 years ago) by swift
Branch: MAIN
Changes since 1.12: +5 -3 lines
File MIME type: application/xml
#97496 - Save array information in mdadm.conf

1 <?xml version='1.0' encoding="UTF-8"?>
2 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/gentoo-x86-tipsntricks.xml,v 1.12 2005/05/12 09:40:22 neysx Exp $ -->
4
5 <guide link="/doc/en/gentoo-x86-tipsntricks.xml">
6 <title>Gentoo/x86 Installation Tips &amp; Tricks</title>
7 <author title="Author">
8 <mail link="swift@gentoo.org">Sven Vermeulen</mail>
9 </author>
10
11 <abstract>
12 The Gentoo installation allows for very flexible approaches to the various
13 installation methods. As it is almost impossible to insert every single tip or
14 trick in the installation instructions this document tries to deal with all
15 submitted tips and tricks for reference purposes.
16 </abstract>
17
18 <license/>
19
20 <version>1.8</version>
21 <date>2005-07-02</date>
22
23 <chapter>
24 <title>Introduction</title>
25 <section>
26 <title>Preliminary</title>
27 <body>
28
29 <p>
30 This document contains various tips and tricks for the Gentoo/x86 installation.
31 Most of them are discussed in a dense way - they are meant as an addendum to the
32 installation instructions and not as a replacement.
33 </p>
34
35 </body>
36 </section>
37 <section>
38 <title>Contents</title>
39 <body>
40
41 <p>
42 <b>Advanced Installations</b>
43 </p>
44
45 <ul>
46 <li><uri link="#software-raid">Software RAID</uri></li>
47 <li><uri link="#ata-raid-2.4">ATA RAID using 2.4 kernels</uri></li>
48 <li><uri link="#livecd-kernel">Using the LiveCD kernel</uri></li>
49 </ul>
50
51 <p>
52 <b>Simplifying the Installation</b>
53 </p>
54
55 <ul>
56 <li><uri link="#leave_terminal">Leaving the Terminal</uri></li>
57 </ul>
58
59 <p>
60 <b>Fixing Errors/Issues</b>
61 </p>
62
63 <ul>
64 <li><uri link="#checking-disks">Extensive Testing of your Disks</uri></li>
65 <li>
66 <uri link="#recover">Recovering from a malfunctioning installation</uri>
67 </li>
68 </ul>
69
70 </body>
71 </section>
72 </chapter>
73 <chapter>
74 <title>Advanced Installations</title>
75 <section id="software-raid">
76 <title>Software RAID</title>
77 <body>
78
79 <note>
80 If you are not familiar with software raid, please read the <uri
81 link="http://tldp.org/HOWTO/Software-RAID-HOWTO.html">Software-RAID-HOWTO</uri>.
82 </note>
83
84 <p>
85 Once you are booted from the LiveCD, load the appropriate RAID modules. For
86 instance, if you plan on using RAID-1:
87 </p>
88
89 <pre caption="Loading the RAID-1 module">
90 # <i>modprobe raid1</i>
91 </pre>
92
93 <p>
94 When you partition your disks, make sure that your partitions use <c>fd</c>
95 (Linux raid autodetect) as Partition Type instead of <c>83</c> (Linux native).
96 You can alter the partition type using the <c>t</c> command in <c>fdisk</c>.
97 </p>
98
99 <p>
100 Now before we start creating the RAID arrays, we need to create the metadevice
101 nodes:
102 </p>
103
104 <pre caption="Creating metadevice nodes">
105 # <i>mknod /dev/md0 b 9 0</i>
106 # <i>mknod /dev/md1 b 9 1</i>
107 # <i>mknod /dev/md2 b 9 2</i>
108 </pre>
109
110 <p>
111 After partitioning, create the <path>/etc/mdadm.conf</path> file (yes, indeed,
112 on the LiveCD environment) using <c>mdadm</c>, an advanced tool for <uri
113 link="http://www.linuxdevcenter.com/pub/a/linux/2002/12/05/RAID.html">RAID
114 management</uri>. For instance, to have your boot, swap and root partition
115 mirrored (RAID-1) covering <path>/dev/sda</path> and <path>/dev/sdb</path>,
116 you can use:
117 </p>
118
119 <pre caption="mdadm command example">
120 # <i>mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1</i>
121 # <i>mdadm --create --verbose /dev/md1 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2</i>
122 # <i>mdadm --create --verbose /dev/md2 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb3</i>
123 <comment>(Save information about the created devices in mdadm.conf)</comment>
124 # <i>mdadm --detail --scan > /etc/mdadm.conf</i>
125 </pre>
126
127 <p>
128 The Linux Software RAID driver will start creating the metadevices. You can see
129 its progress in <path>/proc/mdstat</path>. Wait until the metadevices are
130 completely finished before proceeding.
131 </p>
132
133 <p>
134 From now onwards, use <path>/dev/md0</path> for the boot partition,
135 <path>/dev/md1</path> for the swap partition and <path>/dev/md2</path> for the
136 root partition.
137 </p>
138
139 <p>
140 After mounting <path>/dev/md2</path> on <path>/mnt/gentoo</path>, don't forget
141 to copy over <path>/etc/mdadm.conf</path> to <path>/mnt/gentoo/etc</path>.
142 </p>
143
144 <p>
145 When you're configuring your kernel, make sure you have the appropriate RAID
146 support <e>in</e> your kernel and not as module.
147 </p>
148
149 <p>
150 When installing extra tools, emerge <c>mdadm</c> as well. Note that this
151 isn't available on all LiveCDs so you might not be able to install Gentoo on a
152 Software RAID when using a networkless installation!
153 </p>
154
155 <p>
156 When configuring your bootloader, make sure it gets installed in the MBR of
157 <e>both</e> disks if you use mirroring.
158 </p>
159
160 </body>
161 </section>
162 <section id="ata-raid-2.4">
163 <title>ATA RAID using 2.4 kernels</title>
164 <body>
165
166 <p>
167 Make sure you boot your LiveCD using the <c>doataraid</c> option. Once booted,
168 check the contents of <path>/dev/ataraid</path>. It should contain various
169 <path>disc*</path> directories for each harddisk available in the ATA RAID. An
170 entire disk is displayed as <path>disc</path> while partitions are
171 <path>part*</path>.
172 </p>
173
174 <p>
175 Write down the various <path>/dev/ataraid/disc*/*</path> device files that you
176 use to install Gentoo on. You will need to substitute the <path>/dev/hda</path>
177 examples in the installation with this path.
178 </p>
179
180 <p>
181 Before chrooting, bind-mount the <path>/dev</path> structure in the new
182 environment:
183 </p>
184
185 <pre caption="Bind-mounting /dev">
186 # <i>mount -o bind /dev /mnt/gentoo/dev</i>
187 </pre>
188
189 <p>
190 When configuring your kernel, make sure you enable support for your ATA RAID
191 chipset and options. For instance, a popular ATA RAID system is a <e>Promise
192 FastTrack built-in RAID</e> in which case you definitely need <c>Promise
193 FastTrack Options</c> built in into your kernel.
194 </p>
195
196 <p>
197 When configuring GRUB, you first have to create a GRUB bootdisk. This is not as
198 hard as you think. First install GRUB as you would, but when you come to the
199 part where GRUB is getting installed in the MBR, follow the following
200 instructions:
201 </p>
202
203 <pre caption="Creating a GRUB bootdisk">
204 # <i>cd /boot/grub</i>
205 # <i>dd if=stage1 of=/dev/fd0 bs=512 count=1</i>
206 # <i>dd if=stage2 of=/dev/fd0 bs=512 seek=1</i>
207 </pre>
208
209 <p>
210 You still need to write your <path>grub.conf</path> file. This is no different
211 from the installation instructions, just make sure that your <c>root=</c> points
212 to the ATA RAID device.
213 </p>
214
215 <p>
216 After finishing the installation, boot with your GRUB bootdisk. You will be
217 greeted by a GRUB prompt. Now configure GRUB to boot from the ATA RAID device:
218 </p>
219
220 <pre caption="Installing GRUB on the ATA RAID">
221 grub&gt; root (hd0,x)
222 grub&gt; setup (hd0)
223 grub&gt; quit
224 </pre>
225
226 <p>
227 Now reboot (with the GRUB bootfloppy removed).
228 </p>
229
230 <p>
231 LILO users can safely use the instructions mentioned in the installation
232 instructions.
233 </p>
234
235 </body>
236 </section>
237 <section id="livecd-kernel">
238 <title>Using the LiveCD kernel</title>
239 <body>
240
241 <p>
242 If you don't want to compile a kernel yourself you can use the kernel from the
243 LiveCD and copy it to your system. When you come to the point that you're asked
244 to compile a kernel, go to another terminal (press Alt-F2) and log in with the
245 root password you've supplied at the beginning of the installation.
246 </p>
247
248 <p>
249 Copy over the kernel and modules to your Gentoo system:
250 </p>
251
252 <pre caption="Copying over the LiveCD kernel">
253 <comment>(${KN} is the kernel name, usually something like 'gentoo' or 'smp')</comment>
254 cdimage ~# <i>cp /mnt/cdrom/isolinux/${KN} /mnt/cdrom/isolinux/${KN}.gz /mnt/gentoo/boot</i>
255 cdimage ~# <i>mkdir -p /mnt/gentoo/lib/modules</i>
256 cdiamge ~# <i>cp -Rp /lib/modules/`uname -r` /mnt/gentoo/lib/modules</i>
257 </pre>
258
259 <p>
260 Make sure you <c>emerge hotplug</c> and have it added to the boot runlevel. To
261 have all modules that are currently running (from the LiveCD) loaded during
262 bootup of your Gentoo system, run the following command from within the chrooted
263 environment:
264 </p>
265
266 <pre caption="Adding all running modules to the modules.conf file">
267 # <i>cat /proc/modules | cut -d ' ' -f 1 &gt;&gt; \</i>
268 <i>/etc/modules.autoload.d/kernel-`uname -r | cut -d . -f -2`</i>
269 # <i>modules-update</i>
270 </pre>
271
272 </body>
273 </section>
274 </chapter>
275
276 <chapter>
277 <title>Simplifying the Installation</title>
278 <section id="leave_terminal">
279 <title>Leaving your Terminal</title>
280 <body>
281
282 <p>
283 Many people want to leave their system when it's compiling. In certain cases
284 this is rather difficult as the installation is done in a public environment
285 where you cannot trust everyone. If this is the case, you want to be able to
286 perform the compilation in the background and log out from all terminals.
287 </p>
288
289 <p>
290 There are several possible solutions for this. The first one is to use
291 <c>screen</c>. After booting the LiveCD, set your root password and start a
292 screen session:
293 </p>
294
295 <note>
296 Not all LiveCDs provide screen. If this is the case, you will have to use one of
297 the other methods described in this section.
298 </note>
299
300 <pre caption="Starting a screen session">
301 # <i>screen -S gentoo</i>
302 </pre>
303
304 <p>
305 Once inside the screen session you can perform the entire installation. When you
306 want to leave your terminal, press <c>Ctrl-a, d</c> (that is, control and a at
307 the same time, then followed by a d) to <e>detach</e> your screen session. You
308 can now safely log out of your system.
309 </p>
310
311 <p>
312 To regain access to your terminal, log in as root again and <e>attach</e> to
313 the running screen session:
314 </p>
315
316 <pre caption="Attaching to a screen session">
317 # <i>screen -x gentoo</i>
318 </pre>
319
320 <p>
321 If you can't use screen, there is still a way to leave your terminal. Follow the
322 installation instructions, but when you come to the point where a long-term
323 compilation would be started (for instance the <c>./scripts/bootstrap.sh</c>
324 step), use <c>nohup</c> which allows for a process to continue even when you log
325 out. Don't forget the trailing "&amp;", otherwise the process won't be placed in
326 the background! Remember where you are (the <c>pwd</c> command will show you
327 that) as you will need to know this later on.
328 </p>
329
330 <pre caption="Using nohup">
331 # <i>pwd</i>
332 /usr/portage
333 # <i>nohup ./scripts/bootstrap.sh &amp;</i>
334 </pre>
335
336 <p>
337 Now exit the chrooted environment (<c>exit</c>) and the LiveCD session. Your
338 compilation will continue in the background.
339 </p>
340
341 <p>
342 When you want to check the compilation, log in as root (on the LiveCD) and
343 chroot back into your environment and go to the directory where you left off:
344 </p>
345
346 <pre caption="Chrooting back">
347 # <i>chroot /mnt/gentoo /bin/bash</i>
348 # <i>env-update &amp;&amp; source /etc/profile</i>
349 # <i>cd /usr/portage</i>
350 </pre>
351
352 <p>
353 Now use the <c>less</c> command on the <path>nohup.out</path> file that is
354 situated inside that directory. The compilation will append its output to that
355 file, so if you want to follow the compilation progress, run <c>less
356 nohup.out</c> and press <c>F</c> to follow the changes. When the compilation is
357 finished, you can continue with the next step of the installation instructions.
358 </p>
359
360 <p>
361 If you ever get tired of following the changes, press <c>Ctrl-C</c> followed by
362 a <c>q</c>. This won't stop the compilation process, only the <c>less</c>
363 process.
364 </p>
365
366 </body>
367 </section>
368 </chapter>
369
370 <chapter>
371 <title>Fixing Errors/Issues</title>
372 <section id="checking-disks">
373 <title>Extensive Testing of your Disks</title>
374 <body>
375
376 <p>
377 If you think your disk needs to be thoroughly checked for consistency (bad
378 sectors and such), you can use the <c>-c</c> option while placing the ext2 or
379 ext3 filesystem on it (using <c>mke2fs</c>). This will perform a read-test and
380 will mark all bad blocks as such. If you are really paranoid, use <c>-c -c</c>
381 to perform an extensive read/write test.
382 </p>
383
384 <pre caption="Checking for disk consistency">
385 # <i>mke2fs -j -c /dev/hda3</i>
386 </pre>
387
388 </body>
389 </section>
390 <section id="recover">
391 <title>Recovering from a malfunctioning installation</title>
392 <body>
393
394 <p>
395 If for some reason your Gentoo installation fails, you don't have to redo the
396 installation all over again. Instead, you can safely "go" to the point where you
397 think you made a mistake (or where you think the instructions are flawed) and
398 try a different approach.
399 </p>
400
401 <p>
402 First of all you need to chroot back into your Gentoo Linux environment. Follow
403 the instructions again, but ignore the partitioning steps as your partitions are
404 already created and even populated. You can therefore immediately mount those
405 partitions at <path>/mnt/gentoo</path>. You should also ignore the steps about
406 stage extraction and modifying <path>make.conf</path> - you don't want to
407 overwrite your files do you?
408 </p>
409
410 <p>
411 Once chrooted inside your Gentoo Linux environment, immediately go to the step
412 where you think you should try a different approach. Don't redo all the steps
413 like bootstrapping and such unless that is the place where you think things
414 went wrong.
415 </p>
416
417 <p>
418 For instance, if you believe that you have a wrongly configured
419 <path>grub.conf</path>, you can immediately fire up your editor to update
420 <path>/boot/grub/grub.conf</path>.
421 </p>
422
423 <p>
424 Once you have tried a different approach for your situation, you should consider
425 how much of the subsequent steps you need to perform again. If the subsequent
426 steps are depending on your change, you will need to redo those.
427 </p>
428
429 <p>
430 For instance,
431 </p>
432
433 <ul>
434 <li>
435 if you have changed a variable inside <path>make.conf</path> you will need
436 to do all subsequent compiling since those depend on the settings inside
437 <path>make.conf</path>
438 </li>
439 <li>
440 if you have altered <path>/boot/grub/grub.conf</path> you can immediately
441 exit the chrooted environment and reboot as no subsequent steps are
442 depending on <path>grub.conf</path>
443 </li>
444 <li>
445 if you have recompiled your kernel you only need to make sure that your
446 bootloader configuration points to the correct kernel image (double-check
447 that you mounted your <path>/boot</path>!), then you can exit the chrooted
448 environment and reboot
449 </li>
450 <li>
451 if you have altered <path>/etc/fstab</path> you can exit the chrooted
452 environment and reboot
453 </li>
454 </ul>
455
456 <p>
457 As you can see, for most recovery operations you can immediately reboot. Only in
458 certain cases will you need to redo the subsequent installation steps.
459 </p>
460
461 </body>
462 </section>
463
464 </chapter>
465
466 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20