11 11 TEX L^{A}TEX

Ellhniko Large Disk HOWTO

Andries Brouwer, aeb@cwi.nl v2.2m, 15 Febroyarioy 2000

Ola ta sxetika me th gewmetria toy diskoy kai to orio twn 1024 kylindrwn. — Gia opoiadhpote sxolia, dior8wseis, klp sxetika me thn ellhnikh metafrash epikoinwnhste me ton Panagiwth Boydourh sth dieu8ynsh:

panos@panos.uklinux.net

1 To problhma

As poume oti exete ena disko me 1024 kylindroys. As ypo8esoyme oti exete ki ena leitoyrgiko poy xrhsimopoiei thn palia INT13 BIOS diasundesh me to I/O toy diskoy. Tote exete problhma, afou ayth h diasundesh xrhsimopoiei pedia me 10-bit gia toys kylindroys gia to I/O, opote kulindroi pera twn 1024 den einai prosbasimoi.

Eytyxws, to Linux de xrhsimopoiei to BIOS, opote den yparxei problhma.

Dhladh, ektos apo dyo pragmata:

(1) Otan jekina to susthma, to Linux den trexei akoma opote den mporeite na apofugete ta problhmata toy BIOS. Ayto exei merikes epiptwseis sto LILO kai paromoioys fortwtes ekkinhshs.

(2) Einai aparaithto gia ola ta leitoyrgika poy xrhsimopoioun ena disko na symfwnoun poy briskontai oi katatmhseis. Me alla logia, ean xrhsimopoieite Linux kai, as poume, DOS se ena disko, tote prepei kai ta dyo na metafrazoyn ton pinaka katatmhsewn me ton idio tropo. Ayto exei merikes epiptwseis gia ton pyrhna toy Linux kai to fdisk.

Parakatw akoloy8ei mia leptomerhs perigrafh olwn twn sxetikwn 8ematwn. Shmeiwste oti xrhsimopoihsa ton pyrhna 2.0.8 ws anafora. Alles ekdoseis mporei na diaferoyn ligaki.

2 Perilhch

Exete enan kainourio megalo disko. Ti kanete; Apo thn pleyra toy logismikou: xrhsimopoieite to fdisk (h, kalutera, cfdisk) gia na dhmioyrghsete tis katatmhseis, kai meta to mke2fs gia na dhmioyrghsete ena susthma arxeiwn, kai epeita mount gia na prosarthsete to kainourio susthma sthn ierarxia.

Ena xrono prin 8a mporousa na gracw: De xreiazetai na diabasete ayto to HOWTO efoson den yparxoyn problhmata me megaloys diskoys aytes tis meres. H pleiochfia twn problhmatwn dhmioyrgountai apo xrhstes poy nomizoyn oti mporei na exoyn problhma kai egka8istoun ena diaxeiristh diskoy h xrhsimopoioun to fdisk se expert mode, h dhlwnoyn th gewmetria toy diskoy sto LILO h ston pyrhna.

Parola ayta, typika problhmata einai: (a) aparxaiwmenos ejoplismos, (b) polla leitoyrgika ston idio disko kai, merikes fores, (g) h ekkinhsh.

Aytes tis meres h katastash einai xeiroterh. Isws o 2.3.21 kai neoteroi pyrhnes na einai kaloi gia oloys toy diskoys.

Symboylh:

Gia megaloys diskoys SCSI: to Linux toys yposthrizei apo polu nwris. Den xreiazetai na kanete tipota.

Gia megaloys IDE diskoys (panw apo 8.4GB): breite mia nea sta8erh ekdosh pyrhna (2.0.34 h newterh). Synh8ws ola 8a dior8w8oun, eidika an de zhthsete apo to BIOS metafraseis LBA kai ta sxetika.

Gia polu megaloys IDE diskoys (panw apo 33.8 GB): deite to 12.1 (IDE problhmata me 34+ GB diskoys) parakatw.

Ean to LILO kremaei kata thn ekkinhsh, dhlwste kai sto linear arxeio ry8misewn etc/lilo.conf

Mporei na yparjoyn problhmata me th gewmetria poy mporoun na ly8oun me th dhlwsh ston pyrhna /LILO/fdisk.

Ean exete palio fdisk kai proeidopoiei gia 6 (epikalyptomenes) katatmhseis: agnohste to, h elegjte xrhsimopoiwntas to cfdisk oti ola einai pragmati entajei.

Ean nomizete oti kati paei la8os me to mege8os toy diskoy, sigoyreyteite oti de mperdeuete tis dyadikes me tis dekadikes 3 (), kai ma8ete oti o eleu8eros xwros poy anaferei to df se enan adeio disko einai ligo tois ekato mikrotero apo to mege8os ths katatmhshs afou yparxoyn krathseis apo to susthma.

An akoma nomizete oti yparxei problhma, h apla eiste periergoi, diabaste parakatw.

3 Monades kai Mege8h

Ena kilobyte (kB) einai 1000 bytes. Ena megabyte (MB) einai 1000 kB. Ena gigabyte (GB) einai 1000 MB. Ena terabyte (TB) einai 1000 GB. Ayto einai to SI susthma. Parola ayta, yparxei kosmos poy xrhsimopoiei to 1 MB=1024000 bytes kai mila gia 1.44 MB disketes kai kapoioi poy nomizoyn oti 1 MB=1048576 bytes. Edw akoloy8w to proteinomeno standard kai grafw Ki, Mi, Gi, Ti gia tis dyadikes monades, wste oi disketes einai 1440 KiB (1.47 MB, 1.41 MiB), 1 MiB einai 1048576 bytes (1.05 MB), 1 GiB einai 1073741824 bytes (1.07 GB) kai 1 TiB einai 1099511627776 bytes (1.1 TB).

Swsta, oi kataskeyastes diskwn akoloy8oun to SI susthma kai xrhsimopoioun dekadikes monades. Parola ayta, merika mynhmata toy Linux kai merika fdisk programmata xrhsimopoioun ta sumbola MB kai GB gia dyadika, h kai miktes dyadikes-dekadikes monades. Gia ayto, prin nomisete oti o diskos sas einai mikroteros apo ayton poy sas yposxe8hkan, ypologiste prwta to pragmatiko toy mege8os se dekadikes monades (h apla bytes).

Sxetika me thn orologia kai tis syntomeuseis twn dyadikwn monadwn, o Knuth exei mia enallaktikh protash, sygkekrimena na xrhsimopoioume KKB, MMB, GGB, TTB, PPB, EEB, ZZB, YYB kai na ta kaloume megalo kilobyte, megalo megabyte, ... megalo yottabyte. Grafei ‘Shmeiwste oti to na grafoyme dyo fores to ka8e gramma yponoei kai dyadiko kai megalo. Einai mia kalh protash, afou to ‘megalo gigabyte’ akougetai kalutero apo to ‘gibibyte’. Gia thn periptwsh mas to mono poy prepei na prosejoyme einai oti ena megabyte exei akribws 1000000 bytes, kai kapoios allos oros kai syntomeysh xreiazetai an ennooume kati allo.

3.1 Mege8os tomea

Sto paron keimeno ena tomeas exei 512 bytes. Ayto einai sxedon panta alh8eia, ektos apo merikous MO poy xrhsimopoioun 2048 bytes, kai oles oi xwrhtikothtes poy dinontai parakatw prepei na pollaplasiastoun epi tessera. (Otan xrhsimopoieite to fdisk se tetoioys diskoys , sigoyreyteite oti exete ekdosh 2.9i kai anw , kai dwste thn parametro ‘-b 2048’.)

