Next Previous Contents

10. Leptomereies

10.1 IDE - oi epta gewmetries

O IDE odhgos exei pente phges plhroforiwn gia th gewmetria. H prwth (G_user) einai ayth poy dhlwnetai apo ton xrhsth sth grammh entolwn. H deuterh (G_bios) einai o pinakas parametrwn diskwn toy BIOS (Fixed Disk Parameter Table) (gia ton prwto kai deutero disko mono) poy diabazetai kata thn ekkinhsh toy systhmatos, prin thn allagh se leitoyrgia 32-bit. H trith (G_phys) kai tetarth (G_log) epistrefontai apo ton elegkth IDE ws apanthsh sthn entolh IDENTIFY - einai h `fysikh' kai `trexoysa logikh' gewmetria antistoixa.

Apo thn allh, o odhgos xreiazetai duo times gia th gewmetria: apo th mia thn G_fdisk, poy epistrefetai apo to HDIO_GETGEO ioctl, kai apo thn allh thn G_used, poy xrhsimopoieitai gia to pragmatiko I/O. Kai oi duo xrhsimopoioun to G_user ean exei do8ei, to G_bios otan aytes oi plhrofories einai dia8esimes sumfwna me to CMOS, h to G_phys an kanena apo ta prohgoumena den einai dia8esimo. Ean to G_log fainetai logiko tote to G_used ry8mizetai se ayto. Diaforetika, an to G_used den einai swsto kai to G_phys fainetai logiko xrhsimopoieitai to G_phys gia na ry8mistei to G_used. `Logiko' shmainei oti o ari8mos twn kefalwn einai 1-16.

Me alla logia: h grammh entolwn yperbainei to BIOS, kai 8a ka8orisei ti 8a dei to fdisk, alla an ka8orizei thn metafrazomenh gewmetria (me parapanw apo 16 kefales), gia to I/O toy pyrhna 8a xrhsimopoih8oun oi times ths entolhs IDENTIFY.

Shmeiwste oti to G_bios einai arketa anajiopisto: gia systhmata poy jekinane me SCSI o prwtos kai deuteros diskos mporoun na einai SCSI kai h gewmetria poy anaferei to BIOS gia sda mporei na xrhsimopoih8ei apo ton pyrhna gia ta hda. Epishs, oi diskoi poy den anaferontai sto setup toy BIOS den blepontai apo to BIOS. Ayto shmainei oti, p.x., se ena susthma me IDE diskoys mono, an to hdb de do8ei sto BIOS setup, h gewmetria poy anaferetai apo to BIOS gia ton prwto kai deutero disko 8a xrhsimopoih8ei gia ta hda kai hdc.

10.2 SCSI leptomereies

Sthn periptwsh toy SCSI ta pragmata einai ligo diaforetika, afou oi SCSI entoles hdh xrhsimopoioun logikous ari8mous, wste h `gewmetria' einai teleiws asxeth apo to I/O. Parola ayta, o pinakas katatmhsewn einai idios, kai etsi to fdisk prepei na brei th gewmetria, enw xrhsimopoiei kai to HDIO_GETGEO. Akomh, to fdisk den diaxwrizei metaju twn IDE kai SCSI diskwn. Opws 8a deite apo thn parakatw perigrafh, oi diaforoi odhgoi xrhsimopoioun o ka8enas kapws diaforetikh gewmetria. Arketa mperdemenh katastash.

An den xrhsimopoieite to DOS, tote apofugete oles tis ru8mishs twn metafrasewn, xrhsimopoieiste 64 kefales, 32 tomeis/ixnos (gia ena boliko 1 MiB ana kulindro), an einai dynaton, wste na mhn exete problhmata otan metaferete ton disko apo ton enan elegkth ston allo. Merikoi SCSI odhgoi (aha152x, pas16, ppa, qlogicfas, qlogicisp) gia na diathrhsoyn symbatothta me to DOS de 8a sas epitrecoyn na xrhsimopoihsete panw apo 8 GiB akoma kai se susthma me mono Linux. Ayto einai bug.

