11 11 TEX L^{A}TEX

NFS-Root Mini-Howto

Andreas Kostyrka, andreas@ag.or.at V8, 8 Aygoustoy 1997

Ayto to mini-HOWTO prospa8ei na ejhghsei pws na sthsoyme enan Linux workstation (ws) xwris diskoys-disketes (diskless), poy kanei mount ta root filesystems toy mesw toy NFS. Ka8e newterh ekdosh aytou toy mini-Howto

8a brisketai panta sto ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/mini/NFS-Root , h ston plhsiestero

se sas mirror toy SunSite.

Contents

1 Copyright 1

1.1 Poioi syneiseferan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2 Genikh 8ewrhsh 2

3 Ry8miseis ston server 2

3.1 Kanontas compile stoys pyrhnes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

3.2 Dhmioyrgia toy root filesystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3.2.1 Antigrafontas to filesystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3.2.2 Allages sto root filesystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3.2.3 Kanontas export to filesystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3.2.4 Ru8mish toy RARP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3.2.5 Ru8mish toy BOOTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

3.2.6 Briskontas tis hardware diey8unseis twn kartwn . . . . . . . . . . . . . . . . . . . . . 4

4 Bootarontas ton workstation 4

4.1 Xrhsimopoiwntas mia boot eprom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

4.2 Xrhsimopoiwntas mia disketa sketoy pyrhna . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

4.3 Xrhsimopoiwntas enan bootloader & to RARP . . . . . . . . . . . . . . . . . . . . . . . . . . 5

4.4 Xrhsimopoiwntas enan bootloader xwris to RARP . . . . . . . . . . . . . . . . . . . . . . . . 5

5 Gnwsta problhmata 6

5.1 To /sbin/init den jekinaei. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

5.2 Problhmata me to /dev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

6 Alla 8emata 6

1 Copyright

(c) 1996 Andreas Kostyrka (e9207884@student.tuwien.ac.at , h andreas@ag.or.at)

Ektos ki an ekfrastei diaforetika, ta keimena Linux HOWTO einai katoxyrwmena apo toys antistoixoys syggrafeis toys. Ta keimena ayta epitrepetai n’ anaparax8oun kai na dianemh8oun oloklhra h kata merh, me opoiodhpote mhxaniko h hlektroniko meson, oso ayth edw h shmeiwsh gia to copyright diathreitai epanw se ka8e antigrafo. H emporikh dianomh epitrepetai kai en8arrunetai. Wstoso, o syggrafeas epi8ymei na eidopoieitai gia opoiadhpote tetoia dianomh. Oles oi metafraseis, paragwges ergasies, h syllogikes ergasies poy perilambanoyn opoiodhpote keimeno Linux HOWTO, prepei na kaluptontai apo aythn edw th shmeiwsh peri copyright. Dhladh, den epitrepetai na paragete mia ergasia basismenh s’ ena HOWTO, kai na epiballete epipros8etoys periorismous sth dianomh ths. Ejaireseis stoys parapanw oroys mporoun na epitrapoun ypo orismenes proupo8eseis. Parakaloume na er8ete s’ epafh me ton syntonisth twn Linux HOWTO, sth dieu8ynsh poy yparxei parakatw. Se syntomia : Epi8ymoume na prow8hsoyme tis plhrofories poy periexontai sthn ergasia ayth, me oso to dynaton perissotera mesa. Wstoso, epishs epi8ymoume na krathsoyme to copyright twn keimenwn HOWTO, kai 8a 8elame na eidopoioumaste gia opoiadhpote sxedia dianomhs twn HOWTOs.

Ean exete apories, parakaloume na er8ete s’ epafh me ton Andreas Kostyrka <mailto:andreas@ag.or.at>, ton syggrafea aytou edw toy mini-HOWTO, h ton Tim Bynum, ton syntonisth twn Linux HOWTO’s, sth

dieu8ynsh <mailto:linux-howto@sunsite.unc.edu> mesw email.

1.1 Poioi syneiseferan

• Avery Pennarun <apenwarr@foxnet.net> (pws na bootaroyme xwris LILO)

• Ofer Maor <ofer@hadar.co.il> (edwse ena kalutero mini howto epanw sto pws na sthnoyme diskless workstations.)

• Christian Leutloff <leutloff@sundancer.tng.oche.de> (edwse plhrofories sxetikes me to netboot.)

2 Genikh 8ewrhsh

Genika, yparxoyn ta parakatw problhmata gia enan ws :