3.2 Mege8os diskoy

Ena diskos me C kylindroys, H kefales kai S tomeis ana ixnos exei C*H*S tomeis synolika kai xwrhtikothta C*H*S*512 bytes. Gia paradeigma, an h etiketa leei C/H/S=4092/16/63 tote o diskos exei 4092*16*63=4124736 tomeis kai xwraei 4124736*512=2111864832 bytes (2.11 GB). Kata sumbash, dinetai C/H/S=16383/16/63 gia diskoys megaluteroys twn 8.4 GB, kai to mege8os to diskoy de mporei pia na diabastei apo tis times C/H/S poy anaferontai apo to disko.

4 Prosbash diskoy

Gia na diabasete h na gracete kati apo to disko, prepei na deijoyme th 8esh sto disko, dinontas gia paradeigma ton tomea h thn enothta. An o diskos einai SCSI, tote o ari8mos toy tomea phgainei katey8eian sthn entolh SCSI kai o diskos thn katalabainei. An o diskos einai IDE xrhsimopoiwntas LBA, isxuei to idio. Alla an o diskos einai palios RLL h MFM h IDE ths pro-LBA epoxhs, tote o diskos perimenei ena triplo ari8mo (kulindro, kefalh, tomea) gia na katadeijei to shmeio.

H antistoixia metaju grammikhs dieu8ynshs kai ths 3D shmeiografias einai: gia ena disko me C kylindroys, H kefales kai S tomeis/ixnos h 8esh (c,h,s) se 3D h CHS einai h idia 8esh me c*H*S + h*S + (s-1) se grammikh h LBA. (To meion ena einai epeidh oi tomeis arxizoyn kata paradosh apo to 1, oxi to 0 opws sto 3D).

Kata synepeia, gia na prosbash se enan polu palioo mh-SCSI disko, prepei na jeroyme thn gewmetria, dhladh, tis times C, H kai S.

4.1 Prosbash toy BIOS kai to orio twn 1024 kylindrwn

To Linux de xrhsimopoiei to BIOS, alla alla systhmata to xrhsimopoioun. To BIOS, poy prouparxei toy LBA, prosferei tis roytines diskoy INT13 poy dexontai (c,h,s) parametroys. (Akribestera: to AH dialegei th leitoyrgia poy 8a ektelestei, to CH einai ta katw 8 bits toy onomatos toy kylindroys, to CL exei sta bits 7-6 ta anw dyo bits toy ari8mou toy kylindroy kai sta bits 5-0 ton ari8mo toy tomea, DH einai o ari8mos ths kefalhs, kai DL einai o ari8mos toy diskoy (80h h 81h). Ayto ejhgei merika th diatajh toy pinaka katatmhsewn.)

Etsi, exoyme to CHS kwdikopoihmeno se 3 bytes, me 10 bits gia to onoma toy kylindroy , 8 bits gia thn kefalh kai 6 bits gia ton ari8mo ixnoys tomea (1-63). Ejypakouetai oti oi kulindroi mporei na einai apo 0 ews 1023 kai de mporoun na ari8mh8oun panw apo 1024 kulindroi apo to BIOS.

To DOS kai ta Windows den allajan otan IDE diskoi me yposthrijh LBA emfanisthkan, opote to DOS kai ta Windows synexisa na xreiazontai gewmetria diskoy, akoma ki otan ayto de xreiazotan apo to I/O toy diskoy, alla mono gia na epikoinwnoun me to BIOS. Ayto jana shmainei oti to Linux xreiazetai th gewmetria opoy epikoinwnia me to BIOS h me alla leitoyrgika apaiteitai, akoma kai se monternoys diskoys.

Ayth h katastash krathse gia tessera xronia peripoy kai meta emfanisthkan sthn agora diskoi poy de mporousan na klh8oun me tis synarthseis INT13 (ka8oti ta 10+8+6=24 bits gia (c,h,s) den mporoun na ari8mhsoyn panw apo 8.5 GB) kai mia nea diasundesh me to BIOS sxediasthke: oi apokaloumenes Extended INT13 synarthseis, opoy to DS:SI deixnei sto 16-byte Disk Address Packet poy perilambanei enan 8mpito ari8mo enothtwn.

Polu arga o kosmos ths Microsoft kineitai pros th xrhsh aytwn twn Extended INT13 synarthsewn. Mallon se merika xronia apo shmera, kanena monterno susthma de 8a xreiazetai th gewmetria toy diskoy.

4.2 Istoria toy BIOS kai twn oriwn toy IDE

ATA Specification (gia IDE diskoys) - to orio twn 137 GB To polu 65536 kulindroi (ari8mhmenoi 0-65535), 16 kefales (ari8mhmenes 0-15), 255 tomeis/ixnos (ari8mhmenoi 1-255) gia mia megisth xwrhtikothta 267386880 tomewn (512 bytes o ka8enas), dhladh, 136902082560 bytes (137 GB). Ayto akoma den einai problhma (to 1999), alla 8a einai se merika xronia apo shmera.

BIOS Int 13 - to orio twn 8.5 GB To polu 1024 kulindroi (0-1023), 256 kefales (0-255), 63 tomeis/ixnos (1-63) gia megisth xwrhtikothta 8455716864 bytes (8.5 GB). Aytos einai enas arketa sobaros periorismos shmera. Shmainei oti to DOS de mporei na xrhsimopoihsei toys neoys megaloys diskoys.

To orio twn 528 MB An oi idies times c,h,s xrhsimopoiountai gia to BIOS Int 13 call kai gia to I/O toy IDE diskoy, kai oi dyo periorismoi syndyazontai kai mporoume na xrhsimopoihsoyme to polu 1024 kylindroys, 16 kefales kai 63 tomeis/ixnos gia megisth telikh xwrhtikothta 528482304 bytes (528MB), to perifhmo orio twn 504 MiB gia DOS me palio BIOS. Ayto egine problhma to 1993 kai efeyre8hkan polla texnasmata, kai se yliko (LBA), kai firmware (metafrazontas to BIOS) kai se software (diaxeiristes diskwn). H ennoia ths ’metafrashs’ efeyre8hke (1994): to BIOS mporouse na xrhsimopoiei mia gewmetria otan epikoinwnouse me to disko kai allh, ceydh, gewmetria otan milouse sto DOS, kai na metafrasei metaju toys.

To orio twn 2.1 GB (Aprilios 1996)

Merika palia BIOS xrhsimopoioun mono 12 bits gia to pedio sth CMOS RAM poy dinei ton ari8mo twn kylindrwn. Kata synepeia, o ari8mos aytos mporei na einai to polu 4095, kai mono 4095*16*63*512=2113413120 bytes einai prosbasima. To na yparxei megaluteros diskos exei ws apotelesma to kremasma kata thn ekkinhsh. Ayto ekane diskoys me gewmetria 4092/16/63 arketa dhmofilhs. Akoma kai shmera yparxoyn megaloi diskoi poy erxontai me diakopth gia emfanizontai ws 4092/16/63. Deite kai to over2gb.htm.

To orio twn 3.2 GB Yphrxe ena megalo bug sto Phoenix 4.03 kai 4.04 BIOS poy ta ekane na kollane sto CMOS setup gia diskoys megaluteroys twn 3227MB. Deite to over3gb.htm.

To orio twn 4.2 GB (Febroyarios 1997)

