Next Previous Contents

2. Telos pantwn, ti einai mia katatmhsh;

Otan efeyre8hkan oi sklhroi diskoi, oi xrhstes suntoma h8elan na egkatasthsoyn diafora leitoyrgika systhmata, akoma ki an eixan mono ena disko sto susthma toys. Etsi, xreiazotan enas mhxanismos poy na xwrizei ton ena fysiko disko se pollaples logikes monades. Ayto einai h katatmhsh: ena synexes tmhma toy diskoy poy symperiferetai san enas teleiws jexwristos diskos sta perissotera leitoyrgika systhmata.

Einai emfanes oti oi katatmhseis den prepei na yperkaluptoyn h mia thn allh: Sigoyra ena leitoyrgiko de 8a htan eyxaristhmeno an ena allo leitoyrgiko susthma egrafe panw se shmantika toy dedomena epeidh oi katatmhseis sygkaluptontai. Epishs, de 8a prepei na yparxoyn kena metaju twn katatmhsewn. An kai ta endiamesa kena den einai epiblabh, xaramizoyn ton polutimo xwro toy diskoy.

O diskos de xreiazetai na katatmh8ei teleiws. Mporei na apofasisete na afhsete ligo xwro sto telos toy diskoy poy na mh xrhsimopoieitai apo kanena leitoyrgiko susthma. Argotera, otan jeka8arisei poio leitoyrgiko xrhsimopoieite perissotero, mporeite na xrhsimopoihsete ton keno xwro gia to susthma ayto.

Oi katatmhseis de mporoun na metakinh8oun h na allajoyn mege8os xwris na katastrafei to susthma arxeiwn toys. Ayto shmainei pws h ek neoy diairesh toy diskoy se katatmhseis apaitei thn lhch antigrafwn asfaleias kai meta thn anadiairesh thn epanafora twn dedomenwn apo ta antigrafa ayta. Sthn pragmatikothta, einai polu syxno to na katastrefontai ta panta kata thn anadiairesh, opote 8a prepei na kanete antigrafa olwn twn dedomenwn se oloys toys diskoys prin akoymphsete programmata san to fdisk.

Parola ayta, merikes katatmhseis me sygkekrimena systhmata arxeiwn mporoun na diaire8oun xwris na xa8oun dedomena (an eiste tyxeroi). Gia paradeigma, yparxei ena programma onomati "fips" poy diairei katatmhseis MS-DOS sta duo gia na kanei xwro gia mia egkatastash Linux xwris na xreiastei epanegkatastash toy MS-DOS. Omws pali de 8a to aggijete xwris na parete antigrafa, etsi den einai;

2.1 Ta antigrafa einai shmantika

Oi tainies einai oi filoi sas gia ta antigrafa. Einai grhgores, ajiopistes kai eukoles sth xrhsh, opote mporeite na kanete antigrafa asfaleias syxna kai kata protimhsh aytomata kai xwris mpelades.

Prosoxh: Milaw gia alh8ines tainies, oxi ekeines tis ftape ahdies poy elegxontai apo ton elegkth diskoy. Agoraste SCSI: to Linux exei eggenh yposthrijh SCSI. Den xreiazetai na fortwsete ASPI odhgous, de xanete polutimh HMA kai efoson o elegkths SCSI egkatasta8ei, apla pros8etete diskoys, kasetes kai CD-ROMs epanw toy. Oute alles I/O diey8unseis, paijimo me IRQ h syndyasmoi Master/Slave kai PIO.

Epishs: Oi kaloi SCSI elegktes sas dinoyn ychlh epidosh I/O xwris megalo fortio ston epejergasth. Akomh kai katw apo baria xrhsh toy diskoy 8a exete kalh apokrish. Ean sxediazete na xrhsimopoihsete ena susthma Linux san basiko USENET trofodoth h ean 8a asxolh8eite ws ISP mhn dianoh8eite na parete susthma xwris SCSI.

2.2 Ari8moi kai onomata syskeywn