• Prepei na brei th dikh toy dieu8ynsh IP, kai - an xreiastei - tis ypoloipes ry8miseis toy Ethernet.

• Prepei na gnwrizei to NFS-server kai to mount path gia to root filesystem toy.

H twrinh ylopoihsh toy NFSROOT ston pyrhna toy Linux (ekdosh 1.3.7x) epitrepei tis akoloy8es luseis :

• H dieu8ynsh IP mporei na bre8ei apo to RARP, h h plhrhs ru8mish toy Ethernet mporei na perastei ston pyrhna mesw parametrwn (toy pyrhna), apo to LILO , h to LOADLIN.

• To mounting path toy NFS mporei na perastei me parametroys toy Ean den ginei etsi, o pyrhnas ypo8etei oti to RARP-server einai epishs NFS-server, kai xrhsimopoiei to default compiled mesa toy path. (H trexoysa default timh ston pyrhna einai h : /tftpboot/<IP-dieu8ynsh toy HY >.)

• Oi ry8miseis toy client aneyriskontai apo to BOOTP.

Prin arxisete na sthnete ena diskless periballon, prepei n’ apofasisete an 8a bootarete me to LILO , h to LOADLIN. To pleonekthma einai h eyelijia, to meionekthma einai h taxuthta. Einai taxutero na bootaroyme enan pyrhna toy Linux xwris to LILO , alla ayto mporei na mas apasxolhsei, mporei kai oxi.

3 Ry8miseis ston server

3.1 Kanontas compile stoys pyrhnes

Pi8anotata h yposthrijh toy RARP mesa ston pyrhna toy server na einai mia kalh idea. Prepei na thn symperilabete, an einai na bootarete xwris parametroys pyrhna. Apo thn allh pleyra, den prokeitai na sas boh8hsei, an o client den brisketai sto idio ypodiktyo (subnet) me ton server.

O pyrhnas gia ton ws xreiazetai to akoloy8o elaxisto sunolo dynatothtwn compiled mesa toy :

• To NFS-filesystem . (Den xreiazetai na exei compiled mesa toy thn yposthrijh gia ext2 , ena module einai arketo.)

• To "Root on NFS" prepei na einai energopoihmeno.

• Ton Ethernet driver ths kartas diktuoy toy ws.

• Analoga me tis anagkes sas, pi8anon na prepei na perilabete yposthrijh gia RARP , h BOOTBP gia to NFS-Root. (M’ ayto ennow tis erwthseis poy kanoyme meta thn erwthsh gia to NFS sto make config.)

An o ws 8a bootarei xwris parametroys toy pyrhna, prepei epishs na 8esete to root device ws 0:255. Kante to ayto dhmioyrgwntas ena ceutiko (dummy) arxeio device, dinontas : mknod /dev/nfsroot b 0 255. Afou ftiajete ayto to arxeio, mporeite na 8esete to root device toy image toy pyrhna, me : rdev <kernel-image >

/dev/nfsroot.

3.2 Dhmioyrgia toy root filesystem

3.2.1 Antigrafontas to filesystem

Proeidopoihsh : An kai aytes edw oi odhgies pi8anotata 8a doylecoyn sto diko sas susthma, den einai ka8oloy aytonohtes gia opoiodhpote periballon. Gia kaluteroys tropoys na sthsete ena root filesystem gia toys clients, diabaste to NFS-Root-Client mini howto toy Ofer Maor <ofer@hadar.co.il>.

Afou apofasisete pou 8a balete to root tree, dhmioyrghste to me (px) : mkdir -p <directory > kai : tar

cClf / - | tar xpCf <directory > -.

An bootarete ton pyrhna sas xwris LILO, tote to rootdir prepei na einai : /tftpboot/<IP-address >. An den sas aresei, mporeite na to allajete apo mesa apo to epanw-epanw Makefile sta sources toy pyrhna. Yajte gia mia grammh san ayth : NFS_ROOT = -DNFS_ROOT="\"/tftpboot/%s\"" An allajete ayth thn grammh, prepei na janakanete compile ton pyrhna.

3.2.2 Allages sto root filesystem

Twra afaireste ta axrhsta arxeia, kai elegjte ta scripts toy /etc/rc.d . Merika shmantika shmeia :

• Ena, h ru8mish toy eth0. O ws synh8ws exei ena ry8mismeno (toylaxiston merikws) eth0. To na ry8misete th dieu8ynsh IP toy ws epanw sth dieu8ynsh IP toy server, den einai kati ejypno. (Alla synebh ston syggrafea kata th diarkeia mias apo tis prwimes prospa8eies toy.)