H aplh metafrash toy BIOS (ECHS=Extended CHS, merikes fores legetai kai ‘Large disk support’ h apla ‘Large’) leitoyrgei me ton synexh diplasiasmo toy ari8mou twn kefalwn kai ton ypodiplasiasmo toy ari8mou twn kylindrwn poy deixnontai sto DOS, mexri oi kulindroi na einai to polu 1024. To DOS kai ta Windows 95 de mporoun na diaxeiristoun 256 kefales, kai sthn periptwsh poy o diskos anaferei 16 kefales, ayto shmainei oti o aplos aytos mhxanismos mporei na doylecei gia mexri 8192*16*63*512=4227858432 bytes (me ceydh gewmetria me 1024 kylindroys, 128 kefales, 63 tomeis/ixnos). Shmeiwste oti to ECHS den allazei ton ari8mo twn tomewn ana ixnos, opote an den einai 63, to orio 8a einai akoma xamhlotero. Deite to over4gb.htm.

To orio twn 7.9 GB Ligo pio ejypna BIOS apofeugoyn ayto to problhma me th ru8mish prwta toy ari8mou twn kefalwn se 15 (‘revised ECHS’), wste h ceydhs gewmetria na diathreitai me 240 kefales, arketo gia 1024*240*63*512=7927234560 bytes.

To orio twn 8.4 GB Teleiwnontas, an to BIOS kanei o,ti mporei gia mia epityxh metafrash, xrhsimopoiei 255 kefales me 63 tomeis/ixnos (‘assisted LBA’ or just ‘LBA’) kai ftanei ta 1024*255*63*512=8422686720 bytes, ligo mikrotero apo to prohgoumeno orio twn 8.5 GB, efoson gewmetries me 256 kefales prepei na apofeugontai. (H metafrash 8a xrhsimopoihsei gia ton ari8mo kefalwn ton ari8mo H apo thn akoloy8ia 16, 32, 64, 128, 255 gia thn opoia h synolikh xwrhtikothta ftanei sta 1024*H*63*512, kai meta ypologizei ton ari8mo twn kylindrwn C ws thn xwrhtikothta diairoumenh me (H*63*512).)

The 33.8 GB limit (August 1999)

To epomeno empodio erxetai me mege8h anw twn 33.8 GB. To problhma einai oti me 16 kefales kai 63tomeis/ixnos ayto antistoixei se ari8mo kylindrwn panw apo 65535, poy de xwraei se short ari8mo. Ta perissotera BIOS shmera de mporoun na xeiristoun tetoioys diskoys. (Deite Asus upgrades gia nees ekdoseis poy doyleuoyn.) Pyrhnes palaioteroi twn 2.2.14 / 2.3.21 xreiazontai patch. Deite 12.1 (IDE problhmata me 34+ GB diskoys) parakatw.

Gia peraiterw syzhthsh aytou toy 8ematos deite Breaking the Barriers kai, gia perissoteres leptomereies, IDE Hard Drive Capacity Barriers.

Diskoi megaluteroi twn 8.4 GB anaferoyn th gewmetria toys ws 16383/16/63. Ayto shmainei oti h ’gewmetria’ einai aneparkhs kai oti h synolikh xwrhtikothta de mporei na ypologistei apo th gewmetria.

5 Ekkinhsh

Otan to susthma jekina, to BIOS diabazei ton tomea 0 (gnwstos kai ws MBR - Master Boot Record) apo ton prwto disko (h apo disketa h CD-ROM) kai diabazei ton kwdika poy briskei ekei - synh8ws enan fortwth. Ayta ta programmatakia synh8ws den periexoyn odhgous kai xrhsimopoioun to BIOS. Ayto shmainei oti o pyrhnas toy Linux mporei na fortw8ei mono otan brisketai oloklhros stoys prwtoys 1024 kylindroys.

To problhma ayto lunetai polu eukola: sigoyreyteite oti o pyrhnas (kai isws kai alla arxeia poy xreiazontai kata thn ekkinhsh, opws ta arxeia toy LILO) briskontai se mia katatmhsh poy periexetai ej oloklhroy stoys prwtoys 1024 kylindroys kai oti to BIOS mporei na exei prosbash - ayto shmainei ton prwto h deutero disko.

Etsi: dhmioyrghste mia katatmhsh, as poume 10MB, wste na yparxei xwros gia merikous pyrhnes, sigoyreuontas oti brisketai oloklhrh stoys prwtoys 1024 kylindroys toy prwtoy h deuteroy diskoy. Prosarthste thn sto /boot wste to LILO na balei o,ti xreiazetai ekei.

5.1 To LILO kai h epilogh ‘linear’

Allo ena shmeio sto opoio o fortwths kai to BIOS prepei na symfwnoun einai h gewmetria toy diskoy. To LILO rwta ton pyrhna gia th gewmetria, alla olo kai perissoteroi programmatistes odhgwn exoyn thn kakh synh8eia na pairnoyn th gewmetria apo ton pinaka katatmhsewn, anti na lene sto LILO ti 8a xrhsimopoiei to BIOS. Etsi, h gewmetria apo ton pyrhna einai syxna axrhsth. Se aytes tis periptwseis einai xrhsimo na balete sto LILO thn epilogh ‘linear’. To apotelesma einai oti to LILO de xreiazetai th gewmetria kata thn egkatastash toy fortwth alla kanei th metatroph ths grammikhs dieu8ynshs kata thn ekkinhsh. Kai giati ayto den isxuei ej orismou; Yparxei ena meionekthma: me thn epilogh ‘linear’ to LILO den jerei gia ton ari8mo twn kylindrwn, opote den mporei na sas proeidopoihsei an meros toy pyrhna einai egkatesthmeno meta to peras twn 1024 kylindrwn kai mporei na katalhjete me ena susthma poy den jekina.

5.2 Ena bug toy LILO

Me ekdoseis toy LILO katw toy v21 yparxei ena akoma problhma: h metatroph diey8unsewn poy ginetai kata thn ekkinhsh einai problhmatikh: otan to c*H einai 65536 h parapanw, dhmioyrgeitai la8os ston ypologismo. Gia H megalutera toy 64 dhmioyrgeitai aysthrotero orio gia to c apo to gnwsto c < 1024; gia paradeigma, me H=255 kai ena palio LILO prepei na exete c < 258. (c=o kulindros opoy brisketai o pyrhnas, H=ari8mos kefalwn).

5.3 Oi 1024 kulindroi den einai 1024 kulindroi

O Tim Williams grafei: ‘Eixa thn katatmhsh toy Linux stoys prwtoys 1024 kylindroys kai pali den jekinouse. Mono otan to ebala prin to 1 GB doulece’. Pws ginetai ayto; Aytos htan enas SCSI diskos me AHA2940UW elegkth poy xrhsimopoiei eite H=64, S=32 (dhladh kulindroi toy 1 MiB = 1.05 MB), h H=255, S=63 (dhladh kulindroi twn 8.2 MB), analoga me tis epiloges ston disko kai to BIOS. Anamfisbhthta to BIOS ypo8etei to prwto, opote oi 1024 kulindroi ftanoyn mexri to 1 GiB, enw to Linux xrhsimopoiei to deutero kai to LILO nomize oti to orio htan sta 8.4 GB.

6 Gewmetria diskoy, katatmhseis kai ‘epikaluceis’

Ean exete arketa leitoyrgika systhmata stoys diskoys sas, tote ka8ena xrhsimopoiei mia h perissoteres katatmhseis. Mia asymfwnia gia to poy briskontai aytes oi katatmhseis 8a exei katastrofika apotelesmata.