O ari8mos twn katatmhsewn se basizomena se Intel systhmata htan periorismenos apo thn arxh: O arxikos pinakas katatmhsewn htan egkatesthmenos ws tmhma toy tomea ekkinhshs kai eixe xwro gia mono tesseris eggrafes. Aytes oi tesseris katatmhseis onomazontai prwtarxikes. Otan egine emfanes oti oi xrhstes xreiazontan perissoteres, oi logikes katatmhseis efeyre8hkan. O ari8mos toys den einai periorismenos: ka8e logikh katatmhsh periexei ena deikth sthn epomenh, opote einai dynaton na yparxei mia alysida apo apeires eggrafes.

Gia logoys symbatothtas, o xwros poy xrhsimopoieitai apo oles tis logikes katatmhseis prepei na katametrh8ei. Ean xrhsimopoieite logikes katatmhseis, mia eggrafh twn prwtarxikwn katatmhsewn shmeiwnetai ws "ektetamenh katatmhsh" enw ta arxiko kai teliko shmeio ths shmeiwnei ton xwro poy xrhsimopoieitai apo tis logikes katatmhseis. Ayto yponoei oti o xwros poy dinetai stis logikes katatmhseis prepei na einai synexomenos. Mporei na yparxei mono mia ektetamenh katatmhsh: kanena fdisk programma de 8a dhmioyrghsei parapanw apo mia ektetamenh katatmhsh.

To Linux de mporei na xeiristei panw apo ena sygkekrimeno ari8mo katatmhsewn ana disko. Etsi, sto Linux exete 4 prwtarxikes katatmhseis (3 apo aytes xrhsimes, ean xrhsimopoieite logikes katatmhseis) kai to polu 15 katatmhseis synolika se ena disko SCSI (63 synolika se ena disko IDE).

Sto Linux, oi katatmhseis apeikonizontai ws arxeia syskeywn. To arxeio syskeyhs einai ena arxeio tupoy c (gia syskeyh xarakthrwn=character, poy de xrhsimopoioun endiamesh mnhmh-buffer chache) h tupoy b (gia syskeyh temaxiwn=block, poy perna mesa apo thn endiamesh mnhmh). Sto Linux, oloi oi diskoi apeikonizontai ws block syskeyes. Se anti8esh me alla Unix systhmata, to Linux den prosferei akatergastes ekdoseis xarakthrwn (raw character) twn diskwn kai twn antistoixwn katatmhsewn toys.

To mono shmantiko se ena arxeio syskeyhs einai o meizwn kai o mikros ari8mos syskeyhs, poy deixnontai anti toy mege8oys toy arxeioy:


$ ls -l /dev/hda
brw-rw----   1 root     disk       3,   0 Jul 18  1994 /dev/hda
                                   ^    ^
                                   |    minor device number 
                                   major device number

Otan xrhsimopoieitai ena arxeio syskeyhs, o meizwn ari8mos epilegei poios odhgos syskeyhs 8a klh8ei gia na ektelestei h ergasia eisodoy/ejodoy. H klhsh ayth ginetai me ton mikro ari8mo ws parametro kai ejartatai apokleistika apo ton odhgo pws 8a metafrastei o mikros ari8mos. H tekmhriwsh toy odhgou synh8ws ejhgei pws o odhgos xrhsimopoiei toys mikrous ari8mous. Gia IDE diskoys h tekmhriwsh brisketai sto /usr/src/linux/Documentation/ide.txt. Gia SCSI diskoys, 8a perimenate na toys breite sto /usr/src/linux/Documentation/scsi.txt, alla den einai ekei. Prepei na koitajete ston kwdika toy odhgou gia na eiste sigoyroi (/usr/src/linux/driver/scsi/sd.c:184-196). Eytyxws yparxei kai h lista ari8mwn kai onomatwn odhgwn toy Peters Anvin sto /usr/src/linux/Documentation/devices.txt; koitajte tis anafores gia block syskeyes, meizwn 3, 22, 33, 34 gia IDE kai meizwn 8 gia SCSI diskoys. Oi meizwn kai mikroi ari8moi einai ena byte o ka8enas kai gia ayto o ari8mos katatmhsewn ana disko einai periorismenos.

