Automount mini-Howto don@sabotage.org v0.4, 17 Aprilioy 1999 To keimeno ayto perigrafei thn kata autofs aytomath prosarthsh, pws na th ry8misete, kai epishmainei thn apofygh kapoiwn problhmatwn. Gia opoiadhpote sxolia h parathrhseis sxetika me thn metafrash, epikoin- wnhste me ton Giannh Skandalh sthn dieu8ynsh gska@otenet.gr ______________________________________________________________________ Table of Contents 1. Eisagwgh 1.1 H aytomath prosarthsh (automount) - ti einai kai giati 1.2 Ta eidh ths aytomaths prosarthshs 2. Egkatastash 3. Ry8miseis 4. H megalh anamonh gia thn apoprosarthsh (unmount) 5. Erwthseis 5.1 Den blepw to /auto/floppy, h opoiodhpote allo shmeio prosarthshs caxnw. 5.2 Pws blepw ti einai prosarthmeno; 5.3 Bazw mia disketa win95 ("vfat") kai anagnwristhke mono ws aplh FAT disketa. 5.4 To susthma arxeiwn 5.5 Ti symbainei an kanw to / ton katalogo gia thn aytomath prosarthsh; 5.6 Mporw na exw duo arxeia antistoixhshs (map files) ston idio katalogo; 5.7 Xrhsimopoiw SuSE 6.0 kai xreiazomai 5.8 Pws orizw ta dikaiwmata kai thn katoxh (ownership) gia to susthma arxeiwn (p.x. FAT) 5.9 Poion na eyxaristhsw gia to autofs? 5.10 Poy mporw na ma8w perissotera gia thn aytomath prosarthsh; ______________________________________________________________________ 1. Eisagwgh 1.1. H aytomath prosarthsh (automount) - ti einai kai giati Aytomath prosarthsh einai h diadikasia opoy h prosarthsh (kai apoprosarthsh) sygkekrimenwn systhmatwn arxeiwn ginetai aytomata apo enan daimona. An to susthma arxeiwn den einai prosarthmeno, kai enas xrhsths prospa8hsei na to prospelasei, 8a prosarth8ei aytomata. Ayto einai idiaitera xrhsimo se megala diktywmena periballonta kai gia amoibaia prosarthmena systhmata arxeiwn metaju enos ari8mou mhxanwn (eidikotera gia aytes poy den einai synexws syndedemenes). Mporei na einai epishs polu xrhsimo gia afairoumenes syskeyes, h gia merikes alles xrhseis, opws h eukolh metagwgh metaju enos prosarthmenoy forced-on ascii conversion systhmatos arxeiwn dos kai enos prosarthmenoy forced-off ascii conversion dos systhmatos arxeiwn. 1.2. Ta eidh ths aytomaths prosarthshs Yparxoyn duo eidh aytomaths prosarthshs sto linux; Ta AMD kai autofs. O AMD einai o daimonas aytomaths prosarthshs, kai ypo8etika doyleuei opws o SunOS AMD. Ylopoieitai ston xwro toy xrhsth, ennowntas oti den einai meros toy pyrhna. Den einai aparaithto gia ton pyrhna na antilambanetai aytomath prosarthsh ean kanete NFS prosarthsh sto topiko susthma, mesw toy AMD daimona, o opoios dromologei olh thn kinhsh toy aytomata prosartoumenoy systhmatos arxeiwn mesa apo to NFS susthma. To Autofs einai ena neotero susthma boh8oumeno apo ton pyrhna, ennowntas oti o kwdikas toy systhmatos arxeiwn toy pyrhna gnwrizei poy briskontai ta aytomata prosartoumena shmeia prosarthshs, se ena kata ta alla fysiologiko susthma arxeiwn, kai to programma automount ta pairnei apo ekei. Mono to autofs 8a perigraftei se ayto to mini-howto. 2. Egkatastash Epeidh to autofs ylopoieitai ston xwro toy pyrhna, o pyrhnas sas 8a prepei na exei metaglwttistei me enswmatwmenh yposthrijh. Stoys 2.0.xx yparxei ws peiramatikh epilogh, alla fainetai na einai arketa sta8ero. Stoys 2.2.xx einai kanonikh epilogh. To programma automount kai ta arxeia ry8misewn toy einai epishs aparaithta. Xrhsimopoiwntas ta rpms (apo thn RedHat, ws meros ths egkatastashs) einai enas kalos tropos gia arxh. To programma automount ofeilei na jekinhsei apo ena rc script katw apo to /etc/rc.d/init.d directory. To rpm to egka8ista, alla prepei na sigoyreyteite oti jekinaei, eite syndeontas to apo to diko sas rc?.d katalogo, xrhsimopoiwntas ton pinaka elegxoy ths Redhat, eite se periptwsh diaforetikhs dianomhs me ton diko ths tropo. Se dianomes poy den xrhsimopoioun rpm 8a prepei na ginei oti einai aparaithto sto diko toys susthma. Kai mhn koitajete me leptomereies to ti kanei to rc script. Ean diabazete ayto to keimeno pi8anon den 8elete na ma8ete. 3. Ry8miseis Me thn egkatastash twn RPM's 8a ftasete se ayto to shmeio sxetika eukola, alla edw einai isws to shmeio opoy den eiste sigoyros, ean den to exete janakanei sto parel8on. Yparxoyn duo arxeia sto /etc, to ena legetai auto.master kai to allo auto.misc. To diko moy auto.master moiazei me ayto: /auto /etc/auto.misc --timeout 60 H prwth kataxwrhsh den einai to shmeio prosarthshs. Einai to poy akribws briskontai ta shmeia prosarthshs (h deuterh kataxwrhsh). H trith epilogh leei oti ta prosarthmena systhmata arxeiwn mporoun na dokimasoyn na apoprosarth8oun 60 deyterolepta meta thn xrhsh. Fysika den mporoun na apoprosarth8oun ean xrhsimopoiountai. To Auto.misc einai ena "arxeio antistoixhshs" (map file). To arxeio antistoixhshs mporei na exei opoiodhpote onoma. Ayto edw onomazetai auto.misc epeidh arxika elegxe to /misc. Pollapla arxeia antistoixhshs mporoun na oristoun sto auto.master. To diko moy auto.misc moiazei me ayto: kernel -ro,soft,intr ftp.kernel.org:/pub/linux cd -fstype=iso9660,ro :/dev/cdrom zip -fstype=auto :/dev/hdd4 floppy -fstype=vfat :/dev/fd0 H prwth sthlh (to "kleidi") einai to shmeio prosarthshs. Se ayth thn periptwsh 8a mporouse na einai /auto/floppy h kati paromoio. H epomenh sthlh einai oi parametroi. Diabaste tis man selides sxetika me thn mount gia perissoteres leptomereies. Kai h teleytaia sthlh ka8orizei apo poy erxetai to sygkekrimeno susthma arxeiwn. H eggrafh "kernel" ypoti8etai oti einai mia NFS prosarthsh. To : se oles tis alles grammes ennoei oti einai topikh syskeyh. 4. H megalh anamonh gia thn apoprosarthsh (unmount) Merikoi apo esas blepontas ta deyterolepta anamonhs, 8a skefthkan oti einai arketos xronos perimenontas na bgei mia disketa. Isws na sygxroniza toys diskoys (sync) kai na thn ebgaza prosarthmenh, xwris kaneis na katalabei tipota. Epitrecte moy na proteinw asfalesteroys tropoys. Prwta apo ola, mporeite na allajete to xroniko diasthma. Alla ayto mporei na einai ligo aneparkes, legontas sto susthma na apoprosarthsei kati meta apo molis 15 deyterolepta h kati allo. Ejartwmeno apo thn dikh sas egkatastash, mporei na eiste se 8esh na ektelesete thn entolh umount ws aplos xrhsths. Alla sthn pragmatikothta yparxei tropos na zhthsete apo to automount programma na apoprosarthsei. An steilete (me to programma kill) to shma (signal) SIGUSR1 pros th diergasia automount, 8a apoprosarthsei otidhpote mporei. Alla protou arxisete na ftiaxnete plhktra apoprosarthshs stoys diaxeiristes para8urwn sas, yparxei ena mikro problhma. H diergasia toy automount trexei apo ton xrhsth root, kai signals 8a dex8ei mono apo ton idio xrhsth. Oi misoi apo toys logoys gia toys opoioys pi8anon kanete aytomath prosarthsh einai wste na mporeite na prosarteite kati apoprosarthmeno xwris na eiste root. 8a htan eukolo na gracete ena suid-root programma se C to opoio na kanei th bromikh doyleia. Wstoso, xrhsimopoiwntas th sudo einai pi8ano na epitrecete stoys xrhstes na steiloyn to katallhlo kill signal. To monadiko problhma einai oti h sudo den 8a sas epitrecei na xrhsimopoihsete ` gia na epejergasteite ypoentoles, poy 8a 8elate na kanete gia na breite to trexon PID. 8a prepei na exete ena programma poy legetai killall, poy 8a sas epitrecei na kanete ayto: (eyxaristw gia tis protaseis) ALL ALL=NOPASSWD:/usr/bin/killall -USR1 automount Diaforetika, 8a prepei na epitrecete stoys xrhstes sas na stelnoyn -SIGUSR1 se oles tis diergasies. Ayto exei poikiles epidraseis sta programmata. Mporei na anakyklwsei arketous diaxeiristes para8urwn, alla 8a skotwsei (kill) ton xemacs. Etsi loipon elpizete na mhn yparx- oyn jexeilismata sthn endiamesh mnhmh (buffer overrun) ths killall... 5. Erwthseis 5.1. Den blepw to /auto/floppy, h opoiodhpote allo shmeio prosarthshs caxnw. Ean to automount exei egkatasta8ei swsta, opoiodhpote shmeio prosarthshs caxnete 8a einai ekei an prospa8hsete na to xrhsimopoihsete, estw kai an den to blepete an den xrhsimopoieitai. Ean diabazete ton katalogo arxeiwn me ena grafiko ergaleio, isws xreiastei na plhktrologhsete eseis to onoma; ta perissotera programmata 8a prospa8hsoyn se oti toys dwsete, kai o diskos 8a prosarth8ei protou to antilhf8ei. Dystyxws h adynamia na epilejete apo ta dia8esima alla aorata shmeia prosarthshs einai pi8anon to megalutero meionekthma toy autofs. Ean pragmati sas enoxlei, dior8wste ta arxeia ry8misewn. (einai ayta poy teleiwnoyn se .c ennowntas "configuration") Mia «lush» poy exoyn dokimasei arketoi alloi einai na dhmioyrghsete symbolikous desmous (symbolic links) se ayto poy to automount 8a dhmioyrghsei otan prosarth8ei. Ayto 8a apotrecei to programma na parapone8ei oti enas katalogos arxeiwn den yparxei (ean to mount leitoyrgei), alla adiafores prospelaseis katalogwn 8a prokalesoyn thn prosarthsh toy systhmatos arxeiwn. 5.2. Pws blepw ti einai prosarthmeno; Me thn entolh df. H mount xwris parametroys 8a kanei to idio, kai epipleon 8a emfanisei tis parametroys me tis opoies einai prosarthmeno kati. 5.3. Bazw mia disketa win95 ("vfat") kai anagnwristhke mono ws aplh FAT disketa. Ayto den einai problhma me to automount. Mexri th stigmh poy grafetai to keimeno ayto, to "auto" fs den prospa8ei mia prosarthsh vfat protou prosarthsei epityxws ena msdos susthma arxeiwn. To VFAT einai ta megala onomata arxeiwn twn Win95 kai WinNT grammena se ena FAT/MSDOS susthma arxeiwn. Sumfwna me enan apo toys syggrafeis ths mount, afou h mount einai mono ena periblhma gurw apo mia klhsh systhmatos poy prepei na orisei ton tupo toy systhmatos arxeiwn, einai akomh ey8unh toy xrhsth na dwsei ton swsto tupo. Bazontas thn mount na dokimasei me thn seira apo mia lista me systhmata arxeiwn, anti toy trexontos tropoy, einai ypo skech. Merikoi xrhstes den exoyn metaglwttisei yposthrijh gia msdos ston pyrhna. Ayto to empodizei na dokimastei prin to vfat. Ayto 8a doylecei gia toys perissoteroys xrhstes. Ligoi pantws 8a xreiastoun to susthma arxeiwn msdos kai moy prokalei arketh apogohteysh na mhn yparxei proxeiro to module otan pragmatika to xreiastw. Eimai sigoyros oti opoios 8elei na mpei sthn prospa8eia na brei toys syggrafeis ths mount, ta sxolia sas 8a einai eyprosdekta. An den loipon metaglwttisete yposthrijh msdos ston pyrhna, gia twra ayto shmainei oti den mporeite na prosarthsete vfat ektos kai an egkataleicete thn dynatothta ths aytomaths anagnwrishs olwn twn allwn systhmatwn arxeiwn. Eytyxws kapoia mera 8a einai ry8misimo. En tw metaju, noiwste eleu8eroi na dhmioyrgeite pollapla shmeia prosarthshs me diaforetikous tupoys systhmatwn arxeiwn. 5.4. To susthma arxeiwn /auto/grumblesmurf einai prosarthmeno kai h kill -SIGUSR1 den to apoprosartei. Xrhsimopoieitai apo kati. Pi8anon oute o root den mporei na to apoprosarthsei. An eseis eiste aytos poy to prokalese na prosarth8ei (dhl. Den mporei kapoios allos na to xrhsimopoiei) cajte gia kapoio kelyfos (shell) poy isws einai se ayton ton katalogo. An den yparxei, cajte gia kati allo (idiaiterws gia kati poy 8a mporouse na exei perasei apo ayto ton katalogo opws enas fyllometrhths) poy isws afhse ena krymmeno stigma. An egkataleicate to cajimo, dokimaste to programma fuser. 5.5. Ti symbainei an kanw to / ton katalogo gia thn aytomath prosarthsh; Loipon, ektos apo ena statistiko deigma enos mono atomoy, kanena apo ta apotelesmata den htan 8etiko. Sas proeidopoihsa. An 8elete to /grumblesmurf, tote proteinw ena symboliko desmo. Einai asfalestero. 5.6. Mporw na exw duo arxeia antistoixhshs (map files) ston idio kat- alogo; Oxi apo oso jerw. Dokimaste na xrhsimopoihsete ena map file, me sygkekrimenes epiloges gia jexwristes kataxwrhseis. 5.7. Xrhsimopoiw SuSE 6.0 kai xreiazomai ---timeout anti toy --time- out Xm. Entajei, To krataw ws shmeiwsh. Mia allh lush sta problhmata "to timeout den doyleuei" 8a htan h pros8hkh ths epiloghs -t time sto autofs script. 5.8. Pws orizw ta dikaiwmata kai thn katoxh (ownership) gia to susthma arxeiwn (p.x. FAT) Elegjte th selida man ths mount gia merikes apo tis epiloges, opws ry8mizontas tis uid=value h umask=value epiloges. Mia epilogh h opoia fainetai na leipei gia ta systhmata arxeiwn FAT einai h mode=value. Sygnwmh. Elegjte to me an8rwpoys poy kanoyn prosarthseis. 5.9. Poion na eyxaristhsw gia to autofs? Oxi emena. Den eixa kamia sxesh me ayto. Egw mono h8ela na trabhjw ka8enos thn prosoxh sthn polu kalh doyleia poy exei ginei me to autofs, kai poso eukolo einai na xrhsimopoih8ei. Sygkrinomeno me toys ay8entikous drastes toy AMD (poylane ena ypertimhmeno Unix me proistorikes ekdoseis dwrean ergaleiwn), to autofs einai polu kala tekmhriwmeno kai aytoi poy to ylopoioun exoyn ta eilikrinh moy eyxaristw. Ta panta einai syggrafika dikaiwmata ths Transmeta, gi ayto sygnwmh poy den mporw na dwsw katastash onomatwn, alla 8a stoixhmatiza oti o Peter Anvin einai ypeu8ynos gia arketo kommati toy. O Peter epishs eixe mia paroysiash toy autofs sto linuxworldexpo stis 3 Martioy 1999. 5.10. Poy mporw na ma8w perissotera gia thn aytomath prosarthsh; Yparxei ena ekpaideytiko keimeno gia to autofs sth dieu8ynsh . Deite akomh ta am- utils sth dieu8ynsh (Eyxaristw gia ayta ta URL)