/[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.7 - (hide annotations) (download) (as text)
Sun Aug 1 11:30:07 2004 UTC (10 years, 2 months ago) by swift
Branch: MAIN
Changes since 1.6: +10 -45 lines
File MIME type: application/xml
#58723 - Use mdadm for raid creation

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

  ViewVC Help
Powered by ViewVC 1.1.20