To MBR periexei enan pinaka katatmhsewn poy perigrafei poy briskontai oi (prwtarxikes) katatmhseis. Yparxoyne 4 eggrafes gia 4 prwtarxikes katatmhseis, me ka8e mia na einai

     struct partition {
             char active;    /* 0x80: bootable, 0: not bootable */
             char begin[3];  /* CHS for first sector */
             char type;
             char end[3];    /* CHS for last sector */
             int start;      /* 32 bit sector number (counting from 0) */
             int length;     /* 32 bit number of sectors */
     };

(opoy CHS einai Cylinder/Head/Sector).

Aytes oi plhrofories einai perittes: h perioxh ths katatmhshs dinetai kai apo to pedia twn 24-bit begin kai end, kai apo ta pedia twn 32-bit start kai length.

To Linux xrhsimopoiei mono ta pedia start kai length kai, etsi, mporei na diaxeiristei katatmhseis me to polu 2ˆ 32 tomeis, dhladh, katatmhseis to polu 2 TiB. Ayto einai 100 fores perissotero apo toys shmerinous diskoys, opote mallon 8a einai arketo gia ta epomeno 8 peripoy xronia. (Etsi, oi katatmhseis mporei na einai polu megales, alla yparxei o sobaros periorismos oti se ena ext2 susthma arxeiwn se mhxanhma me 32-bit akeraioys ena arxeio de mporei na einai megalutero apo 2 GiB.)

To DOS xrhsimopoiei ta begin kai end pedia, kai xrhsimopoiei thn BIOS INT13 klhsh gia prosbash sto disko, kai etsi mporei na dei diskoys to polu 8.4GB, akoma kai me BIOS poy kanei metafrash. (Oi katatmhseis de mporoun na einai panw apo 2.1 GB logw periorismwn toy FAT16 systhmatos). To idio isxuei kai gia ta Windows 3.11 kai WfWG kai Windows NT 3.* kai Novell NetWare.

Ta Windows 95 exoyn yposthrijh gia to Extended INT13, kai xrhsimopoioun eidikous tupoys katatmhsewn (c, e, f anti gia b, 6, 5) gia na deijoyn oti h katatmhsh 8a xrhsimopoih8ei etsi. Otan aytoi oi tupoi katatmhsewn xrhsimopoiountai, ta pedia begin kai end periexoyn ceutika stoixeia (1023/255/63). Ta Windows 95 OSR2 eishgagan to FAT32 susthma (tupoi katatmhsewn b or c), poy epitrepei katatmhseis to polu 2 TiB.

Ti einai ayta poy sas deixnei to fdisk gia ‘epikalyptomenes’ katatmhseis, otan sthn pragmatikothta ola einai entajei; Yparxei kati ’la8os’: an deite ta begin kai end pedia tetoiwn katatmhsewn, opws kanei to DOS, epikaluptontai. (Kai ayto de mporei na dior8w8ei, afou ta pedia ayta de mporoun na apo8hkeusoyn ari8mous kylindrwn anw toy 1024 - 8a yparxei panta ’epikalych’ otan exete perissoteroys apo 1024 kylindroys.). Parola ayta, an deite ta start kai length pedia, opws kanei to Linux, kai ta Windows 95 sthn periptwsh katatmhsewn me tupo c, e h f, tote ola einai entajei. Etsi, agnohste tis proeidopoihseis toy otan to cfdisk einai ikanopoihmeno kai exete ena disko mono me Linux. Prosejte otan o diskos moirazetai me to DOS. Xrhsimopoihste tis entoles cfdisk -Ps /dev/hdx kai cfdisk -Pt /dev/hdx gia na deite ton pinaka katatmhsewn toy /dev/hdx.

7 Metafrash kai Diaxeiristes Diskwn

H gewmetria toy diskoy (me kefales, kylindroys kai ixnh) einai kati apo thn epoxh toy MFM kai toy RLL. Ekeines tis meres ayth htan h pragmatikothta. Shmera, me ta IDE h SCSI, kaneis den endiaferetai poia einai h ‘pragmatikh’ gewmetria toys diskoy. Akomh, o ari8mos twn tomewn ana ixnos einai metablhtos: yparxoyn perissoteroi tomeis sto ejwteriko toy diskoy kai etsi den yparxei ‘pragmatikos’ ari8mos tomewn ana ixnos. Anti8etws: h IDE entolh INITIALIZE DRIVE PARAMETERS (91h) xrhsimopoieitai gia na leei ston disko poses kefales kai tomeis/ixnos ypoti8etai oti exei. Einai arketa syxno na deite ena megalo monterno disko me 2 kefales na anaferei 15 h 16 kefales sto BIOS, enw to BIOS na anaferei 255 kefales sta programmata.

Gia ton xrhsth einai kalutero na exei to disko ws ena grammiko sunolo tomewn ari8mhmenoys ws 0, 1, ..., kai na afhsei ta hlektronika na broyn poy brisketai o ka8e tomeas ston disko. Ayth h grammikh ari8mhsh legetai LBA.

Etsi h genikh eikona einai ws ejhs: To DOS, h kapoios allos fortwths, mila sto BIOS, anaferontas ta (c,h,s). To BIOS ta metatrepei se LBA xrhsimopoiwntas thn ceutikh gewmetria poy xrhsimopoiei o xrhsths. An o diskos dextei to LBA tote ayth h timh xrhsimopoieitai gia thn prosbash. Alliws, metatrepetai pisw se (c’,h’,s’) xrhsimopoiwntas th gewmetria poy anaferei o diskos kai etsi ginetai h prosbash.

Shmeiwste oti yparxei kapoia sugxysh sthn xrhsh toy ‘LBA’: San oros poy perigrafei tis dynatothtes toy diskoy shmainei ‘Grammikh Diey8ynsiodothsh Temaxiwn = Linear Block Addressing’ (se anti8esh me th diey8ynsiodothsh CHS). San oros sto BIOS Setup, perigrafei ena eidos metafrashs poy merikes fores kaleitai ‘boh8oumeno LBA = assisted LBA’ - deite parapanw to ‘4.2 ()’.

Kati paromoio symbainei otan o diskos den katalabainei to LBA alla to BIOS jerei thn metafrash. (Sto setup ayto synh8ws onomazetai ‘Large’.) Etsi to BIOS paroysiazei gewmetria (C,H,S) sto leitoyrgiko susthma kai xrhsimopoiei (C’,H’,S’) otan epikoinwnei me ton elegkth. Synh8ws S = S’, C = C’/N kai H = H’*N, opoye N einai h megaluterh dunamh toy duo poy sigoyreuei oti C’ <= 1024 (etsi h xwrhtikothta stroggyleuetai pros ta katw se C’ = C/N). Ayto epitrepei prosbash mexri 8.4 GB (7.8 GiB).

(H trith epilogh sto setup einai synh8ws h ‘Normal’, opoy de ginetai kamia metafrash.)

Ean to BIOS den jerei ta ‘Large’ h ‘LBA’, tote yparxoyn luseis me programmata. Diaxeiristes diskwn opws oi OnTrack h EZ-Drive antika8istoun tis roytines diaxeirishs toy BIOS me tis dikes toys. Ayto synh8ws epitygxanetai me to na yparxei o kwdikas toy diaxeiristh sto MBR kai epakoloy8oys tomeis (to OnTrack onomazei ayton ton kwdika DDO: Dynamic Drive Overlay), wste na ekkineitai prin to leitoyrgiko susthma. Aytos einai o logos poy mporei na yparxoyn problhmata an kapoios jekinhsei to mhxanhma me disketa kai yparxei kai diaxeirisths diskoy.