Poia einai h pragmatikh gewmetria; H eykoloterh apanthsh einai oti den yparxei. Akoma ki an yphrxe, de 8elete na thn jerete kai sigoyra POTE de 8a peite sto fdisk h to LILO h ton pyrhna poia einai. Einai ka8ara metaju toy SCSI elegkth kai toy diskoy. Na to epanalabw: mono kapoios anohtos leei sta fdisk/LILO/kernel thn pragmatikh gewmetria enos SCSI diskoy.

Alla an eiste periergoi kai epimenete mporeite na rwthsete ton disko. Yparxei h shmantikh entolh READ CAPACITY poy 8a dwsei to mege8os toy diskoy kai yparxei kai h MODE SENSE entolh poy sth selida Rigid Disk Drive Geometry (04) dinei ton ari8mo twn kefalwn kai twn kylindrwn (ayta de mporoun na allajoyn) kai sth selida Format (03) dinei ton ari8mo twn bytes ana tomea kai tomewn ana ixnos. To teleytaio noumero den einai sta8ero, afou o ari8mos tomewn/ixnos ejartatai apo thn perioxh toy diskoy: sto ejwteriko toy diskoy yparxoyn perissoteroi tomeis/ixnos. To programma scsiinfo sto Linux 8a sas dwsei aytes tis plhrofories. Yparxoyn polles leptomereies kai epiplokes kai einai jeka8aro oti kaneis (oute kai to idio to leitoyrgiko) de 8elei na jerei. Akomh, efoson mas endiaferei to fdisk kai to LILO, h synh8eis apanthseis einai toy tupoy C/H/S=4476/27/171 - times poy de mporoun na xrhsimopoih8oun apo to fdisk afou o pinakas katatmhsewn xrhsimopoiei 10/8/6 bits gia ta C/H/S.

Kai tote apo poy to HDIO_GETGEO briskei tis plhrofories; Apo ton elegkth SCSI h kanontas mia ektimhsh. Merikoi odhgoi nomizoyn oti 8eloyme thn pragmatikh gewmetria alla, fysika, 8eloyme mono o,ti to DOS h to fdisk toy OS/2 (h to AFDISK ths Adaptec, klp) xrhsimopoioun.

Shmeiwste oti to fdisk toy linux xreiazetai ton ari8mo kefalwn kai tomewn/ixnos H kai S gia na metatrecei LBA noumera se c/h/s alla o ari8mos twn kylindrwn C den xreiazetai. Merikoi odhgoi xrhsimopoioun (C,H,S) = (1023,255,63) gia na deijoyn oti h xwrhtikothta toy diskoy einai toylaxiston 1023*255*63 sectors. Ayto einai atyxes, afou den mas dinei to pragmatiko mege8os kai 8a periorisei ta perissotera fdisk se peripoy 8 GiB - enas arketa sobaros periorismos.

Sthn perigrafh parakatw, to M dhlwnei thn synolikh xwrhtikothta toy diskoy kai C, H, S o ari8mos twn kylindrwn, kefalwn kai tomeis/ixnos. Arkoun ta H, S an xrhsimopoihsoyme to C ws M / (H*S).

Kata sumbash, H=64, S=32.

aha1740, dtc, g_NCR5380, t128, wd7000:

H=64, S=32.

aha152x, pas16, ppa, qlogicfas, qlogicisp:

H=64, S=32 ektos ean C > 1024, opote H=255, S=63, C = min(1023, M/(H*S)). (To C symptussetai kai to H*S*C den einai proseggish toy M. Ayto 8a mperdecei tis perissoteres ekdoseis toy fdisk.) To ppa.c xrhsimopoiei M+1 anti toy M kai leei oti ayto einai logw enos bug sto sd.c, opoy to M einai ektos kata 1.

advansys:

H=64, S=32 ektos an C > 1024 kai akomh h epilogh `> 1 GB' toy BIOS einai energopoihmenh, opote H=255, S=63.

aha1542:

Rwthste ton elegkth poia apo tis dyo metafraseis xrhsimopoiei kai xrhsimopoihste eite H=255, S=63 h H=64, S=32. Sthn prwth periptwsh 8a deite kata thn ekkinhsh "aha1542.c: Using extended bios translation".

aic7xxx:

H=64, S=32 ektos an C > 1024, kai eite h epilogh "extended" kata thn ekkinhsh dinetai h to `extended' bit xrhsimopoieitai sta SEEPROM h BIOS, opote H=255, S=63. Sto Linux 2.0.36 ayth h metafrash panta xrhsimopoieitai an de bre8ei SEEPROM, alla sto Linux 2.2.6 an de bre8ei SEEPROM h metafrash xrhsimopoieitai an o xrhsths to epi8ymei, xrhsimopoiwntas thn parametro ekkinhshs (an bre8ei SEEPROM, h parametros agnoeitai). Ayto shmainei oti to setup poy doyleuei sto 2.0.36 mporei na mhn ekkinhsei sto 2.2.6 (kai na apaitei thn epilogh `linear' sto LILO, h thn parametro `aic7xxx=extended' ston pyrhna).

buslogic:

H=64, S=32 ektos ean C >= 1024, kai h extended metafrash energopoih8hke ston elegkth, opote an M < 2^22 tote H=128, S=32; alliws H=255, S=63. Omws, afou ginei ayth h epilogh gia (C,H,S), o pinakas katatmhsewn diabazetai kai an gia tis treis pi8anothtes (H,S) = (64,32), (128,32), (255,63) h timh telikoH=H-1 bre8ei, ekeino to zeygari (H,S) xrhsimopoieitai, kai to mhnyma "Adopting Geometry from Partition Table" typwnetai kata thn ekkinhsh.

fdomain:

Breite th gewmetria stis parametroys diskwn toy BIOS, h diabaste ton pinaka katatmhsewn kai xrhsimopoihste H=teleytaioH+1, S=teleytaioS gia thn prwth katatmhsh, efoson einai adeia, h xrhsimopoihste H=64, S=32 gia M < 2^21 (1 GiB), H=128, S=63 gia M < 63*2^17 (3.9 GiB) kai H=255, S=63 diaforetika.

in2000:

Xrhsimopoihste to prwto apo ta (H,S) = (64,32), (64,63), (128,63), (255,63) poy 8a dwsei C <= 1024. Sthn teleytaia periptwsh, kofte to C se 1023.

seagate:

Diabaste ta C,H,S apo ton disko. Ean to C h S einai polu megalo, tote balte S=17, H=2 kai diplasiaste to H mexri C <= 1024. Ayto shmainei oti to H 8a einai 0 an M > 128*1024*17 (1.1 GiB). Ayto einai bug.

ultrastor and u14_34f:

Ena apo ta tria (H,S) = (16,63), (64,32), (64,63) xrhsimopoieitai, analogo me ton tropo leitoyrgias toy elegkth.

An o odhgos den dinei th gewmetria, manteuoyme xrhsimopoiwntas ton pinaka katatmhsewn h xrhsimopoiwntas thn synolikh xwrhtikothta.

Koitajte ton pinaka katatmhsewn. Efoson, kata sumbash, oi katatmhseis teleiwnoyn se orio kylindroys, mporoume, me dedomeno oti orio = (telikoC,telikoH,telikoS) gia opoiadhpote katatmhsh, apla bazoyme H = telikoH+1 kai S = telikoS. (8ymh8eite oti oi tomeis metriountai apo to 1.) Me perissoteres leptomereies, ginontai ta parakatw. An den yparxei eleu8erh katatmhsh, dialegoyme thn katatmhsh me to megalutero arxikoC. Gia ayth thn katatmhsh, koitame to teliko+1, ypologismeno pros8etontas ta arxh kai mhkos kai ypo8etontas oti h katatmhsh teleiwnei se orio kylindroy. An kai oi dyo times symfwnoun h an telikoC = 1023 kai arxh+mhkos einai akeraio pollaplasio toy (telikoH+1)*telikoS, tote ypo8etoyme oti h katatmhsh einai ontws ey8ygrammismenh me to orio toy kylindroy, kai bazoyme H = telikoH+1 kai S = telikoS. An ayto apotuxei, eite epeidh den yparxoyn katatmhseis, eite epeidh exoyn perierges times, tote koitame pali mono th xwrhtikothta toy diskoy M. Algori8mos: bazoyme H = M/(62*1024) (stroggylopoihmeno kata panw), S = M/(1024*H) (stroggylopoihmeno panw), C = M/(H*S) (stroggylopoihsh katw). Ayto exei to apotelesma na exoyme ta (C,H,S) me to C to polu 1024 kai to S to polu 62.


Next Previous Contents