• Ena allo shmeio prosoxhs, einai to /etc/fstab toy ws. Prepei na ry8mistei gia nfs filesystems.

• PROEIDOPOIHSH : Mhn sygxeete ta root filesystems toy server kai toy ws. (Eixa hdh rijei ena rc.inet1 panw ston server, kai aporousa giati o server den douleye.)

3.2.3 Kanontas export to filesystem

Kante export to root dir pros ton ws. Diabaste thn entolh : exports(5). Pi8anotata 8a prepei na epanekkinhsete to nfsd/mountd meta ap’ ayth thn allagh. Me to RedHat ayto ginetai eukola, dinontas

: /etc/rc.d/init.d/nfs stop ; /etc/rc.d/init.d/nfs start .

3.2.4 Ru8mish toy RARP

Ry8miste to RARP kapoy epanw sto diktyo. An bootarete xwris parametro nfsroot, o server toy RARP prepei na einai kai o server toy NFS . (Synh8ws einai.) Gia na to epituxete ayto, prepei na trejete enan pyrhna me yposthrijh RARP .

Gia na to kanete, dwste (kai egkatasthste to kapoy mesa sto /etc/rc.d toy server!) :

/sbin/rarp -s <ip-addr > <hardware-addr >

opoy :

ip-addr einai h dieu8ynsh IP toy ws, kai

hardware-addr einai h dieu8ynsh Ethernet ths kartas diktuoy toy ws.

paradeigma : /sbin/rarp -s 131.131.90.200 00:00:c0:47:10:12

Mporeite epishs na xrhsimopoihsete ena symboliko onoma anti ths dieu8ynshs IP, oso o server einai ikanos na briskei th dieu8ynsh ayth. (Me cajimo sto /etc/hosts , h sto DNS .)

3.2.5 Ru8mish toy BOOTP

Gia th ru8mish toy BOOTP prepei na dior8wsete to /etc/bootptab. Parakalw, symboyleyteite tis man selides bootpd(8) kai bootptab(5) .

3.2.6 Briskontas tis hardware diey8unseis twn kartwn

Den jerw poia einai h hardware dieu8ynsh! Pws thn briskw;

• Bootarete th disketa poy ftiajate, kai perimenete th grammh diagnwstikwn, opoy anagnwrizetai h karta diktuoy. Synh8ws periexei 6 dekaejadika bytes, kai ayth (prepei na) einai h hardware dieu8ynsh ths kartas.

• Bootarete ton ws me kapoio allo leitoyrgiko, poy perilambanei dynatothta TCP/IP . Tote kante ping ston ws apo ton server. Yajte sthn cache toy ARP, dinontas : /sbin/arp -a

4 Bootarontas ton workstation

4.1 Xrhsimopoiwntas mia boot eprom

Mia poy proswpika den exw akomh xrhsimopoihsei ena tetoio 8hrio, mporw na sas dwsw monaxa tis akoloy8es ypodeijeis (xarh ston Christian Leutloff <leutloff@sundancer.tng.oche.de>) :

• Den mporeite na xrhsimopoihsete "synh8ismenes" bootroms.

• Yparxei ena programma netboot , apo ton Gero Kuhlmann, poy ftiaxnei bootroms gia Linux, kai dinei perissoteres plhrofories. To netboot einai dia8esimo apo ton plhsiestero mirror toy Linux, h san programma mesa sth distribution toy Debian (netboot-0.4).

• Diabaste prosektika thn tekmhriwsh ths boot eprom sas.

• Pi8anotata prepei na energopoihsete to tftpd ston server, alla ayto ejartatai apo ton tropo, me ton opoio h boot eprom sas fortwnei ton pyrhna.