To apotelesma einai ligo-polu to idio me th metafrash toy BIOS - alla an yparxoyn diaforetika leitoyrgika systhmata ston idio disko tote dhmioyrgountai polla problhmata.

To Linux yposthrizei to OnTrack apo thn ekdosh 1.3.14, kai to EZ-Drive apo thn ekdosh 1.3.29. Perissoteres leptomereies dinontai parakatw.

8 Metafrash toy pyrhna gia diskoys IDE

Ean o pyrhnas anixneusei thn uparjh kapoioy diaxeiristh diskoy se enan IDE disko, 8a prospa8hsei na diairesei ton disko opws o diaxeirisths, wste to Linux na blepei tis idies katatmhseis poy 8a eblepe, gia paradeigma, to DOS me to OnTrack h to EZ-Drive. Parola ayta, DEN ginetai diairesh otan h gewmetria exei dhlw8ei sth grammh entolwn - etsi h entolh ‘hd=cyls,heads,secs’ mporei na ejafanisei thn symbatothta me to diaxeiristh diskoy.

H anadiairesh ginetai xrhsimopoiwntas 4, 8, 16, 32, 64, 128, 255 kefales (kratwntas to H*C sta8ero) mexri eite C <= 1024 h H = 255.

Oi leptomereies akoloy8oun - oi ypoepikefalides einai ta mynhmata poy emfanizontai kata thn ekkinhsh. Edw kai opoydhpote allou se ayto to keimeno oi tupoi twn katatmhsewn dinontai se dekaejadika noumera.

8.1 EZD

To EZ-Drive anixneuetai logw toy oti h prwth prwtarxikh katatmhsh exei tupo 55. H gewmetria diabazetai opws perigrafetai parapanw anti toy pinaka katatmhsewn toy tomea 0 - o pinakas diabazetai apo ton tomea 1. Oi ari8moi temaxiwn toy diskoy den allazontai, alla eggrafes ston tomea 0 anadromologountai ston tomea 1. Ayth h symperifora mporei na allax8ei anametalwttizontas ton pyrhna me #define

FAKE_FDISK_FOR_EZDRIVE 0 sto ide.c.

8.2 DM6:DDO

O OnTrack DiskManager (ston prwto disko) anixneuetai apo to gegonos oti h prwth prwtarxikh katatmhsh exei tupo 54. H gewmetria diabazetai opws anafer8hke parapanw kai oloklhros o diskos «metakineitai» kata 63 tomeis (wste o palios tomeas 63 na ginei o tomeas 0). Meta, ena kainourio MBR (me ton pinaka katatmhsewn) diabazetai apo ton neo tomea 0. Fysika ayto ginetai gia na dhmioyrgh8ei xwros gia to DDO - gia ayto den ginetai ayth h allagh stoys ypoloipoys diskoys.

8.3 DM6:AUX

O OnTrack DiskManager (stoys alloys diskoys) anixneuetai apo thn prwth prwtarxikh katatmhsh poy exei tupo 51 h 53. H gewmetria diabazetai opws perigrafetai parapanw.

8.4 DM6:MBR

Mia palaioterh ekdosh toy OnTrack DiskManager den anixneuetai apo ton tupo katatmhshs alla apo to apotupwma toy. (Elegxetai an h metatopish poy brisketai sta prwta 2 kai 3 bytes toy MBR den einai parapanw apo 430, an h elleich einai ish me 0x55AA kai an akoloy8eitai apo mono byte). 3ana h gewmetria diabazetai opws parapanw.

8.5 PTBL

Telos, yparxei enas elegxos poy prospa8ei na brei th metafrash apo tis times start kai end twn prwtarxikwn katatmhsewn: Ean kapoia katatmhsh exei arxiko kai teliko tomea 1 kai 63 antistoixa kai exei telikes kefales 31, 63, 127 h 254, tote, efoson synh8ws oi katatmhseis teleiwnoyn sta oria toy kylindroy, kai, epishs, to IDE yposthrizei to polu 16 kefales, symperainetai oti to BIOS metafrazei kai h gewmetria allazei gia na xrhsimopoih8oun 32, 64, 128 h 255 kefales antistoixa. Parola ayta, den ginetai kamia allagh otan h paron gewmetria exei hdh 63 tomeis ana ixnos kai toylaxiston 63 kefales (to opoio oti exei hdh ginei mia allagh gewmetrias).

9 Synepeies

Ti shmainoyn ola ayta; Gia toys xrhstes toy Linux mono ena pragma: prepei na sigoyreytoun oti to LILO kai to fdisk xrhsimopoioun th swsth gewmetria, opoy «swsth» gia to fdisk einai h gewmetria poy xrhsimopoieitai kai apo ta alla leitoyrgika ston idio disko, kai gia to LILO ayth poy 8a epitrecei th swsth epikoinwnia me to BIOS kata thn ekkinhsh (synh8ws ayta ta dyo sympiptoyn).

Pws jerei to fdisk gia th gewmetria; Rwta ton pyrhna, xrhsimopoiwntas to HDIO_GETGEO ioctl, prin o xrhsths epembei sth gewmetria.

Pws jerei to LILO th gewmetria; Rwta thn pyrhna xrhsimopoiwntas to HDIO_GETGEO ioctl. Alla o xrhsths mporei na epembei xrhsimopoiwntas thn epilogh ‘disk=’ sto /etc/lilo.conf (deite to lilo.conf(5)). Mporeite na dwsete kai thn linear epilogh sto LILO, kai 8a apo8hkeusei LBA diey8unseis anti gia CHS ston xarth toy, kai 8a brei th gewmetria kata thn ekkinhsh (xrhsimopoiwntas thn INT 13 Function 8 gia na rwthsei gia th gewmetria).

Pws jerei o pyrhnas ti na apanthsei; Prwta ap’ ola, xrhsths mporei na exei dhlwsei th gewmetria me thn entolh ‘hda=cyls,heads,secs’ ston pyrhna (deite bootparam(7)), isws xeirokinhta h zhtwntas ton boot loader na dwsei ayth thn parametro ston pyrhna. Gia paradeigma mporeite na peite sto LILO na dwsei mia tetoia parametro pros8etontas to ‘append = "hda=cyls,heads,secs"’ sto /etc/lilo.conf (deite lilo.conf(5)). Diaforetika o pyrhnas 8a mantecei, pi8anon xrhsimopoiwntas times poy brhke apo to BIOS h ton disko.

Einai dynaton (apo ton pyrhna 2.1.79) na allajete th gewmetria ston pyrhna xrhsimopoiwntas to /proc. Gia paradeigma

     # sfdisk -g /dev/hdc
     /dev/hdc: 4441 cylinders, 255 heads, 63 sectors/track
     # cd /proc/ide/ide1/hdc
     # echo bios_cyl:17418 bios_head:128 bios_sect:32 > settings
     # sfdisk -g /dev/hdc
     /dev/hdc: 17418 cylinders, 128 heads, 32 sectors/track
     #

9.1 Ypologizontas tis parametroys toy LILO

