/[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.7 - (hide annotations) (download) (as text)
Tue Aug 17 00:01:21 2004 UTC (10 years ago) by vapier
Branch: MAIN
Changes since 1.6: +18 -3 lines
File MIME type: application/xml
add info on how to create a BSD disklabel if your drive is empty

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 vapier 1.7 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-alpha-disk.xml,v 1.6 2004/08/02 15:54:00 swift 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 vapier 1.7 # <i>dmesg | grep 'drive$'</i> <comment>(For IDE disks)</comment>
187     # <i>dmesg | grep 'scsi'</i> <comment>(For SCSI disks)</comment>
188 swift 1.1 </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 vapier 1.7 If your hard drive is completely blank, then you'll have to first create
212     a BSD disklabel.
213     </p>
214    
215     <pre caption="Creating BSD disklabel">
216     Command (m for help): <i>b</i>
217     /dev/sda contains no disklabel.
218     Do you want to create a disklabel? (y/n) <i>y</i>
219     <comment>A bunch of drive-specific info will show here</comment>
220     3 partitions:
221     # start end size fstype [fsize bsize cpg]
222     c: 1 5290* 5289* unused 0 0
223     </pre>
224    
225     <p>
226 swift 1.1 We start with deleting all slices <e>except</e> the 'c'-slice. The following
227     shows how to delete a slice (in the example we use 'a'). Repeat the process to
228     delete all other slices (again, except the 'c'-slice).
229     </p>
230    
231     <p>
232     Use <c>p</c> to view all existing slices. <c>d</c> is used to delete a slice.
233     </p>
234    
235     <pre caption="Deleting a slice">
236     BSD disklabel command (m for help): <i>p</i>
237    
238     8 partitions:
239     # start end size fstype [fsize bsize cpg]
240     a: 1 235* 234* 4.2BSD 1024 8192 16
241     b: 235* 469* 234* swap
242     c: 1 5290* 5289* unused 0 0
243     d: 469* 2076* 1607* unused 0 0
244     e: 2076* 3683* 1607* unused 0 0
245     f: 3683* 5290* 1607* unused 0 0
246     g: 469* 1749* 1280 4.2BSD 1024 8192 16
247     h: 1749* 5290* 3541* unused 0 0
248    
249     BSD disklabel command (m for help): <i>d</i>
250     Partition (a-h): <i>a</i>
251     </pre>
252    
253     <p>
254     After repeating this process for all slices, a listing should show you something
255     similar to this:
256     </p>
257    
258     <pre caption="Viewing an empty scheme">
259     BSD disklabel command (m for help): <i>p</i>
260    
261     3 partitions:
262     # start end size fstype [fsize bsize cpg]
263     c: 1 5290* 5289* unused 0 0
264     </pre>
265    
266     </body>
267     </subsection>
268     <subsection>
269     <title>Creating the Swap Slice</title>
270     <body>
271    
272     <p>
273     On Alpha based systems you don't need a separate boot partition. However, the
274     first cylinder cannot be used as the <c>aboot</c> image will be placed there.
275     </p>
276    
277     <p>
278     We will create a swap slice starting at the third cylinder, with a total
279     size of 1 Gbyte. Use <c>n</c> to create a new slice. After creating the slice,
280     we will change its type to <c>1</c>, meaning <e>swap</e>.
281     </p>
282    
283     <pre caption="Creating the swap slice">
284     BSD disklabel command (m for help): <i>n</i>
285     Partition (a-p): <i>a</i>
286     First cylinder (1-5290, default 1): <i>3</i>
287     Last cylinder or +size or +sizeM or +sizeK (3-5290, default 5290): <i>+1024M</i>
288    
289     BSD disklabel command (m for help): <i>t</i>
290     Partition (a-c): <i>a</i>
291     Hex code (type L to list codes): <i>1</i>
292     </pre>
293    
294     <p>
295     After these steps you should see a layout similar to the following:
296     </p>
297    
298     <pre caption="Slice layout after creating the swap slice">
299     BSD disklabel command (m for help): <i>p</i>
300    
301     3 partitions:
302     # start end size fstype [fsize bsize cpg]
303     a: 3 1003 1001 swap
304     c: 1 5290* 5289* unused 0 0
305     </pre>
306    
307     </body>
308     </subsection>
309     <subsection>
310     <title>Create the Root Slice</title>
311     <body>
312    
313     <p>
314     We will now create the root slice, starting from the first cylinder <e>after</e>
315     the swap slice. Use the <c>p</c> command to view where the swap slice ends. In
316     our example, this is at 1003, making the root partition start at 1004.
317     </p>
318    
319     <p>
320     Another problem is that there is currently a bug in <c>fdisk</c> making it think
321     the number of available cylinders is one above the real number of cylinders. In
322     other words, when you are asked for the last cylinder, decrease the cylinder
323     number (in this example: 5290) with one.
324     </p>
325    
326     <p>
327     When the partition is created, we change the type to <c>8</c>, for <e>ext2</e>.
328     </p>
329    
330     <pre caption="Creating the root slice">
331     D disklabel command (m for help): <i>n</i>
332     Partition (a-p): <i>b</i>
333     First cylinder (1-5290, default 1): <i>1004</i>
334     Last cylinder or +size or +sizeM or +sizeK (1004-5290, default 5290): <i>5289</i>
335    
336     BSD disklabel command (m for help): <i>t</i>
337     Partition (a-c): <i>b</i>
338     Hex code (type L to list codes): <i>8</i>
339     </pre>
340    
341     <p>
342     Your slice layout should now be similar to this:
343     </p>
344    
345     <pre caption="Viewing the slice layout">
346     BSD disklabel command (m for help): <i>p</i>
347    
348     3 partitions:
349     # start end size fstype [fsize bsize cpg]
350     a: 3 1003 1001 swap
351     b: 1004 5289 4286 ext2
352     c: 1 5290* 5289* unused 0 0
353     </pre>
354    
355     </body>
356     </subsection>
357     <subsection>
358     <title>Save the Slice Layout and Exit</title>
359     <body>
360    
361     <p>
362     Save <c>fdisk</c> by typing <c>w</c>. This will also save your slice layout.
363     </p>
364    
365     <pre caption="Save and exit fdisk">
366     Command (m for help): <i>w</i>
367     </pre>
368    
369     <p>
370     Now that your slices are created, you can now continue with <uri
371     link="#filesystems">Creating Filesystems</uri>.
372     </p>
373    
374     </body>
375     </subsection>
376     </section>
377     <section id="filesystems">
378     <title>Creating Filesystems</title>
379     <subsection>
380     <title>Introduction</title>
381     <body>
382    
383     <p>
384     Now that your partitions are created, it is time to place a filesystem on them.
385     If you don't care about what filesystem to choose and are happy with what we use
386     as default in this handbook, continue with <uri
387     link="#filesystems-apply">Applying a Filesystem to a Partition</uri>.
388     Otherwise read on to learn about the available filesystems...
389     </p>
390    
391     </body>
392     </subsection>
393     <subsection>
394     <title>Filesystems?</title>
395     <body>
396    
397     <p>
398     Several filesystems are available. Most of them are found stable on the
399     Alpha architecture.
400     </p>
401    
402     <p>
403     <b>ext2</b> is the tried and true Linux filesystem but doesn't have metadata
404     journaling, which means that routine ext2 filesystem checks at startup time can
405     be quite time-consuming. There is now quite a selection of newer-generation
406     journaled filesystems that can be checked for consistency very quickly and are
407     thus generally preferred over their non-journaled counterparts. Journaled
408     filesystems prevent long delays when you boot your system and your filesystem
409     happens to be in an inconsistent state.
410     </p>
411    
412     <p>
413     <b>ext3</b> is the journaled version of the ext2 filesystem, providing metadata
414     journaling for fast recovery in addition to other enhanced journaling modes like
415     full data and ordered data journaling. ext3 is a very good and reliable
416     filesystem. It has an additional hashed b-tree indexing option that enables
417     high performance in almost all situations. In short, ext3 is an excellent
418     filesystem.
419     </p>
420    
421     <p>
422     <b>ReiserFS</b> is a B*-tree based filesystem that has very good overall
423     performance and greatly outperforms both ext2 and ext3 when dealing with small
424     files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales
425     extremely well and has metadata journaling. As of kernel 2.4.18+, ReiserFS is
426     solid and usable as both general-purpose filesystem and for extreme cases such
427     as the creation of large filesystems, the use of many small files, very large
428     files and directories containing tens of thousands of files.
429     </p>
430    
431     <p>
432 neysx 1.4 <b>XFS</b> is a filesystem with metadata journaling which comes with a robust
433     feature-set and is optimized for scalability. We only recommend using this
434     filesystem on Linux systems with high-end SCSI and/or fibre channel storage and
435     an uninterruptible power supply. Because XFS aggressively caches in-transit data
436     in RAM, improperly designed programs (those that don't take proper precautions
437     when writing files to disk and there are quite a few of them) can lose a good
438     deal of data if the system goes down unexpectedly.
439 swift 1.1 </p>
440    
441     <p>
442     <b>JFS</b> is IBM's high-performance journaling filesystem. It has recently
443     become production-ready and there hasn't been a sufficient track record to
444     comment positively nor negatively on its general stability at this point.
445     </p>
446    
447     </body>
448     </subsection>
449     <subsection id="filesystems-apply">
450     <title>Applying a Filesystem to a Partition</title>
451     <body>
452    
453     <p>
454     To create a filesystem on a partition or volume, there are tools available for
455     each possible filesystem:
456     </p>
457    
458     <table>
459     <tr>
460     <th>Filesystem</th>
461     <th>Creation Command</th>
462     </tr>
463     <tr>
464     <ti>ext2</ti>
465     <ti><c>mke2fs</c></ti>
466     </tr>
467     <tr>
468     <ti>ext3</ti>
469     <ti><c>mke2fs -j</c></ti>
470     </tr>
471     <tr>
472     <ti>reiserfs</ti>
473     <ti><c>mkreiserfs</c></ti>
474     </tr>
475     <tr>
476     <ti>xfs</ti>
477     <ti><c>mkfs.xfs</c></ti>
478     </tr>
479     <tr>
480     <ti>jfs</ti>
481     <ti><c>mkfs.jfs</c></ti>
482     </tr>
483     </table>
484    
485     <p>
486 swift 1.5 For instance, to have the root partition (<path>/dev/sda2</path> in our example)
487 swift 1.1 in ext3, you would use:
488     </p>
489    
490     <pre caption="Applying a filesystem on a partition">
491 swift 1.5 # <i>mke2fs -j /dev/sda2</i>
492 swift 1.1 </pre>
493    
494     <p>
495     Now create the filesystems on your newly created partitions (or logical
496     volumes).
497     </p>
498    
499     </body>
500     </subsection>
501     <subsection>
502     <title>Activating the Swap Partition</title>
503     <body>
504    
505     <p>
506     <c>mkswap</c> is the command that is used to initialize swap partitions:
507     </p>
508    
509     <pre caption="Creating a Swap signature">
510 swift 1.5 # <i>mkswap /dev/sda1</i>
511 swift 1.1 </pre>
512    
513     <p>
514     To activate the swap partition, use <c>swapon</c>:
515     </p>
516    
517     <pre caption="Activating the swap partition">
518 swift 1.5 # <i>swapon /dev/sda1</i>
519 swift 1.1 </pre>
520    
521     <p>
522     Create and activate the swap now.
523     </p>
524    
525     </body>
526     </subsection>
527     </section>
528     <section>
529     <title>Mounting</title>
530     <body>
531    
532     <p>
533     Now that your partitions are initialized and are housing a filesystem, it is
534     time to mount those partitions. Use the <c>mount</c> command. Don't forget to
535     create the necessary mount directories for every partition you created. As an
536     example we mount the root and boot partition:
537     </p>
538    
539     <pre caption="Mounting partitions">
540 swift 1.5 # <i>mount /dev/sda2 /mnt/gentoo</i>
541 swift 1.1 </pre>
542    
543     <note>
544     If you want your <path>/tmp</path> to reside on a separate partition, be sure to
545     change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. This
546     also holds for <path>/var/tmp</path>.
547     </note>
548    
549     <p>
550 swift 1.6 We will also have to mount the proc filesystem (a virtual interface with the
551     kernel) on <path>/proc</path>. But first we will need to place our files on the partitions.
552 swift 1.1 </p>
553    
554     <p>
555 swift 1.6 Continue with <uri link="?part=1&amp;chap=5">Installing the Gentoo
556 swift 1.1 Installation Files</uri>.
557     </p>
558    
559     </body>
560     </section>
561     </sections>

  ViewVC Help
Powered by ViewVC 1.1.20