• Ka8e plhroforia gia pwlhtes boot eproms gia to Linux, opws tis perigracame parapanw, einai eyprosdekth - ka8ws den exei o ka8enas prosbash se eprom programmer :( (eidika sthn Eyrwph, opoy zw). Tis plhrofories 8a tis perilabw edw meta.

4.2 Xrhsimopoiwntas mia disketa sketoy pyrhna

An exete kanei export to root filesystem me to swsto onoma gia thn default onomasia, kai o NFS server sas einai taytoxrona kai RARP server (poy shmainei oti oi HY briskontai sto idio ypodiktyo), tote mporeite apla na bootarete ton pyrhna me cating se mia disketa. (Prepei na 8esete to root device toy pyrhna ws 0:255.) Ayto proupo8etei oti to root directory ston server einai /tftpboot/IP-Address (ayth h timh mporei n’ allajei, otan kanoyme compile ton pyrhna).

4.3 Xrhsimopoiwntas enan bootloader & to RARP

Dwste ston pyrhna oles tis aparaithtes parametroys kata thn ekkinhsh, kai pros8este : nfsroot=<server-ip-addr >:</path/to/mount > , opoy : server-ip-addr einai h dieu8ynsh IP toy NFS-server sas, kai /path/to/mount einai to path pros to root directory.

Ypodeijeis :

• Otan xrhsimopoieite to LILO , skef8eite na xrhsimopoihsete thn idiothta "lock" : Apla plhktrologhste mia fora oles tis swstes parametroys, kai pros8este "lock" . Thn epomenh fora poy 8a bootarete, afhste to LILO na ftasei se timeout.

• Otan ftiaxnete mia disketa gia enan sygkekrimeno ws, mporeite epishs na xrhsimopoihsete thn idiothta

     append= sto lilo.conf .

4.4 Xrhsimopoiwntas enan bootloader xwris to RARP

Mazi me to nfsroot , dwste ena orisma pyrhna sth grammh entolwn :

nfsaddrs=<wst-IP >:<srv-IP >:<gw-IP >:<netm-IP >:<hostname > . O pyrhnas 8a ry8misei to

eth0 me tis dedomenes parametroys :

wst-IP Dieu8ynsh IP toy HY

srv-IP Dieu8ynsh IP toy NFS-server

gw-IP gateway

netm-IP netmask

hostname onoma ypologisth

5 Gnwsta problhmata

5.1 To /sbin/init den jekinaei.

Ena polu synh8ismeno problhma me to /sbin/init einai oti (toylaxiston) merikes apo tis prosfates distributions exoyn to /sbin/init linked dynamika. Synepws, prepei na dwsete swsth ru8mish /lib gia ton client. Kati eukolo poy mporoume na dokimasoyme, einai n’ antikatasthsoyme to /sbin/init (toy client) me ena statika linked programma "Hello World". M’ ayton ton tropo 8a jerete an prokeitai gia kati pio 8emeliwdes apo apla ena problhma me to dynamiko linking.

5.2 Problhmata me to /dev .

An kata thn ekkinhsh pairnete kapoia mperdemena mhnumata gia ta ttys, tote 8a eprepe na trejete ena MAKEDEV apo ton client sto /dev directory. Yparxoyn fhmes oti ayto den doyleuei me kapoia LS poy xrhsimopoioun 64-bit ari8mous dev. An sas tuxei kati tetoio, parakalw steilte moy e-mail gia poio LS prokeitai. Mia pi8anh lush einai na ftiajete nwris sth diadikasia ekkinhshs ena mikro /dev ramdisc, kai na epanegka8istate ta device nodes ka8e fora.

6 Alla 8emata

   • Yparxei ena BOOTP programma : ftp://sunsite.unc.edu/system/Network/admin/bootpc.v045.tgz

Me ton initrd (poy periexetai sto Linux 2.0), 8a mporousame na to kanoyme na doylecei arketa omorfa. Sthn pragmatikothta, o initrd einai panta mia proxwrhmenh lush gia pio leptomereis ry8miseis.

• Gia ekkinhseis basismenes monaxa sto bootpd, ayto pi8anotata den xreiazetai, mia poy to Linux 2.0 periexei epishs kai thn dynatothta na xrhsimopoioume to BOOTP anti toy RARP. (Akribestera, mporoume na kanoyme compile kai ta duo ston pyrhna, kai kerdizei opoio apokrinetai taxutera.)

• Sto directory ths tekmhriwshs toy source toy kernel, yparxei ena arxeio poy periexei tekmhriwsh gia to NFS-Root.

• Yparxei ki ena patch poy trigyrnaei, poy mas epitrepei na kanoyme swapping epanw sto NFS. Moy to steilane (kata th diarkeia mias periodoy, opoy eixa pollh doyleia), alla katafera na xasw to e-mail. :( Pi8anotata 8a to breite sto http://www.linuxhq.com/ , sto tmhma me ta "anepishma" patches.

• To public PGP kleidi moy mporeite na to breite kanontas finger sh dieu8ynsh andreas@ag.or.at . To apotupwma einai : F1 F7 43 D5 07 C4 6C 87 BF 6B 33 A2 2C EE 5A F9.