Merikes fores einai xrhsimo na orisete th gewmetria xrhsimopoiwntas to ‘hda=cyls,heads,secs’ sth grammh entolwn toy pyrhna. Synh8ws panta xreiazetai secs=63, kai o logos poy to pro8etoyms einai gia na oristoun oi heads. (Logikes times shmera einai heads=16 kai heads=255.) Ti 8a prepei na orisoyme gia to cyls? Akribws ton ari8mo poy 8a dwsei th swsth synolikh xwrhtikothta gia C*H*S tomeis. Gia paradeigma, gia ena disko me 71346240 tomeis (36529274880 bytes) to C ypologizetai ws 71346240/(255*63)=4441 (gia paradeigma xrhsimopoiwntas ena programma san to bc), kai h parametros ekkinhshs einai hdc=4441,255,63. Pws jeroyme thn swsth xwrhtikothta; Gia paradeigma,

     # hdparm -g /dev/hdc | grep sectors
      geometry     = 4441/255/63, sectors = 71346240, start = 0
     # hdparm -i /dev/hdc | grep LBAsects
      CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=71346240

dinei duo tropoys na broume ton synoliko ari8mo tomewn 71346240. O pyrhnas mas dinei

     # dmesg | grep hdc
     ...
     hdc: Maxtor 93652U8, 34837MB w/2048kB Cache, CHS=70780/16/63
      hdc: [PTBL] [4441/255/63] hdc1 hdc2 hdc3! hdc4 < hdc5 > ...

poy mas leei gia (toylaxiston) 34837*2048=71346176 kai gia (toylaxiston) 70780*16*63=71346240 tomeis. Se ayth thn periptwsh, h deuterh timh symbainei na einai swsth, alla genika kai oi duo mporoun na stroggylopoih8oyn pros ta katw. Aytos einai enas kalos tropos na proseggisoyme to mege8os toy diskoy otan to hdparm den einai dia8esimo. Pote mhn dinetai polu megalh timh gia to cyls! Sthn periptwsh twn SCSI diskwn o akribhs ari8mos twn tomewn dinetai kata thn ekkinhsh:

     SCSI device sda: hdwr sector= 512 bytes. Sectors= 17755792 [8669 MB] [8.7 GB]

(kai ta MB, GB einai stroggylopoihmena, oxi pros ta katw, kai ‘dyadika’).

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 SEEP-ROM, 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.

11 To orio toy Linux IDE twn 8 GiB

O Linux IDE odhgos pairnei th gewmetria kai xwrhtikothta toy diskoy (kai alla polla) xrhsimopoiwntas thn klhsh ATA IDENTIFY. Mexri prosfata, o odhgos de 8a pisteye thn epistrefomenh timh ths lba xwrhtikothtas (lba_capacity), an htan panw apo 10% apo thn ypologizomenh me C*H*S. Parola ayta, oi kataskeyastes, se megaloys IDE diskoys (me perissoteroys apo 16514064 tomeis) epistrefoyn ta C=16383, H=16, S=63, gia ena sunolo 16514064 tomewn (7.8 GB), anejarthtws toy pragmatikou toys mege8oys, alla dinoyn thn pragmatikh xwrhtikothta ws lba.

Oi prosfatoi pyrhnes (2.0.34, 2.1.90) to jeroyn ayto kai to dior8wnoyn. An exete palaiotero pyrhna kai de 8elete na anaba8misteite, kai o pyrhnas blepei mono 8 GiB se enan polu megalutero disko, dokimaste na

allajete th roytina lba_capacity_is_ok sto /usr/src/linux/drivers/block/ide.c se kati san
     static int lba_capacity_is_ok (struct hd_driveid *id) {
             id->cyls = id->lba_capacity / (id->heads * id->sectors);
             return 1;
     }

Gia mia pio prosektikh dior8wsh deite to 2.1.90.

11.1 BIOS epiplokes

Opws molis anefera, oi megaloi diskoi epistrefoyn C=16383, H=16, S=63 anejarthta apo to pragmatiko toys mege8os, enw to pragmatiko mege8os epistrefetai ws LBAcapacity. Merika BIOS den to anagnwrizoyn ayto kai metafrazoyn to 16383/16/63 se kati me ligoteroys kylindroys kai perissoteres kefales, p.x. 1024/255/63 h 1027/255/63. Etsi, o pyrhnas de mporei na anagnwrisei th gewmetria 16383/16/63, alla kai tis mperdemenes ekdoseis ths toy BIOS. Apo ton pyrhna 2.2.2 ola ayta dior8w8hkan (xrhsimopoiwntas ta H kai S toy BIOS kai ypologizontas to C = xwrhtikothta/(H*S)). Synh8ws to problhma lunetai me to na ry8mistei o diskos ws Normal sto BIOS (h akomh kalutero ws None, xwris na anafer8ei ka8oloy sto BIOS). An ayto den einai dynato epeidh prepei na ekkinhsete apo ayton h xrhsimopoieite DOS/Windows kai h anaba8mish se 2.2.2 h megaluterh ekdosh de ginetai, xrhsimopoihste parametroys ekkinhshs ston pyrhna.

Ean to BIOS anaferei 16320/16/63, tote ayto ginetai synh8ws gia na exoyme 1024/255/63 meta th metafrash.

Yparxei ena akoma problhma. An o diskos eixe xwristei se katatmhseis prin thn metafrash, tote o pyrhnas mporei kata thn ekkinhsh na dei th gewmetria poy xrhsimopoieitai ston pinaka katatmhsewn kai na anaferei hda: [PTBL] [1027/255/63]. Ayto einai kako ka8oti o diskos einai twra mono 8.4GB. Ayto dior8w8hke ston 2.3.21. 3ana, parametroi ekkinhshs ston pyrhna 8a boh8hsoyn.

11.2 Braxykyklwthres gia epilogh ari8mou kefalwn

Polloi diskoi exoyn braxykyklwthres (jumpers) poy epitrepoyn na epilejete metaju gewmetria 15 h 16 kefalwn. Oi synh8eis ry8miseis 8a sas dwsoyn 16 kefales. Merikes fores kai oi dyo gewmetries dinoyn ton idio ari8mo tomewn, merikes fores me 15 kefales dinontai ligoteroi tomeis. Yparxei enas kalos logos gia ayth thn epilogh: o Petri Kaukasoina grafei: ‘Enas 10.1 Gig IBM Deskstar 16 GP (IBM-DTTA-351010) htan ry8mismenos gia 16 kefales alla sto palio PC (me AMI BIOS) den ekkinouse kai eprepe na to ry8misw se 15 kefales. To hdparm -i leei oti RawCHS=16383/15/63 kai LBAsects=19807200. Xrhsimopoiw 20960/15/63 gia na exw th megisth xwrhtikothta.’ H gewmetria 16383/15/63 den anagnwrizetai apo ton pyrhna, opote xreiazontai parametroi ekkinhshs. Gia tis ry8miseis deite http://www.storage.ibm.com/techsup/hddtech/hddtech.htm.

11.3 Braxykyklwthres poy meiwnoyn th synolikh xwrhtikothta

Polloi diskoi exoyn braxykyklwthres poy kanoyn ton disko na fainetai mikroteros. Arketa anohto, kai mallon kanenas xrhsths toy Linux de 8a 8elei na to xrhsimopoihsei, alla merika BIOS kollane me megaloys diskoys. H synh8hs lush einai na krathsete ton disko ejw apo to BIOS. Alla ayto ginetai mono an den einai o diskos ekkinhshs.

To prwto sobaro orio htan twn 4096 kylindrwn (dhladh, 16 kefales kai 63tomeis/ixnos, 2.11GB). Gia paradeigma, enas Fujitsu MPB3032ATU 3.24 GB diskos exei gewmetria 6704/15/63, alla mporei na emfanistei ws 4092/16/63, kai meta anaferei LBA xwrhtikothta 4124736 tomeis, wste to leitoyrgiko susthma na mporei na mantecei oti sthn pragmatikothta einai megaluteros. Se ayth thn periptwsh (me ena BIOS poy kollaei otan dei poso megalos einai o diskos sthn pragmatikothta wste na xreiazetai o periorismos) xreiazontai parametroi ekkinhshs gia na peite sto Linux to mege8os toy diskoy.