Kata sumbash, ta arxeia syskeywn exoyn sygkekrimena onomata kai polla programmata exoyn gnwsh twn onomatwn aytwn kata th metaglwttish toys. Perimenoyn oi IDE diskoi na onomazontai /dev/hd* kai toys SCSI diskoys /dev/sd*. Oi diskoi ari8mountai ws a, b, c klp, opote to /dev/hda einai o prwtos IDE diskos kai o /dev/sda einai o prwtos sas SCSI diskos. Kai oi dyo syskeyes antiproswpeuoyn oloklhroys diskoys, jekinwntas apo to block ena. Grafontas stis syskeyes aytes me ta la8os ergaleia 8a katastrecei tis eggrafes ekkinhshs kai katatmhsewn, ka8istwntas ola ta dedomena ston disko mh prosbasima h kanontas to susthma sas adunato na jekinhsei. Na jerete ti kanete, kai jana, parte antigrafa prin kanete otidhpote.

Oi prwtarxikes katatmhseis toy diskoy einai oi 1, 2, 3 kai 4. Etsi /dev/hda1 einai h prwth prwtarxikh katatmhsh ston prwto IDE disko kok. Logikes katatmhseis exoyn noumera 5 kai anw, opote /dev/sdb5 einai h prwth logikh katatmhsh ston deutero SCSI disko.

Ka8e eggrafh ston pinaka katatmhsewn exei mia arxikh kai telikh dieu8ynsh kai enan tupo. O tupos einai enas ari8mhtikos kwdikos (ena byte) poy ka8orizei th sygkekrimenh katatmhsh se ena sygkekrimeno leitoyrgiko susthma. Oi kwdikoi katatmhsewn den einai monadikoi, opote yparxei h pi8anothta dyo leitoyrgika na xrhsimopoioun ton idio kwdiko.

To Linux xrhsimopoiei ton kwdiko 0x82 gia katatmhseis enallaghs kai 0x83 gia "eggenh" systhmata arxeiwn (ext2 dhladh). To kapote dhmofiles alla twra parwxhmeno Linux/Minix susthma xrhsimopoiouse ton kwdiko 0x81. To OS/2 xrhsimopoiei ton tupo 0x07 kai to idio kai to NTFS susthma twn Windows NT. To MS-DOS xrhsimopoiei arketous kwdikous gia tis diafores ekdoseis toy FAT systhmatos toy: 0x01, 0x04 kai 0x06 einai gnwsta. To DR-DOS xrhsimopoiouse to 0x81 gia tis prostateyomenes FAT katatmhseis toy, dhmioyrgwntas problhmata me to Linux/Minix ston kairo toy, alla shmera oute to Linux/Minix oute kai to DR-DOS xrhsimopoiountai pia. H ektetamenh katatmhsh poy xrhsimopoieitai apo tis logikes katatmhseis exei kwdiko 0x05.

Oi katatmhseis dhmioyrgountai kai katastrefontai me to fdisk. Ka8e leitoyrgiko poy sebetai ton eayto toy exei ena fdisk poy paradosiaka kaleitai fdisk (h FDISK.EXE) sta perissotera systhmata. Merika fdisk, kyriws toy DOS, einai kapws periorismena otan xeirizontai katatmhseis allwn leitoyrgikwn. Tetoioi periorismoi exoyn na kanoyn me thn adynamia xeirismou otidhpote me jenoy kwdiko, me ari8mo kylindroy megalutero toy 1024 kai thn adynamia na dhmioyrghsoyn h na katalaboyn katatmhseis poy den teleiwnoyn se orio kylindroy. Gia paradeigma, to fdisk toy MS-DOS de mporei na sbhsei katatmhseis NTFS, to fdisk toy OS/2 exei anafer8ei oti kryfa "dior8wnei" katatmhseis poy dhmioyrgh8hkan me to fdisk toy Linux poy den teleiwnoyn se orio kylindroy, enw kai ta duo, toy DOS kai toy OS/2, exoyn problhmata me diskoys me perissoteroys apo 1024 kylindroys (deite to "large-disk" mini-howto gia leptomereies gia tetoioys diskoys).


Next Previous Contents