1 .\" Written by Oron Peled <oron@actcom.co.il>.
2 .\" May be distributed subject to the GPL.
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
10 .\" Modified 2004-11-03 patch from Martin Schulze <joey@infodrom.org>
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>
16 .TH BOOT 7 2010-09-19 "Linux" "Linux Programmer's Manual"
18 .\"O boot-scripts \- General description of boot sequence
20 boot-scripts \- ブートシーケンスの一般的な解説
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 細かいところはシステムによって異なるが、大まかに言うと、
32 (1) ハードウェアのブート (2) OS ローダー
33 (3) カーネルの起動 (4) init と inittab
35 .\"O .SS "Hardware-boot"
37 .\"O After power-on or hard reset, control is given
38 .\"O to a program stored on read-only memory (normally
40 .\"O In PC we usually call this program the \fBBIOS\fR.
42 ROM (通常は PROM) に保存されているプログラムに制御が渡される。
43 PC ではこのプログラムは通常 \fBBIOS\fR と呼ばれる。
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) と呼ばれている。
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 しかし、ハードウェアブートプログラムは、少なくとも、
67 ブートデバイスとして探索するデバイスがどれであるかを
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 ブートデバイスのあらかじめ決まった場所に置かれている
78 .\"O We do not cover here booting from network.
80 .\"O to investigate this subject may want to research:
81 .\"O DHCP, TFTP, PXE, Etherboot.
83 ここではネットワークブートについては触れない。
85 DHCP, TFTP, PXE, Etherboot 等について調べてみるとよい。
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) と呼ばれる。
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.
102 ほとんどのシステムで第一ローダーは非常に簡単な機能しか持っていない。
104 サイズの制限やローダーの機能などにある程度の制限は存在する。
105 しかしパーティションテーブルを含めて 512 バイトという
106 PC の MBR では、OS ローダーの全機能をここに押し込むのはまず不可能だ。
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 後者はあらかじめ指定されたディスクパーティションに置けるようになっている。
114 .\"O In Linux the OS loader is normally
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 ローダーは、ふつう
127 である。両者とも第二ローダーとしてインストールすることもでき
128 (この場合 DOS がインストールした MBR がこれらを指すようにする)、
129 また第一・第二ローダーの両方としてインストールすることもできる。
130 後者の場合向けに、両者は特別な MBR イメージを提供している。
131 これには第二ローダーをルートパーティションからロードするような
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
141 OS ローダーの主な仕事は、カーネルのディスク上の位置を特定し、
142 ロードして起動することである。ほとんどの OS ローダーは、
143 対話モードで使用することもでき、追加のパラメータをカーネルに渡したり、
144 デフォルトとは別のカーネルを指定したりすることができる
145 (例えば、最後にコンパイルしたカーネルが機能しなかった時に
146 バックアップのカーネルを指定して起動するといったことができる)。
147 .\"O .SS "Kernel Startup"
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 ルートファイルシステム (/) をマウントする。
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 カーネルに渡すことのできるパラメータのいくつかは、
166 (例えばデフォルトのルートファイルシステムを変更したりできる)。
167 Linux カーネルパラメータに関するより詳しい情報は
171 .\"O Only then the kernel creates the first (user land)
172 .\"O process which is numbered 1.
173 .\"O This process executes the
175 .\"O .IR /sbin/init ,
176 .\"O passing any parameters that weren't handled by the kernel already.
178 カーネルは最初の (ユーザランドの) プロセスを生成し、
182 カーネルによって解釈されていないパラメータはすべて
185 .\"O .SS "init and inittab"
187 .\"O When init starts it reads
189 .\"O for further instructions.
190 .\"O This file defines what should be run in different \fIrun-levels\fR.
196 によってどのような動作を行うべきであるかを定義する。
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
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 では大抵のネットワークサービスを起動する、など)。
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"
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,
232 .\"O Some systems (Slackware Linux, FreeBSD, OpenBSD)
233 .\"O have a somewhat different scheme of boot scripts.
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 など)。
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 それぞれに対して、ブートスクリプトがひとつずつ特定のディレクトリ
259 それぞれ引数としてひとつの単語を取る。"start" が指定されると
260 そのサービスを起動し、"stop" が指定されるとサービスを停止する。
261 スクリプトは他の「便利な」引数を取ってもよい
262 (例えば "restart" で停止・起動を順番に行ったり、"status"
266 .\"O .SS "Sequencing Directories"
268 .\"O To make specific scripts start/stop at specific run-levels and in
269 .\"O specific order, there are \fIsequencing directories\fR.
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
275 あるランレベルで、特定のスクリプトを指定した順序で実行させるため、
276 .I 順序付けディレクトリ (sequencing directory)
282 ディレクトリに置かれたスクリプトへのリンク (ふつうはシンボリックリンク)
285 .\"O A primary script (usually \fI/etc/rc\fR) is called from
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).
291 .\"O names that begin with \(aqK\(aq are being called with the argument "stop"
292 .\"O (thereby stopping the service).
298 順序付けディレクトリに置かれたリンク経由で各サービススクリプトを呼び出す。
299 名前が \(aqS\(aq ではじまるリンクは "start" という引数をつけて呼び出され
300 (すなわちサービスが起動し)。名前が \(aqK\(aq ではじまるリンクは "stop"
301 という引数をつけて呼び出される (すなわちサービスが停止する)。
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.
308 .\"O the link \fI/etc/rc2.d/S80sendmail\fR starts the sendmail service on
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 リンクの名前には順序を示す数字が含まれる。
315 リンク名の末尾には対応するサービスの名前がつけられる。
317 .I /etc/rc2.d/S80sendmail
318 というリンクは、sendmail サービスをランレベル 2 において起動する。
320 .I /etc/rc2.d/S12syslog
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
328 .\"O .BR chkconfig (8)).
331 しかし多くの Linux ディストリビューションでは、
332 これらの作業を手助けしてくれるツールが存在する
336 .\"O .SS "Boot Configuration"
338 .\"O Usually the daemons started may optionally receive command-line options
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.
347 コマンドラインオプションやパラメータを指定できるのが普通である。
348 システム管理者がこれらのパラメータを変更したいと思ったときに、
349 ブートスクリプトそのものを編集しなくてもすむよう、
350 設定ファイルが用いられる。これらは特定のディレクトリ
353 に置かれ、ブートスクリプトから参照される。
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 これらのファイルには単にシェル変数が書かれているだけである。
366 に置かれたブートスクリプトは、これらの設定ファイルを
373 .\"O .IR /etc/rc[S0\-6].d/ ,
374 .IR /etc/rc[S0\-6].d/ ,