Nachal'naya zagruzka operacionnoj sistemy
Boot, bootstrapping - slova, oboznachayushchie sejchas
"Zagruzit'/pnut', process nachal'noj zagruzki", na samom dele
proizoshli iz anglijskoj frazy "Pull itself up by its own boot
straps" (Podnyat' sebya za shnurki sobstvennyh botinok)
Nachinaetsya vse s Boot-prom'a - nebol'shoj programmy, kotoraya
hranitsya v nestiraemoj pamyati komp'yutera i nachinaet
vypolnyat'sya srazu posle vklyucheniya.
Estestvenno, boot-prom umeet delat' mnogoe: formatirovat'
diski, installirovat' operacionnuyu sistemu, zapuskat' testy
hardware. Odnako glavnoe ego prednaznachenie - najti na diske i
zapustit' na vypolnenie fajl /unix - yadro operacionnoj sistemy.
I svoego sobstvennogo razuma na eto emu obychno ne hvataet,
poetomu on v pervuyu ochered' zagruzhaet s zhestkogo diska
"zagruzchika operacionnoj sistemy", a uzh tot delaet vse
ostal'noe.
Boot-prom zagruzhaet "BOOT BLOKS" - 1-yu PROGRAMMU NACHALXNOJ
ZAGRUZKI. "boot-bloks" raspolozheny v 1-15 sektorah razdela,
soderzhashchego kornevuyu fajlovuyu sistemu "/". Obychno kornevaya
fajlovaya sistema raspolagaetsya na razdele nomer 0.
"Boot- blocks" mozhno zapisat' na kornevoj razdel
zagruzochnogo diska (obychno eto vnutrennij disk so SCSI-nomerom
3) komandoj installboot. Dlya etogo vypolnyaetsya chto-nibud'
takoe:
installboot /dev/rdsk/c0t3d0s0
Boot-blocks "umeet chitat'" format fajlovoj sistemy unix -
ufs . On nahodit na kornevoj fajlovoj sisteme fajl "/ufsboot"
- 2-YU PROGRAMMU NACHALXNOJ ZAGRUZKI - i zagruzhaet ee.
/ufsboot nahodit yadro /kernel/unix i zagruzhaet ego.
YAdro Unix zagruzhaetsya v operativnuyu pamyat'. Zatem podklyuchaet
dopolnitel'nye zagruzhaemye moduli s draverami ustrojstv. Kak tol'ko yadro
"nabiraet" dostatochnoe kolichestvo draverov, chtoby samostoyatel'no
smontirovat' kornevuyu fajlovuyu sistemu, ono tut zhe eto i delaet, posle chego
nachinaet dejstvovat' samostoyatel'no, ne ispol'zuya koda nachal'nyh
zagruzchikov.
Perehvat v boot-prompt:
STOP+A
Zagruzka v single user:
bo: boot -s
Boot-prom zagruzhaet s diska ZAGRUZCHIK - fajl /stand/boot,
Zagruzchik zagruzhaet yadro /stand/unix
Poskol'ku boot-prom ne v sostoyanii vmestit' koda dlya
raboty so standartnoj unix'ovskoj fajlovoj sistemoj, fajly unix
i boot lezhat v otdel'nom razdele zhestkogo diska - razdele
/stand. Na nem sozdana "OCHENX PROSTAYA FAJLOVAYA SISTEMA" bfs
(Boot File System), chtoby boot-prom'u bylo polegche najti i
schitat' s diska zagruzochnye fajly.
Perehvat v boot-prompt:
Posle togo kak na konsoli poyavitsya soobshchenie: "Idle MPU: none"
nazhat' klavishu PROBEL
Zagruzka v single user:
Vo vremya nachal'noj zagruzki na neskol'ko sekund
poyavlyaetsya priglashenie: "Press _chto-to_to enter system_maintence.
Nazhat' trebuemuyu klavishu
BIOS zagruzhaet blok nachal'noj zagruzki aktivnogo razdela.
On gruzit zagruzchik LILO (LInux LOader). Lilo zagruzhaet
fajl /vmlinuz
Parametry nachal'noj zagruzki zapisyvayutsya v fajle
/etc/lilo.conf Posle lyubyh izmenenij v etom fajle neobhodimo
vypolnit' komandu
lilo
Perehvat v Lilo-prompt:
Left_ALT srazu posle poyavleniya soobshcheniya "Lilo ..."
Zagruzka v single user:
Lilo: linux root=/dev/hda2 single
Zagruzka v eshche bolee single user:
Lilo: linux init=/bin/sh
mount -n -o remount /dev/hda2 /
insmod de4x5
ifconfig eth0 195.232.171.30
route add -net 195.232.171.0 gw 195.232.171.30
insmod nfs
V PZU HP 9000 prozhivaet "PDC" - "Processor Dependent Code"
- chtob pogovorit' s nim, nado nazhat' klavishu ESC v pervye
sekundy zagruzki.
Na zagruzochnom diske est' Boot-razdel formata LIF
(linejnaya fajlovaya sistema) V LIF-tome 4 "fajla"
ISL - "operacionnaya" programma
HPUX - sobstvenno zagruzchik yadra
AUTOBOOT - tekstovyj fajl, v kotorom napisano imya yadra po
umolchaniyu
Itak: PDS vyzyvaet ISL komandoj
bo scsi.6.0 isl
ISL zagruzhaet yadro komandoj
hpux /stand/vmunix
Perehvat v PDC-prompt:
Nazhat' ESC v pervye 10 sekund
Zagruzka v single user:
PDC> bo pri isl
ISL> hpux -is /stand/vmunix
HP-UX: GSP/MP - udalennyj dostup k konsolyu
Plata dlya vneshnego upravleniya apparaturoj i dostupa k konsolyu:
GSP - Guardian Service Processor - v staryh (do 2003) serverah
MP - Management Processor - v Itanium-serverah
predopredelennyj administratorskij login:
Admin/Admin
predopredelennyj IP:
GSP - 192.0.0.192/0.0.0.0
MP - 192.168.1.1/0.0.0.0
############ kak podklyuchit'sya k MP s unix-hosta:
route add 192.0.0.192 {my.own.ip.addres}
ping 192.0.0.192
arp -a | grep 192.0.0.192
arp -s 192.0.0.192 {GSP:ether:net:addres}
telnet 192.0.0.192
MP-komandy
^E CF - perehvat upravleniya na sebya (iz RO v RW)
co - COnsole (perehod iz console v MP-prompt - ^B)
vfp - Virtual Front Panel (^Q,ma - vozvrat v glavnoe menyu)
cm - Command Menu
cl - Console Log viewer
sl - Show chassis Log
he - HElp menu
x - eXit
YAdro inicializiruet sebya i posle etogo zapuskaet process init.
A init - vse ostal'nye processy, programmy, kotorye neobhodimy
dlya normal'nogo funkcionirovaniya operacionnoj sistemy.
Vse dal'nejshie dejstviya v sisteme opredelyayutsya etim processom.
Vse, chto nuzhno delat' init-u, opredelyaet special'naya tablica.
Process init vsegda nahoditsya na kakom-libo "UROVNE VYPOLNENIYA".
Uroven' vypolneniya opredelyaet sostoyanie i povedenie vsej siste-
my. Uroven' oboznachaetsya cifroj (ili bukvoj) 0,1,2,3,4,5,6,s,S
0 - prom monitor - Polnyj ostanov sistemy;
1, s, S - single user mode. Odnopol'zovatel'skij rezhim;
2 - mnogopol'zovatel'skij rezhim bez NFS-servera;
3 - mnogopol'zovatel'skij rezhim s NFS-serverom;
6 - perezagruzka;
* Primernyj fragment upravlyayushchej tablicy /etc/inittab *
bchk::sysinit:/etc/bcheckrc/dev/console 2>&1
brc::sysinit:/etc/brc > /dev/console 2>&1
is:3:initdefault:
rc:12345:wait:/etc/rc > /dev/console 2>&1
r0:0:wait:/etc/rc0 > /dev/console 2>&1
r2:23:wait:/etc/rc2 > /dev/console 2>&1
r3:3:wait:/etc/rc3 > /dev/console 2>&1
pf:12345:powerfail:/etc/powerfail > /dev/console 2>&1
co:12345:respawn:/etc/sysmonitor console console
t1:23:respawn:/etc/sysmonitor tty01 9600
t2:23:off:/etc/sysmonitor tty02 9600
Format tablicy:
IMYA:Urovni_vypolneniya:vid_dejstviya:zapuskaemaya komanda
IMYA: - prosto imya strochki - oni vse dolzhny byt' raznymi
vid_dejstviya:
sysinit zapustit' odin raz posle nachal'noj zagruzki;
na sootvetstvuyushchem urovne vypolneniya:
wait - zapustit' odin raz i dozhidat'sya, poka ne okonchitsya;
respawn - zapustit' parallel'no, a esli okonchitsya, perezapus-
kat' snova;
off - nichego ne delat' (prosto ignorirovat' etu stroku).
Esli posmotret' vnimatel'no na tablicu, to mozhno razobrat'sya,
chto zhe v dejstvitel'nosti proishodit pri zagruzke i otkuda be-
rutsya vse eti zagadochnye soobshcheniya.
Sperva init zapuskaet processy, kotorye "sysinit"
Otrabotav vse stroki "sysinit" urovnya, init idet vse
dal'she po /etc/inittab i obnaruzhivaet stroku initdefault 3 -
ona zastavlyaet ego "perejti" na uroven' 3.
* Run Command - standartnye RC-katalogi zapuska *
Perejdya na uroven' vypolneniya 3, init i otrabatyvaet
pervuyu vstretivshuyusya strochku s urovnem "3" - zapuskaetsya
komandnyj fajl /etc/rc2 - zaglyanite v nego. Tam vse prosto:
/etc/rc2 beret i vypolnyaet komandnye fajly /etc/rc2.d/S*,
lezhashchie v kataloge /etc/rc2.d. Kazhdyj fajl vypolnyaetsya s
parametrom "start"
Otrabotav /etc/rc2, init tochno takim zhe obrazom zapuskaet
fajl /etc/rc3. Vsled za etim on zapuskaet neskol'ko processov
sysmonitor - po odnomu na kazhdyj imeyushchijsya terminal. |to te
samye processy, kotorye govoryat na terminal: "Login: "
Pol'zovatel', vojdya na terminal, nekotoroe vremya rabotaet, no
kak tol'ko on "uhodit" iz sistemy, na ukazannom terminale
nichego ne ostaetsya. init tut zhe vypolnyaet dejstvie "respawn" -
perezapuskaet na terminal sysmonitor - i opyat' zhizneradostnoe
"Login: " poyavlyaetsya na terminale.
Po umolchaniyu init ustanavlivaet uroven' vypolneniya 5.
Pri nachal'noj zagruzke otrabatyvaetsya fajl
/etc/rc.d/rc.S
Zatem dlya perehoda v mnogopol'zovatel'skij rezhim
/etc/rc.d/rc.M
iz kotorogo zapuskayutsya fajly
/etc/rc.d/rc.inet1 ustanavlivayushchij setevye interfejsy
/etc/rc.d/rc.inet2 zapuskayushchij setevye servisy
/etc/rc.d/rc.local zapuskayushchij neskol'ko poleznyh programm i
demonov - naprimer, podderzhka myshi, httpd,
rusifikaciya konsolya i t.p.
Ispol'zuetsya standartnaya tehnologiya rc-fajlov System V
RC-katalogi:
/etc/rc.d/rc[0123456].d/
/etc/rc.d/init.d/
Konfiguracionnye parametry dlya RC-komand:
/etc/sysconfig/
Ne smotrya na BSD-evoe proishozhdenie, ispol'zuetsya standartnaya
tehnologiya rc-fajlov System V
RC-katalogi:
/sbin/rc[0123].d/
/sbin/init.d/
Konfiguracionnye parametry dlya RC-komand:
/etc/rc.defaults.d/
Ispol'zuetsya standartnaya tehnologiya rc-fajlov System V
RC-katalogi:
/etc/rc[0123456].d/
/etc/init.d/
Last-modified: Sun, 14 Mar 2004 03:45:10 GMT