OSDN Git Service

46a69b572324aa03229ffd3a13cb809738c894fe
[linuxjm/LDP_man-pages.git] / draft / man7 / boot.7
1 .\" Written by Oron Peled <oron@actcom.co.il>.
2 .\" May be distributed subject to the GPL.
3 .\"
4 .\" I tried to be as much generic in the description as possible:
5 .\" - General boot sequence is applicable to almost any
6 .\" OS/Machine (DOS/PC, Linux/PC, Solaris/SPARC, CMS/S390)
7 .\" - kernel and init(8) is applicable to almost any UNIX/Linux
8 .\" - boot scripts are applicable to SYSV-R4 based UNIX/Linux
9 .\"
10 .\" Modified 2004-11-03 patch from Martin Schulze <joey@infodrom.org>
11 .\"
12 .\" Japanese Version Copyright (c) 2002 NAKANO Takeo all rights reserved.
13 .\" Translated 2002-08-07, NAKANO Takeo <nakano@apm.seikei.ac.jp>
14 .\" Updated 2005-02-21, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
15 .\"
16 .TH BOOT 7 2010-09-19 "Linux" "Linux Programmer's Manual"
17 .\"O .SH NAME
18 .\"O boot-scripts \- General description of boot sequence
19 .SH 名前
20 boot-scripts \- ブートシーケンスの一般的な解説
21 .\"O .SH DESCRIPTION
22 .SH 説明
23 .\"O .LP
24 .\"O The boot sequence varies in details among systems
25 .\"O but can be roughly divided to the following steps:
26 .\"O (i) hardware boot, (ii) OS loader,
27 .\"O (iii) kernel startup, (iv) init and inittab,
28 .\"O (v) boot scripts.
29 .\"O We will describe each of these in more detail below.
30 細かいところはシステムによって異なるが、大まかに言うと、
31 ブートシーケンスは以下の段階に分けられる:
32 (1) ハードウェアのブート (2) OS ローダー
33 (3) カーネルの起動 (4) init と inittab
34 (5) ブートスクリプト
35 .\"O .SS "Hardware-boot"
36 .SS ハードウェアのブート
37 .\"O After power-on or hard reset, control is given
38 .\"O to a program stored on read-only memory (normally
39 .\"O PROM).
40 .\"O In PC we usually call this program the \fBBIOS\fR.
41 電源投入やハードリセットが行われると、
42 ROM (通常は PROM) に保存されているプログラムに制御が渡される。
43 PC ではこのプログラムは通常 \fBBIOS\fR と呼ばれる。
44
45 .\"O This program normally makes a basic self-test of the
46 .\"O machine and accesses nonvolatile memory to read
47 .\"O further parameters.
48 .\"O This memory in the PC is
49 .\"O battery-backed CMOS memory, so most people
50 .\"O refer to it as the \fBCMOS\fR, although outside
51 .\"O of the PC world, it is usually called \fBnvram\fR
52 .\"O (nonvolatile ram).
53 ふつうこのプログラムは、まずマシンの基本的な自己診断を行い、
54 そして不揮発性メモリにアクセスして各種のパラメータを読み込む。
55 PC では、このメモリは電池によってバックアップされている CMOS メモリである。
56 そのため \fBCMOS\fR と呼ばれることが多い。
57 しかし PC 以外の世界では、通常 \fBnvram\fR
58 (nonvolatile ram) と呼ばれている。
59
60 .\"O The parameters stored in the nvram vary between
61 .\"O systems, but as a minimum, the hardware boot program
62 .\"O should know what is the boot device, or which devices
63 .\"O to probe as possible boot devices.
64 nvram に保存されているパラメータはシステムによって異なる。
65 しかし、ハードウェアブートプログラムは、少なくとも、
66 ブートデバイスがどれであるか、もしくは
67 ブートデバイスとして探索するデバイスがどれであるかを
68 知っていなければならない。
69
70 .\"O Then the hardware boot stage accesses the boot device,
71 .\"O loads the OS Loader, which is located on a fixed position
72 .\"O on the boot device, and transfers control to it.
73 ハードウェアブートのシーケンスは、次にブートデバイスにアクセスし、
74 ブートデバイスのあらかじめ決まった場所に置かれている
75 OS ローダーをロードし、制御を渡す。
76 .TP
77 .\"O Note:
78 .\"O We do not cover here booting from network.
79 .\"O Those who want
80 .\"O to investigate this subject may want to research:
81 .\"O DHCP, TFTP, PXE, Etherboot.
82 注意:
83 ここではネットワークブートについては触れない。
84 この話題について調査したい読者は、
85 DHCP, TFTP, PXE, Etherboot 等について調べてみるとよい。
86 .\"O .SS "OS Loader"
87 .SS OS ローダー
88 .\"O In PC, the OS Loader is located in the first sector
89 .\"O of the boot device \- this is the \fBMBR\fR
90 .\"O (Master Boot Record).
91 PC では、OS ローダーはブートデバイスの先頭セクタに置かれる。
92 これは \fBMBR\fR (Master Boot Record) と呼ばれる。
93
94 .\"O In most systems, this primary loader is very
95 .\"O limited due to various constraints.
96 .\"O Even on non-PC systems
97 .\"O there are some limitations to the size and complexity
98 .\"O of this loader, but the size limitation of the PC MBR
99 .\"O (512 bytes including the partition table) makes it
100 .\"O almost impossible to squeeze a full OS Loader into it.
101 様々な制約のため、
102 ほとんどのシステムで第一ローダーは非常に簡単な機能しか持っていない。
103 PC 以外のシステムでも、
104 サイズの制限やローダーの機能などにある程度の制限は存在する。
105 しかしパーティションテーブルを含めて 512 バイトという
106 PC の MBR では、OS ローダーの全機能をここに押し込むのはまず不可能だ。
107
108 .\"O Therefore, most operating systems make the primary loader
109 .\"O call a secondary OS loader which may be located on
110 .\"O a specified disk partition.
111 したがって大抵の OS では、第一ローダーは第二ローダーを呼ぶようになっており、
112 後者はあらかじめ指定されたディスクパーティションに置けるようになっている。
113
114 .\"O In Linux the OS loader is normally
115 .\"O .BR lilo (8)
116 .\"O or
117 .\"O .BR grub (8).
118 .\"O Both of them may install either as secondary loaders
119 .\"O (where the DOS installed MBR points to them), or
120 .\"O as a two part loader where they provide special MBR
121 .\"O containing the bootstrap code to load the second part
122 .\"O of the loader from the root partition.
123 Linux における OS ローダーは、ふつう
124 .BR lilo (8)
125
126 .BR grub (8)
127 である。両者とも第二ローダーとしてインストールすることもでき
128 (この場合 DOS がインストールした MBR がこれらを指すようにする)、
129 また第一・第二ローダーの両方としてインストールすることもできる。
130 後者の場合向けに、両者は特別な MBR イメージを提供している。
131 これには第二ローダーをルートパーティションからロードするような
132 ブートストラップコードが含まれている。
133
134 .\"O The main job of the OS Loader is to locate the kernel
135 .\"O on the disk, load it and run it.
136 .\"O Most OS loaders allow
137 .\"O interactive use, to enable specification of alternative
138 .\"O kernel (maybe a backup in case the last compiled one
139 .\"O isn't functioning) and to pass optional parameters
140 .\"O to the kernel.
141 OS ローダーの主な仕事は、カーネルのディスク上の位置を特定し、
142 ロードして起動することである。ほとんどの OS ローダーは、
143 対話モードで使用することもでき、追加のパラメータをカーネルに渡したり、
144 デフォルトとは別のカーネルを指定したりすることができる
145 (例えば、最後にコンパイルしたカーネルが機能しなかった時に
146 バックアップのカーネルを指定して起動するといったことができる)。
147 .\"O .SS "Kernel Startup"
148 .SS カーネルの起動
149 .\"O When the kernel is loaded, it initializes the devices (via
150 .\"O their drivers), starts the swapper (it is a "kernel process",
151 .\"O called kswapd in modern Linux kernels), and mounts the root
152 .\"O file system (/).
153 カーネルはロードされると、デバイスを (ドライバによって)
154 初期化し、スワッパを起動し (最近の Linux カーネルでは、
155 スワッパは kswapd という「カーネルプロセス」になる)、
156 ルートファイルシステム (/) をマウントする。
157
158 .\"O Some of the parameters that may be passed to the kernel
159 .\"O relate to these activities (e.g: You can override the
160 .\"O default root file system).
161 .\"O For further information
162 .\"O on Linux kernel parameters read
163 .\"O .BR bootparam (7).
164 カーネルに渡すことのできるパラメータのいくつかは、
165 これらの動作に関係する。
166 (例えばデフォルトのルートファイルシステムを変更したりできる)。
167 Linux カーネルパラメータに関するより詳しい情報は
168 .BR bootparam (7)
169 を読んでほしい。
170
171 .\"O Only then the kernel creates the first (user land)
172 .\"O process which is numbered 1.
173 .\"O This process executes the
174 .\"O program
175 .\"O .IR /sbin/init ,
176 .\"O passing any parameters that weren't handled by the kernel already.
177 これらが済んではじめて、
178 カーネルは最初の (ユーザランドの) プロセスを生成し、
179 番号 1 を与える。このプロセスは
180 .I /sbin/init
181 プログラムを実行する。
182 カーネルによって解釈されていないパラメータはすべて
183 .I /sbin/init
184 に渡される。
185 .\"O .SS "init and inittab"
186 .SS init と inittab
187 .\"O When init starts it reads
188 .\"O .I /etc/inittab
189 .\"O for further instructions.
190 .\"O This file defines what should be run in different \fIrun-levels\fR.
191 init は、起動するとまず
192 .I /etc/inittab
193 を読み、その後の行動に関する情報を得る。
194 このファイルは
195 .I ランレベル
196 によってどのような動作を行うべきであるかを定義する。
197
198 .\"O This gives the system administrator an easy management scheme, where
199 .\"O each run-level is associated with a set of services (e.g:
200 .\"O \fBS\fR is \fIsingle-user\fR, on \fB2\fR most network
201 .\"O services start, etc.).
202 .\"O The administrator may change the current
203 .\"O run-level via
204 .\"O .BR init (8)
205 .\"O and query the current run-level via
206 .\"O .BR runlevel (8).
207 これによってシステム管理者の管理が楽になる。
208 各\fIランレベル\fRは提供するサービスの集合に対応する
209 (例えば \fBS\fR は \fIシングルユーザ\fR、
210 \fB2\fR では大抵のネットワークサービスを起動する、など)。
211 システム管理者は、
212 .BR init (8)
213 を用いて現在のランレベルを変更でき、
214 .BR runlevel (8)
215 によって現在のランレベルを確認できる。
216
217 .\"O However, since it is not convenient to manage individual services
218 .\"O by editing this file, inittab only bootstraps a set of scripts
219 .\"O that actually start/stop the individual services.
220 しかし、このファイルを編集して個々のサービスを管理するのは不便なので、
221 inittab は単にスクリプトの集合に対するブートストラップになっている。
222 実際の個々のサービスの起動や停止は、これらのスクリプトで行う。
223 .\"O .SS "Boot Scripts"
224 .SS ブートスクリプト
225 .\"O
226 .TP
227 .\"O Note:
228 .\"O The following description applies to System V release 4-based systems, which
229 .\"O currently covers most commercial UNIX systems (Solaris, HP-UX, Irix, Tru64)
230 .\"O as well as the major Linux distributions (Red Hat, Debian, Mandriva,
231 .\"O SUSE, Ubuntu).
232 .\"O Some systems (Slackware Linux, FreeBSD, OpenBSD)
233 .\"O have a somewhat different scheme of boot scripts.
234 注意:
235 以下の説明は System V Release 4 をベースとしたシステムに関するものである。
236 現在の大抵の商用 UNIX システム (Solaris, HP-UX, Irix, Tru64) や、
237 メジャーな Linux ディストリビューション (Red Hat, Debian, Mandriva,
238 SUSE, Ubuntu) はこれをベースにしたものである。
239 システムによっては、ブートスクリプトの機構が
240 いくらか異なることもある (Slackware Linux, FreeBSD, OpenBSD など)。
241 .LP
242 .\"O For each managed service (mail, nfs server, cron, etc.) there is
243 .\"O a single startup script located in a specific directory
244 .\"O .RI ( /etc/init.d
245 .\"O in most versions of Linux).
246 .\"O Each of these scripts accepts as a single argument
247 .\"O the word "start" \-\- causing it to start the service, or the word
248 .\"O \&"stop" \-\- causing it to stop the service.
249 .\"O The script may optionally
250 .\"O accept other "convenience" parameters (e.g: "restart", to stop and then
251 .\"O start, "status" do display the service status).
252 .\"O Running the script
253 .\"O without parameters displays the possible arguments.
254 管理すべき各サービス (メール、nfs サーバ、cron などなど)
255 それぞれに対して、ブートスクリプトがひとつずつ特定のディレクトリ
256 (ほとんどの Linux で
257 .IR /etc/init.d )
258 に配置される。これらのスクリプトは、
259 それぞれ引数としてひとつの単語を取る。"start" が指定されると
260 そのサービスを起動し、"stop" が指定されるとサービスを停止する。
261 スクリプトは他の「便利な」引数を取ってもよい
262 (例えば "restart" で停止・起動を順番に行ったり、"status"
263 でサービスの状態を表示するなど)。
264 スクリプトを引数なしで実行すると、
265 指定できる引数の一覧が表示される。
266 .\"O .SS "Sequencing Directories"
267 .SS 順序づけディレクトリ
268 .\"O To make specific scripts start/stop at specific run-levels and in
269 .\"O specific order, there are \fIsequencing directories\fR.
270 .\"O These
271 .\"O are normally in \fI/etc/rc[0\-6S].d\fR.
272 .\"O In each of these directories
273 .\"O there are links (usually symbolic) to the scripts in the \fI/etc/init.d\fR
274 .\"O directory.
275 あるランレベルで、特定のスクリプトを指定した順序で実行させるため、
276 .I 順序付けディレクトリ (sequencing directory)
277 という仕組みが存在する。
278 これらはふつう
279 .I /etc/rc[0\-6S].d
280 である。各ディレクトリの内部には、
281 .I /etc/init.d
282 ディレクトリに置かれたスクリプトへのリンク (ふつうはシンボリックリンク)
283 が置かれる。
284
285 .\"O A primary script (usually \fI/etc/rc\fR) is called from
286 .\"O .BR inittab (5)
287 .\"O and calls the services scripts via the links in the sequencing directories.
288 .\"O All links with names that begin with \(aqS\(aq are being called with
289 .\"O the argument "start" (thereby starting the service).
290 .\"O All links with
291 .\"O names that begin with \(aqK\(aq are being called with the argument "stop"
292 .\"O (thereby stopping the service).
293 第一スクリプト (通常
294 .IR /etc/rc )
295
296 .BR inittab (5)
297 から呼ばれ、
298 順序付けディレクトリに置かれたリンク経由で各サービススクリプトを呼び出す。
299 名前が \(aqS\(aq ではじまるリンクは "start" という引数をつけて呼び出され
300 (すなわちサービスが起動し)。名前が \(aqK\(aq ではじまるリンクは "stop"
301 という引数をつけて呼び出される (すなわちサービスが停止する)。
302
303 .\"O To define the starting or stopping order within the same run-level,
304 .\"O the names of the links contain order-numbers.
305 .\"O Also, to make the names clearer, they usually
306 .\"O end with the name of the service they refer to.
307 .\"O Example:
308 .\"O the link \fI/etc/rc2.d/S80sendmail\fR starts the sendmail service on
309 .\"O runlevel 2.
310 .\"O This happens after \fI/etc/rc2.d/S12syslog\fR is run
311 .\"O but before \fI/etc/rc2.d/S90xfs\fR is run.
312 同じランレベルの内部での起動や停止の順序を規定するために、
313 リンクの名前には順序を示す数字が含まれる。
314 また、名前をわかりやすくするため、
315 リンク名の末尾には対応するサービスの名前がつけられる。
316 例えば、
317 .I /etc/rc2.d/S80sendmail
318 というリンクは、sendmail サービスをランレベル 2 において起動する。
319 これは、
320 .I /etc/rc2.d/S12syslog
321 よりも後に、また
322 .I /etc/rc2.d/S90xfs
323 よりも先に実行される。
324
325 .\"O To manage the boot order and run-levels, we have to manage these links.
326 .\"O However, on many versions of Linux, there are tools to help with this task
327 .\"O (e.g:
328 .\"O .BR chkconfig (8)).
329 ブートの順序とランレベルを管理するには、
330 これらのリンクを管理しなければならない。
331 しかし多くの Linux ディストリビューションでは、
332 これらの作業を手助けしてくれるツールが存在する
333 (例えば
334 .BR chkconfig (8)
335 など)。
336 .\"O .SS "Boot Configuration"
337 .SS ブートの設定
338 .\"O Usually the daemons started may optionally receive command-line options
339 .\"O and parameters.
340 .\"O To allow system administrators to change these
341 .\"O parameters without editing the boot scripts themselves,
342 .\"O configuration files are used.
343 .\"O These are located in a specific
344 .\"O directory (\fI/etc/sysconfig\fR on Red Hat systems) and are
345 .\"O used by the boot scripts.
346 デーモンの起動時には、
347 コマンドラインオプションやパラメータを指定できるのが普通である。
348 システム管理者がこれらのパラメータを変更したいと思ったときに、
349 ブートスクリプトそのものを編集しなくてもすむよう、
350 設定ファイルが用いられる。これらは特定のディレクトリ
351 (Red Hat システムでは
352 .IR /etc/sysconfig )
353 に置かれ、ブートスクリプトから参照される。
354
355 .\"O In older UNIX systems, these files contained the actual command line
356 .\"O options for the daemons, but in modern Linux systems (and also
357 .\"O in HP-UX), these files just contain shell variables.
358 .\"O The boot scripts in \fI/etc/init.d\fR
359 .\"O \fBsource\fR the configuration
360 .\"O files, and then use the variable values.
361 古い UNIX システムでは、これらのファイルには
362 デーモンに与える実際のコマンドラインオプションが書かれていた。
363 しかし最近の Linux システム (や HP-UX) では、
364 これらのファイルには単にシェル変数が書かれているだけである。
365 .I /etc/init.d
366 に置かれたブートスクリプトは、これらの設定ファイルを
367 .B source
368 し、その変数の値を用いる。
369 .\"O .SH FILES
370 .SH ファイル
371 .\"O .LP
372 .IR /etc/init.d/ ,
373 .\"O .IR /etc/rc[S0\-6].d/ ,
374 .IR /etc/rc[S0\-6].d/ ,
375 .I /etc/sysconfig/
376 .\"O .SH SEE ALSO
377 .SH 関連項目
378 .BR inittab (5),
379 .BR bootparam (7),
380 .BR init (8),
381 .BR runlevel (8),
382 .BR shutdown (8)