Oi perissoteroi diskoi mporoun na emfanistoun ws diskoi 2GB kai meta na anaferoyn thn kommenh gewmetria ws 4092/16/63 h 4096/16/63, alla akoma anaferoyn thn plhrh LBA xwrhtikothta. Tetoioi diskoi doyleuoyn swsta kai anaferoyn thn plhrh xwrhtikothta sto Linux, asxeta me tis 8eseis twn braxykyklwthrwn.

Ena pio prosfato orio einai 12.1 (to orio twn 33.8 GB). Pyrhnes palaioteroi apo ton 2.3.21 xreiazontai patch gia na mporesoyn na xrhsimopoihsoyn megaluteroys IDE diskoys apo 33.8GB. Merikoi megaluteroi diskoi mporoun na ry8mistoun me braxykyklwthres wste na emfanizontai ws 33.8 GB. Gia paradeigma, o IBM Deskstar 37.5 GB (DPTA-353750) mporei na ry8mistei wste na emfanizetai ws 33.8 GB, kai meta anaferei gewmetria 16383/16/63 opws oloi oi megaloi diskoi, alla LBA xwrhtikothta 66055248 (antistoixa me 65531/16/63 h 4111/255/63)). Aytoi, otan ry8mistoun ws 33.8GB, xreiazontai parametroys gia plhrh xwrhtikothta sto Linux. Deite to the BIOS 33.8 GB limit.

12 To orio twn 65535 kylindrwn sto linux

To HDIO_GETGEO ioctl epistrefei ton ari8mo twn kylindrwn se tupo short. Ayto shmainei oti an exte panw apo 65535 kylindroys, o ari8mos perikoptetai kai (gia ena typiko SCSI disko me 1 MiB ana kulindro) enas diskos 80 GiB 8a fainetai ws 16 GiB. Efoson anagnwris8ei ayto to problhma, apofeugetai eukola.

12.1 IDE problhmata me diskoys 34+ GB

Diskoi megaluteroi twn 33.8 GB de doyleuoyn me pyrhnes palaioteroys toy 2.3.21. Oi leptomereies einai: Ypo8este oti agorasate ena neo IBM-DPTA-373420 disko me xwrhtikothta 66835440 tomeis (34.2 GB). Pyrhnes palaioteroi toy 2.3.21 8a sas poune oti to mege8os toy diskoy einai 769*16*63 = 775152 tomeis (0.4 GB), poy einai ligo apogohteytiko. Kai dinontas tis parametroys hdc=4160,255,63 de boh8aei ka8oloy - apla agnoountai. Ti symbainei; H roytina idedisk_setup() briskei th gewmetria poy anaferei o diskos (poy einai 16383/16/63) kai parakamptei o,ti dinei o xrhsths sth grammh entolwn, wste ta dedomena toy xrhsth na xrhsimopoiountai mono gia th gewmetria toy BIOS. H roytina current_capacity() h idedisk_capacity() ypologizei ton ari8mo kylindrwn ws 66835440/(16*63)=66305, alla afou apo8hkeuetai se short ari8mo, ginetai 769. Efoson h lba_capacity_is_ok() katestrece to id->cyls, ka8e epomenh klhsh se ayto 8a einai la8os kai o diskos 8a ginei 769*16*63. Gia pollous pyrhnes yparxei patch. Gia ton 2.0.38 mporei na bre8ei sto ftp.kernel.org. Gia ton 2.2.12 einai sto www.uwsg.indiana.edu. Oi 2.2.14pre pyrhnes yposthrizoyn aytous toys diskoys. Stoys 2.3.* pyrhnes, yparxei yposthrijh apo ton 2.3.21. Pantws, to problhma mporei na ‘ly8ei’ 11.3 (xrhsimopoiwntas toys braxykyklwthres) gia na kopei to mege8os se 33.8 GB. Se polles periptwseis mia 4.2 (anaba8mish toy BIOS) 8a xreiastei an 8elete na ekkinhsete to susthma apo ayto to disko.

13 Ektetamenes kai logikes katatmhseis

6 (Parapanw,) eidame oti th domh toy MBR (tomeas 0): kwdikas toy fortwth akoloy8oumenos apo 4 eggrafes katatmhsewn 16 byte h ka8e mia, akoloy8oumeno apo to AA55 apotupwma. Katatmhseis tupoy 5 h F h 85 (dekaejadiko) exoyn eidikh shmasia: perigrafoyn ektetamenes katatmhseis: kommatia toy diskoy poy 8a katatmh8oun se logikes katatmhseis. (Etsi, mia ektetamenh katatmhsh einai apla ena doxeio, de mporei na xrhsimopoih8ei apo monh ths, alla mesw twn logikwn katatmhsewn poy periexei.) Mono h topo8esia toy prwtoy tomea mias ektetamenhs katatmhshs einai shmantikh. Aytos o prwtos tomeas periexei enan pinaka katatmhsewn me 4 eggrafes: mia logikh, mia ektetamenh kai dyo axrhsimopoihtes. Me ayton ton tropo mporei na dhmioyrgh8ei mia alysida pinakwn skorpismenh pantou ston disko, opoy o prwtos pinakas perigrafei treis prwtarxikes katatmhseis kai mia ektetamenh, kai ka8e epomenos pinakas perigrafei mia logikh katatmhsh kai ton tomea toy epomenoy pinaka.

Einai shmantiko na to katalabete ayto: Otan kapoios xrhsths kanei kapoia blakeia xwrizontas ton disko toy, 8elei na jerei: Einai ta dedomena moy akoma ekei; H apanthsh einai synh8ws nai. Alla an dhmioyrgh8hkan logikes katatmhseis, tote oi pinakes poy perigrafoyn tis katatmhseis aytes grafthkan sthn arxh twn katatmhsewn aytwn kai ta dedomena poy yphrxan ekei xa8hkan.

To sfdisk 8a deijei olh thn alysida. p.x.,

     # sfdisk -l -x /dev/hda
     Disk /dev/hda: 16 heads, 63 sectors, 33483 cylinders
     Units = cylinders of 516096 bytes, blocks of 1024 bytes, counting from 0
        Device Boot Start     End   #cyls   #blocks   Id  System
     /dev/hda1          0+    101     102-    51376+  83  Linux
     /dev/hda2        102    2133    2032   1024128   83  Linux
     /dev/hda3       2134   33482   31349  15799896    5  Extended
     /dev/hda4          0       -       0         0    0  Empty

     /dev/hda5       2134+   6197    4064-  2048224+  83  Linux
         -           6198   10261    4064   2048256    5  Extended
         -           2134    2133       0         0    0  Empty
         -           2134    2133       0         0    0  Empty
     /dev/hda6       6198+  10261    4064-  2048224+  83  Linux
         -          10262   16357    6096   3072384    5  Extended
         -           6198    6197       0         0    0  Empty
         -           6198    6197       0         0    0  Empty
     ...
     /dev/hda10     30581+  33482    2902-  1462576+  83  Linux
         -          30581   30580       0         0    0  Empty
         -          30581   30580       0         0    0  Empty
         -          30581   30580       0         0    0  Empty
     #

