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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.20 - (show annotations) (download) (as text)
Thu Nov 2 20:49:38 2006 UTC (7 years, 11 months ago) by nightmorph
Branch: MAIN
Changes since 1.19: +14 -13 lines
File MIME type: application/xml
Reworded reiserfs and ext3 descriptions for bug 153518

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/2.5 -->
6
7 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-hppa-disk.xml,v 1.19 2006/08/30 22:52:28 nightmorph Exp $ -->
8
9 <sections>
10
11 <version>7.1</version>
12 <date>2006-11-02</date>
13
14 <section>
15 <title>Introduction to Block Devices</title>
16 <subsection>
17 <title>Block Devices</title>
18 <body>
19
20 <p>
21 We'll take a good look at disk-oriented aspects of Gentoo Linux and Linux in
22 general, including Linux filesystems, partitions and block devices. Then, once
23 you're familiar with the ins and outs of disks and filesystems, you'll be
24 guided through the process of setting up partitions and filesystems for your
25 Gentoo Linux installation.
26 </p>
27
28 <p>
29 To begin, we'll introduce <e>block devices</e>. The most famous block device is
30 probably the one that represents the first SCSI HD in a Linux system, namely
31 <path>/dev/sda</path>.
32 </p>
33
34 <p>
35 The block devices above represent an abstract interface to the disk. User
36 programs can use these block devices to interact with your disk without
37 worrying about whether your drives are IDE, SCSI or something else. The program
38 can simply address the storage on the disk as a bunch of contiguous,
39 randomly-accessible 512-byte blocks.
40 </p>
41
42 </body>
43 </subsection>
44 <subsection>
45 <title>Partitions and Slices</title>
46 <body>
47
48 <p>
49 Although it is theoretically possible to use a full disk to house your Linux
50 system, this is almost never done in practice. Instead, full disk block devices
51 are split up in smaller, more manageable block devices. On most systems, these
52 are called <e>partitions</e>. Other architectures use a similar technique,
53 called <e>slices</e>.
54 </p>
55
56 </body>
57 </subsection>
58 </section>
59 <section>
60 <title>Designing a Partitioning Scheme</title>
61 <subsection>
62 <title>How Many and How Big?</title>
63 <body>
64
65 <p>
66 The number of partitions is highly dependent on your environment. For instance,
67 if you have lots of users, you will most likely want to have your
68 <path>/home</path> separate as it increases security and makes backups easier.
69 If you are installing Gentoo to perform as a mailserver, your <path>/var</path>
70 should be separate as all mails are stored inside <path>/var</path>. A good
71 choice of filesystem will then maximise your performance. Gameservers will have
72 a separate <path>/opt</path> as most gaming servers are installed there. The
73 reason is similar for <path>/home</path>: security and backups. You will
74 definitely want to keep <path>/usr</path> big: not only will it contain the
75 majority of applications, the Portage tree alone takes around 500 Mbyte
76 excluding the various sources that are stored in it.
77 </p>
78
79 <p>
80 As you can see, it very much depends on what you want to achieve. Separate
81 partitions or volumes have the following advantages:
82 </p>
83
84 <ul>
85 <li>
86 You can choose the best performing filesystem for each partition or volume
87 </li>
88 <li>
89 Your entire system cannot run out of free space if one defunct tool is
90 continuously writing files to a partition or volume
91 </li>
92 <li>
93 If necessary, file system checks are reduced in time, as multiple checks can
94 be done in parallel (although this advantage is more with multiple disks than
95 it is with multiple partitions)
96 </li>
97 <li>
98 Security can be enhanced by mounting some partitions or volumes read-only,
99 nosuid (setuid bits are ignored), noexec (executable bits are ignored) etc.
100 </li>
101 </ul>
102
103 <p>
104 However, multiple partitions have one big disadvantage: if not configured
105 properly, you might result in having a system with lots of free space on one
106 partition and none on another. There is also a 15-partition limit for SCSI and
107 SATA.
108 </p>
109
110 </body>
111 </subsection>
112 </section>
113 <section>
114 <title>Using fdisk on HPPA to Partition your Disk</title>
115 <body>
116
117 <p>
118 Use <c>fdisk</c> to create the partitions you want:
119 </p>
120
121 <pre caption="Partitioning the disk">
122 # <i>fdisk /dev/sda</i>
123 </pre>
124
125 <p>
126 HPPA machines use the PC standard DOS partition tables. To create a new
127 DOS partition table, simply use the <c>o</c> command.
128 </p>
129
130 <pre caption="Creating a DOS partition table">
131 # <i>fdisk /dev/sda</i>
132
133 Command (m for help): <i>o</i>
134 Building a new DOS disklabel.
135 </pre>
136
137 <p>
138 PALO (the HPPA bootloader) needs a special partition to work. You have
139 to create a partition of at least 16MB at the beginning of your disk.
140 The partition type must be of type <e>f0</e> (Linux/PA-RISC boot).
141 </p>
142
143 <impo>
144 If you ignore this and continue without a special PALO partition, your system
145 will stop loving you and fail to start. Also, if your disk is larger than 2GB,
146 make sure that the boot partition is in the first 2GB of your disk. PALO is
147 unable to read a kernel after the 2GB limit.
148 </impo>
149
150 <pre caption="A simple default partition schema">
151 # <i>cat /etc/fstab</i>
152 /dev/sda2 /boot ext3 noauto,noatime 1 1
153 /dev/sda3 none swap sw 0 0
154 /dev/sda4 / ext3 noatime 0 0
155
156 # <i>fdisk /dev/sda</i>
157
158 Command (m for help): <i>p</i>
159
160 Disk /dev/sda: 4294 MB, 4294816768 bytes
161 133 heads, 62 sectors/track, 1017 cylinders
162 Units = cylinders of 8246 * 512 = 4221952 bytes
163
164 Device Boot Start End Blocks Id System
165 /dev/sda1 1 8 32953 f0 Linux/PA-RISC boot
166 /dev/sda2 9 20 49476 83 Linux
167 /dev/sda3 21 70 206150 82 Linux swap
168 /dev/sda4 71 1017 3904481 83 Linux
169 </pre>
170
171 <p>
172 Now that your partitions are created, you can now continue with <uri
173 link="#filesystems">Creating Filesystems</uri>.
174 </p>
175
176 </body>
177 </section>
178 <section id="filesystems">
179 <title>Creating Filesystems</title>
180 <subsection>
181 <title>Introduction</title>
182 <body>
183
184 <p>
185 Now that your partitions are created, it is time to place a filesystem on them.
186 If you don't care about what filesystem to choose and are happy with what we use
187 as default in this handbook, continue with <uri
188 link="#filesystems-apply">Applying a Filesystem to a Partition</uri>.
189 Otherwise read on to learn about the available filesystems...
190 </p>
191
192 </body>
193 </subsection>
194 <subsection>
195 <title>Filesystems?</title>
196 <body>
197
198 <p>
199 Several filesystems are available. Ext2, ext3, XFS and reiserfs are found
200 stable on the HPPA architecture. The others are very experimental.
201 </p>
202
203 <p>
204 <b>ext2</b> is the tried and true Linux filesystem but doesn't have metadata
205 journaling, which means that routine ext2 filesystem checks at startup time can
206 be quite time-consuming. There is now quite a selection of newer-generation
207 journaled filesystems that can be checked for consistency very quickly and are
208 thus generally preferred over their non-journaled counterparts. Journaled
209 filesystems prevent long delays when you boot your system and your filesystem
210 happens to be in an inconsistent state.
211 </p>
212
213 <p>
214 <b>ext3</b> is the journaled version of the ext2 filesystem, providing metadata
215 journaling for fast recovery in addition to other enhanced journaling modes
216 like full data and ordered data journaling. It uses a hashed B*-tree index that
217 enables high performance in almost all situations. In short, ext3 is a very
218 good and reliable filesystem.
219 </p>
220
221 <p>
222 <b>ReiserFS</b> is a B*-tree based filesystem that has very good overall
223 performance and greatly outperforms both ext2 and ext3 when dealing with small
224 files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales
225 extremely well and has metadata journaling. ReiserFS is solid and usable as
226 both general-purpose filesystem and for extreme cases such as the creation of
227 large filesystems, very large files and directories containing tens of
228 thousands of small files.
229 </p>
230
231 <p>
232 <b>XFS</b> is a filesystem with metadata journaling which comes with a robust
233 feature-set and is optimized for scalability. We only recommend using this
234 filesystem on Linux systems with high-end SCSI and/or fibre channel storage and
235 an uninterruptible power supply. Because XFS aggressively caches in-transit data
236 in RAM, improperly designed programs (those that don't take proper precautions
237 when writing files to disk and there are quite a few of them) can lose a good
238 deal of data if the system goes down unexpectedly.
239 </p>
240
241 <p>
242 <b>JFS</b> is IBM's high-performance journaling filesystem. It has recently
243 become production-ready and there hasn't been a sufficient track record to
244 comment positively nor negatively on its general stability at this point.
245 </p>
246
247 </body>
248 </subsection>
249 <subsection id="filesystems-apply">
250 <title>Applying a Filesystem to a Partition</title>
251 <body>
252
253 <p>
254 To create a filesystem on a partition or volume, there are tools available for
255 each possible filesystem:
256 </p>
257
258 <table>
259 <tr>
260 <th>Filesystem</th>
261 <th>Creation Command</th>
262 </tr>
263 <tr>
264 <ti>ext2</ti>
265 <ti><c>mke2fs</c></ti>
266 </tr>
267 <tr>
268 <ti>ext3</ti>
269 <ti><c>mke2fs -j</c></ti>
270 </tr>
271 <tr>
272 <ti>reiserfs</ti>
273 <ti><c>mkreiserfs</c></ti>
274 </tr>
275 <tr>
276 <ti>xfs</ti>
277 <ti><c>mkfs.xfs</c></ti>
278 </tr>
279 <tr>
280 <ti>jfs</ti>
281 <ti><c>mkfs.jfs</c></ti>
282 </tr>
283 </table>
284
285 <p>
286 For instance, to have the boot partition (<path>/dev/sda2</path> in our
287 example) in ext2 and the root partition (<path>/dev/sda4</path> in our example)
288 in ext3 (as in our example), you would use:
289 </p>
290
291 <pre caption="Applying a filesystem on a partition">
292 # <i>mke2fs /dev/sda2</i>
293 # <i>mke2fs -j /dev/sda4</i>
294 </pre>
295
296 <p>
297 Now create the filesystems on your newly created partitions (or logical
298 volumes).
299 </p>
300
301 </body>
302 </subsection>
303 <subsection>
304 <title>Activating the Swap Partition</title>
305 <body>
306
307 <p>
308 <c>mkswap</c> is the command that is used to initialize swap partitions:
309 </p>
310
311 <pre caption="Creating a Swap signature">
312 # <i>mkswap /dev/sda3</i>
313 </pre>
314
315 <p>
316 To activate the swap partition, use <c>swapon</c>:
317 </p>
318
319 <pre caption="Activating the swap partition">
320 # <i>swapon /dev/sda3</i>
321 </pre>
322
323 <p>
324 Create and activate the swap with the commands mentioned above.
325 </p>
326
327 </body>
328 </subsection>
329 </section>
330 <section>
331 <title>Mounting</title>
332 <body>
333
334 <p>
335 Now that your partitions are initialized and are housing a filesystem, it is
336 time to mount those partitions. Use the <c>mount</c> command. Don't forget to
337 create the necessary mount directories for every partition you created. As an
338 example we mount the root and boot partition:
339 </p>
340
341 <pre caption="Mounting partitions">
342 # <i>mount /dev/sda4 /mnt/gentoo</i>
343 # <i>mkdir /mnt/gentoo/boot</i>
344 # <i>mount /dev/sda2 /mnt/gentoo/boot</i>
345 </pre>
346
347 <note>
348 If you want your <path>/tmp</path> to reside on a separate partition, be sure
349 to change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>.
350 This also holds for <path>/var/tmp</path>.
351 </note>
352
353 <p>
354 We will also have to mount the proc filesystem (a virtual interface with the
355 kernel) on <path>/proc</path>. But first we will need to place our files on the
356 partitions.
357 </p>
358
359 <p>
360 Continue with <uri link="?part=1&amp;chap=5">Installing the Gentoo
361 Installation Files</uri>.
362 </p>
363
364 </body>
365 </section>
366 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20