/[gentoo]/xml/htdocs/doc/en/handbook/hb-install-alpha-disk.xml
Gentoo

Contents of /xml/htdocs/doc/en/handbook/hb-install-alpha-disk.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations) (download) (as text)
Mon Jul 26 16:40:13 2004 UTC (10 years, 4 months ago) by swift
Branch: MAIN
Changes since 1.4: +12 -12 lines
File MIME type: application/xml
Fix #52267 - Incorrect device naming for alpha; patch provided by wwoods

1 swift 1.1 <?xml version='1.0' encoding='UTF-8'?>
2     <!DOCTYPE sections SYSTEM "/dtd/book.dtd">
3    
4     <!-- The content of this document is licensed under the CC-BY-SA license -->
5     <!-- See http://creativecommons.org/licenses/by-sa/1.0 -->
6    
7 swift 1.5 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-alpha-disk.xml,v 1.4 2004/07/18 10:29:59 neysx Exp $ -->
8 swift 1.1
9     <sections>
10     <section>
11     <title>Introduction to Block Devices</title>
12     <subsection>
13     <title>Block Devices</title>
14     <body>
15    
16     <p>
17     We'll take a good look at disk-oriented aspects of Gentoo Linux
18     and Linux in general, including Linux filesystems, partitions and block devices.
19     Then, once you're familiar with the ins and outs of disks and filesystems,
20     you'll be guided through the process of setting up partitions and filesystems
21     for your Gentoo Linux installation.
22     </p>
23    
24     <p>
25     To begin, we'll introduce <e>block devices</e>. The most famous block device is
26     probably the one that represents the first SCSI HD in a Linux system, namely
27     <path>/dev/sda</path>.
28     </p>
29    
30     <p>
31     The block devices above represent an abstract interface to the disk. User
32     programs can use these block devices to interact with your disk without worrying
33     about whether your drives are IDE, SCSI or something else. The program can
34     simply address the storage on the disk as a bunch of contiguous,
35     randomly-accessible 512-byte blocks.
36     </p>
37    
38     </body>
39     </subsection>
40     <subsection>
41     <title>Slices</title>
42     <body>
43    
44     <p>
45     Although it is theoretically possible to use a full disk to house your Linux
46     system, this is almost never done in practice. Instead, full disk block devices
47     are split up in smaller, more manageable block devices. On Alpha systems,
48     these are called <e>slices</e>.
49     </p>
50    
51     </body>
52     </subsection>
53     </section>
54     <section>
55     <title>Designing a Partitioning Scheme</title>
56     <subsection>
57     <title>Default Partitioning Scheme</title>
58     <body>
59    
60     <p>
61     As an example we use the following slice layout:
62     </p>
63    
64     <table>
65     <tr>
66     <th>Slice</th>
67     <th>Description</th>
68     </tr>
69     <tr>
70 swift 1.5 <ti><path>/dev/sda1</path></ti>
71 swift 1.1 <ti>Swap slice</ti>
72     </tr>
73     <tr>
74 swift 1.5 <ti><path>/dev/sda2</path></ti>
75 swift 1.1 <ti>Root slice</ti>
76     </tr>
77     <tr>
78 swift 1.5 <ti><path>/dev/sda3</path></ti>
79 swift 1.1 <ti>Full disk (required)</ti>
80     </tr>
81     </table>
82    
83    
84     <p>
85     If you are interested in knowing how big a partition should be, or even how
86     many partitions (or volumes) you need, read on. Otherwise continue now with
87     <uri link="#fdisk">Using fdisk to Partition your Disk</uri>.
88     </p>
89    
90     </body>
91     </subsection>
92     <subsection>
93     <title>How Many and How Big?</title>
94     <body>
95    
96     <p>
97     The number of partitions is highly dependent on your environment. For instance,
98     if you have lots of users, you will most likely want to have your
99     <path>/home</path> separate as it increases security and makes backups easier.
100     If you are installing Gentoo to perform as a mailserver, your
101     <path>/var</path> should be separate as all mails are stored inside
102     <path>/var</path>. A good choice of filesystem will then maximise your
103     performance. Gameservers will have a separate <path>/opt</path> as most gaming
104     servers are installed there. The reason is similar for <path>/home</path>:
105     security and backups.
106     </p>
107    
108     <p>
109     As you can see, it very much depends on what you want to achieve. Separate
110     partitions or volumes have the following advantages:
111     </p>
112    
113     <ul>
114     <li>
115 neysx 1.3 You can choose the best performing filesystem for each partition or volume
116 swift 1.1 </li>
117     <li>
118     Your entire system cannot run out of free space if one defunct tool is
119     continuously writing files to a partition or volume
120     </li>
121     <li>
122     If necessary, file system checks are reduced in time, as multiple checks can
123     be done in parallel (although this advantage is more with multiple disks than
124     it is with multiple partitions)
125     </li>
126     <li>
127     Security can be enhanced by mounting some partitions or volumes read-only,
128     nosuid (setuid bits are ignored), noexec (executable bits are ignored) etc.
129     </li>
130     </ul>
131    
132     <p>
133     However, multiple partitions have one big disadvantage: if not configured
134     properly, you might result in having a system with lots
135     of free space on one partition and none on another.
136     </p>
137    
138     </body>
139     </subsection>
140     </section>
141 neysx 1.2 <section id="fdisk">
142 swift 1.1 <title>Using fdisk on Alpha to Partition your Disk</title>
143     <subsection>
144     <body>
145    
146     <p>
147     The following parts explain how to create the example slice layout described
148     previously, namely:
149     </p>
150    
151     <table>
152     <tr>
153     <th>Slice</th>
154     <th>Description</th>
155     </tr>
156     <tr>
157 swift 1.5 <ti><path>/dev/sda1</path></ti>
158 swift 1.1 <ti>Swap slice</ti>
159     </tr>
160     <tr>
161 swift 1.5 <ti><path>/dev/sda2</path></ti>
162 swift 1.1 <ti>Root slice</ti>
163     </tr>
164     <tr>
165 swift 1.5 <ti><path>/dev/sda3</path></ti>
166 swift 1.1 <ti>Full disk (required)</ti>
167     </tr>
168     </table>
169    
170     <p>
171     Change your slice layout according to your own will.
172     </p>
173    
174    
175     </body>
176     </subsection>
177     <subsection>
178     <title>Identifying Available Disks</title>
179     <body>
180    
181     <p>
182     To figure out what disks you have running, use the following commands:
183     </p>
184    
185     <pre caption="Identifying available disks">
186     <comment>(For IDE disks)</comment> # <i>dmesg | grep 'drive$'</i>
187     <comment>(For SCSI disks)</comment> # <i>dmesg | grep 'scsi'</i>
188     </pre>
189    
190     <p>
191     From this output you should be able to see what disks were detected and their
192     respective <path>/dev</path> entry. In the following parts we assume that the
193     disk is a SCSI disk on <path>/dev/sda</path>.
194     </p>
195    
196     <p>
197     Now fire up <c>fdisk</c>:
198     </p>
199    
200     <pre caption="Starting fdisk">
201     # <i>fdisk /dev/sda</i>
202     </pre>
203    
204     </body>
205     </subsection>
206     <subsection>
207     <title>Deleting All Slices</title>
208     <body>
209    
210     <p>
211     We start with deleting all slices <e>except</e> the 'c'-slice. The following
212     shows how to delete a slice (in the example we use 'a'). Repeat the process to
213     delete all other slices (again, except the 'c'-slice).
214     </p>
215    
216     <p>
217     Use <c>p</c> to view all existing slices. <c>d</c> is used to delete a slice.
218     </p>
219    
220     <pre caption="Deleting a slice">
221     BSD disklabel command (m for help): <i>p</i>
222    
223     8 partitions:
224     # start end size fstype [fsize bsize cpg]
225     a: 1 235* 234* 4.2BSD 1024 8192 16
226     b: 235* 469* 234* swap
227     c: 1 5290* 5289* unused 0 0
228     d: 469* 2076* 1607* unused 0 0
229     e: 2076* 3683* 1607* unused 0 0
230     f: 3683* 5290* 1607* unused 0 0
231     g: 469* 1749* 1280 4.2BSD 1024 8192 16
232     h: 1749* 5290* 3541* unused 0 0
233    
234     BSD disklabel command (m for help): <i>d</i>
235     Partition (a-h): <i>a</i>
236     </pre>
237    
238     <p>
239     After repeating this process for all slices, a listing should show you something
240     similar to this:
241     </p>
242    
243     <pre caption="Viewing an empty scheme">
244     BSD disklabel command (m for help): <i>p</i>
245    
246     3 partitions:
247     # start end size fstype [fsize bsize cpg]
248     c: 1 5290* 5289* unused 0 0
249     </pre>
250    
251     </body>
252     </subsection>
253     <subsection>
254     <title>Creating the Swap Slice</title>
255     <body>
256    
257     <p>
258     On Alpha based systems you don't need a separate boot partition. However, the
259     first cylinder cannot be used as the <c>aboot</c> image will be placed there.
260     </p>
261    
262     <p>
263     We will create a swap slice starting at the third cylinder, with a total
264     size of 1 Gbyte. Use <c>n</c> to create a new slice. After creating the slice,
265     we will change its type to <c>1</c>, meaning <e>swap</e>.
266     </p>
267    
268     <pre caption="Creating the swap slice">
269     BSD disklabel command (m for help): <i>n</i>
270     Partition (a-p): <i>a</i>
271     First cylinder (1-5290, default 1): <i>3</i>
272     Last cylinder or +size or +sizeM or +sizeK (3-5290, default 5290): <i>+1024M</i>
273    
274     BSD disklabel command (m for help): <i>t</i>
275     Partition (a-c): <i>a</i>
276     Hex code (type L to list codes): <i>1</i>
277     </pre>
278    
279     <p>
280     After these steps you should see a layout similar to the following:
281     </p>
282    
283     <pre caption="Slice layout after creating the swap slice">
284     BSD disklabel command (m for help): <i>p</i>
285    
286     3 partitions:
287     # start end size fstype [fsize bsize cpg]
288     a: 3 1003 1001 swap
289     c: 1 5290* 5289* unused 0 0
290     </pre>
291    
292     </body>
293     </subsection>
294     <subsection>
295     <title>Create the Root Slice</title>
296     <body>
297    
298     <p>
299     We will now create the root slice, starting from the first cylinder <e>after</e>
300     the swap slice. Use the <c>p</c> command to view where the swap slice ends. In
301     our example, this is at 1003, making the root partition start at 1004.
302     </p>
303    
304     <p>
305     Another problem is that there is currently a bug in <c>fdisk</c> making it think
306     the number of available cylinders is one above the real number of cylinders. In
307     other words, when you are asked for the last cylinder, decrease the cylinder
308     number (in this example: 5290) with one.
309     </p>
310    
311     <p>
312     When the partition is created, we change the type to <c>8</c>, for <e>ext2</e>.
313     </p>
314    
315     <pre caption="Creating the root slice">
316     D disklabel command (m for help): <i>n</i>
317     Partition (a-p): <i>b</i>
318     First cylinder (1-5290, default 1): <i>1004</i>
319     Last cylinder or +size or +sizeM or +sizeK (1004-5290, default 5290): <i>5289</i>
320    
321     BSD disklabel command (m for help): <i>t</i>
322     Partition (a-c): <i>b</i>
323     Hex code (type L to list codes): <i>8</i>
324     </pre>
325    
326     <p>
327     Your slice layout should now be similar to this:
328     </p>
329    
330     <pre caption="Viewing the slice layout">
331     BSD disklabel command (m for help): <i>p</i>
332    
333     3 partitions:
334     # start end size fstype [fsize bsize cpg]
335     a: 3 1003 1001 swap
336     b: 1004 5289 4286 ext2
337     c: 1 5290* 5289* unused 0 0
338     </pre>
339    
340     </body>
341     </subsection>
342     <subsection>
343     <title>Save the Slice Layout and Exit</title>
344     <body>
345    
346     <p>
347     Save <c>fdisk</c> by typing <c>w</c>. This will also save your slice layout.
348     </p>
349    
350     <pre caption="Save and exit fdisk">
351     Command (m for help): <i>w</i>
352     </pre>
353    
354     <p>
355     Now that your slices are created, you can now continue with <uri
356     link="#filesystems">Creating Filesystems</uri>.
357     </p>
358    
359     </body>
360     </subsection>
361     </section>
362     <section id="filesystems">
363     <title>Creating Filesystems</title>
364     <subsection>
365     <title>Introduction</title>
366     <body>
367    
368     <p>
369     Now that your partitions are created, it is time to place a filesystem on them.
370     If you don't care about what filesystem to choose and are happy with what we use
371     as default in this handbook, continue with <uri
372     link="#filesystems-apply">Applying a Filesystem to a Partition</uri>.
373     Otherwise read on to learn about the available filesystems...
374     </p>
375    
376     </body>
377     </subsection>
378     <subsection>
379     <title>Filesystems?</title>
380     <body>
381    
382     <p>
383     Several filesystems are available. Most of them are found stable on the
384     Alpha architecture.
385     </p>
386    
387     <p>
388     <b>ext2</b> is the tried and true Linux filesystem but doesn't have metadata
389     journaling, which means that routine ext2 filesystem checks at startup time can
390     be quite time-consuming. There is now quite a selection of newer-generation
391     journaled filesystems that can be checked for consistency very quickly and are
392     thus generally preferred over their non-journaled counterparts. Journaled
393     filesystems prevent long delays when you boot your system and your filesystem
394     happens to be in an inconsistent state.
395     </p>
396    
397     <p>
398     <b>ext3</b> is the journaled version of the ext2 filesystem, providing metadata
399     journaling for fast recovery in addition to other enhanced journaling modes like
400     full data and ordered data journaling. ext3 is a very good and reliable
401     filesystem. It has an additional hashed b-tree indexing option that enables
402     high performance in almost all situations. In short, ext3 is an excellent
403     filesystem.
404     </p>
405    
406     <p>
407     <b>ReiserFS</b> is a B*-tree based filesystem that has very good overall
408     performance and greatly outperforms both ext2 and ext3 when dealing with small
409     files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales
410     extremely well and has metadata journaling. As of kernel 2.4.18+, ReiserFS is
411     solid and usable as both general-purpose filesystem and for extreme cases such
412     as the creation of large filesystems, the use of many small files, very large
413     files and directories containing tens of thousands of files.
414     </p>
415    
416     <p>
417 neysx 1.4 <b>XFS</b> is a filesystem with metadata journaling which comes with a robust
418     feature-set and is optimized for scalability. We only recommend using this
419     filesystem on Linux systems with high-end SCSI and/or fibre channel storage and
420     an uninterruptible power supply. Because XFS aggressively caches in-transit data
421     in RAM, improperly designed programs (those that don't take proper precautions
422     when writing files to disk and there are quite a few of them) can lose a good
423     deal of data if the system goes down unexpectedly.
424 swift 1.1 </p>
425    
426     <p>
427     <b>JFS</b> is IBM's high-performance journaling filesystem. It has recently
428     become production-ready and there hasn't been a sufficient track record to
429     comment positively nor negatively on its general stability at this point.
430     </p>
431    
432     </body>
433     </subsection>
434     <subsection id="filesystems-apply">
435     <title>Applying a Filesystem to a Partition</title>
436     <body>
437    
438     <p>
439     To create a filesystem on a partition or volume, there are tools available for
440     each possible filesystem:
441     </p>
442    
443     <table>
444     <tr>
445     <th>Filesystem</th>
446     <th>Creation Command</th>
447     </tr>
448     <tr>
449     <ti>ext2</ti>
450     <ti><c>mke2fs</c></ti>
451     </tr>
452     <tr>
453     <ti>ext3</ti>
454     <ti><c>mke2fs -j</c></ti>
455     </tr>
456     <tr>
457     <ti>reiserfs</ti>
458     <ti><c>mkreiserfs</c></ti>
459     </tr>
460     <tr>
461     <ti>xfs</ti>
462     <ti><c>mkfs.xfs</c></ti>
463     </tr>
464     <tr>
465     <ti>jfs</ti>
466     <ti><c>mkfs.jfs</c></ti>
467     </tr>
468     </table>
469    
470     <p>
471 swift 1.5 For instance, to have the root partition (<path>/dev/sda2</path> in our example)
472 swift 1.1 in ext3, you would use:
473     </p>
474    
475     <pre caption="Applying a filesystem on a partition">
476 swift 1.5 # <i>mke2fs -j /dev/sda2</i>
477 swift 1.1 </pre>
478    
479     <p>
480     Now create the filesystems on your newly created partitions (or logical
481     volumes).
482     </p>
483    
484     </body>
485     </subsection>
486     <subsection>
487     <title>Activating the Swap Partition</title>
488     <body>
489    
490     <p>
491     <c>mkswap</c> is the command that is used to initialize swap partitions:
492     </p>
493    
494     <pre caption="Creating a Swap signature">
495 swift 1.5 # <i>mkswap /dev/sda1</i>
496 swift 1.1 </pre>
497    
498     <p>
499     To activate the swap partition, use <c>swapon</c>:
500     </p>
501    
502     <pre caption="Activating the swap partition">
503 swift 1.5 # <i>swapon /dev/sda1</i>
504 swift 1.1 </pre>
505    
506     <p>
507     Create and activate the swap now.
508     </p>
509    
510     </body>
511     </subsection>
512     </section>
513     <section>
514     <title>Mounting</title>
515     <body>
516    
517     <p>
518     Now that your partitions are initialized and are housing a filesystem, it is
519     time to mount those partitions. Use the <c>mount</c> command. Don't forget to
520     create the necessary mount directories for every partition you created. As an
521     example we mount the root and boot partition:
522     </p>
523    
524     <pre caption="Mounting partitions">
525 swift 1.5 # <i>mount /dev/sda2 /mnt/gentoo</i>
526 swift 1.1 </pre>
527    
528     <note>
529     If you want your <path>/tmp</path> to reside on a separate partition, be sure to
530     change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. This
531     also holds for <path>/var/tmp</path>.
532     </note>
533    
534     <p>
535     We also need to mount the proc filesystem (a virtual interface with the kernel)
536     on <path>/proc</path>. We first create the <path>/mnt/gentoo/proc</path>
537     mountpoint and then mount the filesystem:
538     </p>
539    
540     <pre caption="Creating the /mnt/gentoo/proc mountpoint">
541     # <i>mkdir /mnt/gentoo/proc</i>
542     # <i>mount -t proc none /mnt/gentoo/proc</i>
543     </pre>
544    
545     <p>
546     Now continue with <uri link="?part=1&amp;chap=5">Installing the Gentoo
547     Installation Files</uri>.
548     </p>
549    
550     </body>
551     </section>
552     </sections>

  ViewVC Help
Powered by ViewVC 1.1.20