Einai dynaton na dhmioyrgh8oun xalasmenoi pinakes. Polloi pyrhnes mpainoyn se kuklo an kapoia ektetamenh katatmhsh deixnei pisw ston eayto ths h se prohgoumenh katatmhsh sthn alysida. Einai dynaton na yparxoyn duo ektetamenes katatmhseis se kapoion pinaka wste h alysida na xwrizei. (Gia paradeigma, ayto mporei na symbei an ena fdisk den anagnwrizei ta 5, F, 85 ws ektetamenoys tupoys kai dhmioyrghsei ena 5 dipla se ena F.) Kanena koino fdisk de mporei na xeiristei tetoies katastaseis, opote xreiazetai ligh doyleia me to xeri gia na dior8w8oun. O pyrhnas toy Linux 8a dextei mia xwrismenh alysida se ejwteriko epipedo. Dhladh, mporeite na exete dyo alysides gia logikes katatmhseis. Merikes fores ayto einai xrhsimo, afou mporeite na exete tupo 5 gia to DOS kai tupo 85, aorato sto DOS, gia to Linux, wste to fdisk toy DOS na mhn kollhsei epeidh oi katatmhseis sas einai peran twn 1024 kylindrwn.

14 Lunontas problhmata

Polloi nomizoyn oti exoyn problhma, enw sthn pragmatikothta den yparxei kanena. H pisteuoyn oti ta problhmata poy exoyn ofeilontai sth gewmetria toy diskoy, enw ayto den exei na kanei tipota me to problhma toys. Ta parapanw mporei na akougontai periploka alla h gewmetria einai kati sxetika aplo: afhste thn opws einai kai ola 8a einai mia xara· h to polu na dwsete thn parametro ‘linear’ sto LILO an den proxwraei meta to ‘LI’ otan jekina. Prosejte ta mynhmata toy pyrhna kai 8ymh8eite: oso perissotero peirazete thn gewmetria (orizontas kefales kai kylindroys sto LILO, to fdisk kai ton pyrhna) toso pi8anotero einai na mh doylecei. Xontrika ola einai entajei apo mona toys.

Kai 8ymh8eite: poy8ena sto Linux de xrhsimopoieite h gewmetria, opote kanena problhma de mporei na dhmioyrgh8ei apo aythn. H gewmetria xrhsimopoieite mono apo to LILO kai to fdisk. Etsi, an to LILO den jekina ton pyrhna, mporei na einai problhma gewmetrias. An diaforetika leitoyrgika den katalabainoyn ton pinaka katatmhsewn, mporei na einai problhma gewmetrias. Tipota perissotero. Sygkekrimena, an to mount de doyleuei mhn anhsyxeite gia th gewmetria· to problhma einai allou.

14.1 Problhma: to Linux xrhsimopoiei la8os gewmetria gia ton disko moy.

Einai pi8ano enas diskos na labei la8os gewmetria. O pyrhnas rwta to BIOS gia ta hd0 kai hd1 (toys diskoys 80H kai 81H sumfwna me to BIOS) kai ypo8etei oti einai gia ta hda kai hdb. Alla an ekkineite apo SCSI, oi prwtoi dyo diskoi mporei na einai SCSI kai o pemptos diskos, poy einai prwtos IDE hda diskos, pairnei th gewmetria toy sda. Ayto lunetai eukola me thn parametro ekkinhshs ‘hda=C,H,S’ me tis katallhles times C, H kai S, eite kata thn ekkinhsh h sto /etc/lilo.conf.

14.2 Problhma: Idioi diskoi exoyn diaforetikh gewmetria

‘Exw dyo omoioys diskoys 10GB IBM. To fdisk dinei diaforetiko mege8os ston ka8ena. Deite:

     # fdisk /dev/hdb
     Disk /dev/hdb: 255 heads, 63 sectors, 1232 cylinders
     Units = cylinders of 16065 * 512 bytes
        Device Boot  Start      End   Blocks   Id  System
     /dev/hdb1           1     1232  9896008+  83  Linux native
     # fdisk /dev/hdd
     Disk /dev/hdd: 16 heads, 63 sectors, 19650 cylinders
     Units = cylinders of 1008 * 512 bytes
        Device Boot  Start      End   Blocks   Id  System
     /dev/hdd1           1    19650  9903568+  83  Linux native

Pws kai;’

Ti symbainei edw; Prwta apo ola, oi diskoi einai pragmati 10GB: to hdb exei mege8os 255*63*1232*512 = 10133544960, kai to hdd 16*63*19650*512 = 10141286400, etsi tipota de symbainei kai o pyrhnas toys blepei kai toys duo san 10.1 GB. Giati h diafora sto mege8os; Ayto symbainei epeidh o pyrhnas pairnei tis plhrofories gia toys prwtoys dyo IDE diskoys apo to BIOS, kai to BIOS exei balei ston hdb 255 kefales (kai 16*19650/255=1232 cylinders). H stroggylopoihsh kostizei sxedon 8MB.

An 8elete mporeite na allajete ton hdd me ton idio tropo kai na dwsete ston pyrhna kata thn ekkinhsh ‘hdd=1232,255,63’.

14.3 Problhma: to fdisk blepei perissotero xwro apo to df

To fdisk 8a sas pei posa temaxia (blocks) yparxoyn ston disko. An dhmioyrghsete susthma arxeiwn, p.x. me to mke2fs, tote to susthma krata ligo xwro gia logoys diaxeirishs· peripoy 4% toy synolikou xwroy, perissotero an 8elete polla inodes. Gia paradeigma:

     # sfdisk -s /dev/hda9
     4095976
     # mke2fs -i 1024 /dev/hda9
     mke2fs 1.12, 9-Jul-98 for EXT2 FS 0.5b, 95/08/09
     ...
     204798 blocks (5.00%) reserved for the super user
     ...
     # mount /dev/hda9 /somewhere
     # df /somewhere
     Filesystem         1024-blocks  Used Available Capacity Mounted on
     /dev/hda9            3574475      13  3369664      0%   /mnt
     # df -i /somewhere

     Filesystem           Inodes   IUsed   IFree  %IUsed Mounted on
     /dev/hda9            4096000      11 4095989     0%  /mnt
     #

Exoyme mia katatmhsh 4095976 blocks, kanoyme ena ext2 susthma, to prosartoume kai telika exoyme mono 3574475 blocks· 521501 blocks (12%) xa8hkan sta inodes kai th diaxeirish. Shmeiwste oti h diafora metaju twn 3574475 kai twn 3369664 blocks einai ta 13 poy xrhsimopoiountai kai ta 204798 poy krath8hkan gia ton yperxrhsth. To teleytaio noumero mporei na allajei me to tune2fs. To ‘-i 1024’ einai logiko na xrhsimopoih8ei mono gia katatmhseis newn h taxydromeioy, opoy yparxoyn polla kai mikra arxeia. To synh8ismeno 8a htan:

     # mke2fs /dev/hda9
     # mount /dev/hda9 /somewhere
     # df /somewhere
     Filesystem         1024-blocks  Used Available Capacity Mounted on
     /dev/hda9            3958475      13  3753664      0%   /mnt
     # df -i /somewhere
     Filesystem           Inodes   IUsed   IFree  %IUsed Mounted on
     /dev/hda9            1024000      11 1023989     0%  /mnt
     #

Twra mono 137501 blocks (3.3%) xrhsimopoiountai gia inodes, wste exoyme 384 MB perissotera apo prin. (Profanws ka8e inode xrhsimopoiei 128 bytes). Apo thn allh, mporoume na exoyme to polu 1024000 arxeia (parapanw apo arketa), anti twn 4096000 (yperbolika polla) poy eixame prin.