\documentclass[letterpaper]{article}
\nonstopmode
\akai
\usepackage{linuxdoc-sgml}
\usepackage{qwertz}
\usepackage{url}
\usepackage[latin1]{inputenc}
\usepackage{t1enc}
\usepackage[english]{babel}
\usepackage{epsfig}
\usepackage{null}
\def\addbibtoc{
\addcontentsline{toc}{section}{\numberline{\mbox{}}\relax\bibname}
}%end-preamble
\setcounter{page}{1}
\title{Large Disk mini-HOWTO ÖÐÒë°æ}
\author{×÷Õß: Andries Brouwer, {\ttfamily \onlynameurl{jaeb@cwi.nl}}\\ 
ÒëÕß: Asd L. Chen, {\ttfamily \onlynameurl{asdchen@ms1.hinet.net}}}
\date{v1.0, 26 June 1996
·­ÒëÈÕÆÚ: 10-13 November 1997}
\abstract{ËùÓÐÓÐ¹Ø disk geometry ¼° 1024 cylinder µÄÏÞÖÆ£®}


\begin{document}
\maketitle
\tableofcontents

\section{ÎÊÌâËùÔÚ}

¼ÙÈçÄãµÄ´Åµú³¬¹ý 1024 ¸ö´Å´Ø(cylinders)£® »¹ÓÐ, ¼ÙÈçÄãµÄ×÷ÒµÏµÍ³Ê¹ÓÃ»ù±¾Êä³öÈëÏµÍ³(BIOS)£®ÄÇ÷áÄã»áÓöµ½Ò»¸öÎÊÌâ, ÒòÎªÒ»°ã´ÅµúÊä³öÈë£¯ÊäÈëËùÊ¹ÓÃµÄ INT13 BIOS ½éÃæÒÔÒ»¸ö 10 Î»Ôª(bit) µÄÀ¸Î»À´²Ù×÷´Å´Ø, ËùÒÔÎÞ·¨´æÈ¡µÚ 1024 ¼°Ö®ááµÄ´Å´Ø£®

ÐÒÔËµÄÊÇ, Linux ²»Ê¹ÓÃ BIOS,  ËùÒÔÃ»ÓÐÎÊÌâ£®

»°ÊÇÕâ÷áËµ, µ«ÓÐÁ½¼þÊÂÀýÍâ:

(1) µ±ÄãÔÚÆô¶¯ÏµÍ³Ê±, Linux »¹Ã»¿ªÊ¼Ö´ÐÐËùÒÔÎÞ·¨ÈÃÄã±ÜÃâÕâ¸öÎÊÌâ£®Õâ¶Ô LILO ÒÔ¼°ÀàËÆµÄÆô¶¯ÔØÈë³ÌÊ½(boot loaders)ÓÐÐ©Ó°Ïì£®

(2) Ê¹ÓÃ´ÅµúµÄËùÓÐ×÷ÒµÏµÍ³±ØÐëÍ¬Òâ·Ö¸îÇøµÄÎ»ÖÃ£®»»¾ä»°Ëµ, Èç¹ûÄãÔÚÒ»¿Å´ÅµúÉÏÊ¹ÓÃ Linux  ÒÔ¼°, ÀýÈç DOS, ÄÇ÷áÁ½Õß±ØÐëÒÔÏàÍ¬µÄ·½Ê½½â¶Á·Ö¸î±íµÄ×ÊÁÏ£®Õâ¶Ô Linux  ºËÐÄÒÔ¼° fdisk  ÓÐÐ©Ó°Ïì.

µ×ÏÂÊÇ¶ÔËùÓÐÏà¹ØÏ¸½Ú¸üÏêÏ¸µÄÃèÊö£®×¢Òâ, ÎÒÊ¹ÓÃ 2.0.8  °æºËÐÄÔ­Ê¼³ÌÊ½×öÎª²Î¿¼£®ÆäËüµÄ°æ±¾¿ÉÄÜÓÐÒ»µãµã³öÈë£®






\section{Æô¶¯}

µ±ÏµÍ³Æô¶¯Ê±,  BIOS ´ÓµÚÒ»¸ö´Åµú(»ò´ÓÈíµú)¶ÁÈ¡´ÅÇø 0 (Ò»°ãÍ¨³ÆµÄ MBR - Master Boot Record, Ö÷Æô¶¯´ÅÇø)²¢ÌøÖÁÔÚ¸Ã´¦µÄ³ÌÊ½Âë - Í¨³£ÊÇÒ»Ð©Æô¶¯ÔØÈë³ÌÊ½(bootstrap loader)£®
ÕâÐ©Ð¡Ð¡µÄÆô¶¯³ÌÊ½Ò»°ã²»»áÓÐ×Ô¼ºµÄ´ÅµúÇý¶¯³ÌÊ½¶ø»áÊ¹ÓÃ BIOS ËùÌá¹©µÄ·þÎñ£®ÕâÒâÎ½ÖøÖ»ÓÐÕû¸ö Linux ºËÐÄ¶¼Î»ì¶¿ªÍ·µÄ 1024 ¸ö´Å´ØÄÚÊ±²ÅÄÜ¹»±»Æô¶¯£®

Õâ¸öÎÊÌâºÜÈÝÒ×½â¾ö: È·¶¨ºËÐÄ(Ò²Ðí»¹°üÀ¨ÆäËüÆô¶¯Ê±ÓÃµ½µÄµµ°¸,  ÏñÊÇ LILO map µµ) ÊÇ·ÅÔÚÒ»¸ö BIOS ¿ÉÒÔ´æÈ¡µÄµ½, È«¶¼ÔÚ¿ªÍ·µÄ  1024 ¸ö´Å´ØÄÚµÄ·Ö¸îÇøÀï -  Õâ¿ÉÒÔ(¿ÉÄÜ)ÊÇµÚÒ»¸ö»òµÚ¶þ¸ö´Åµú£®

ÁíÒ»µãÊÇÆô¶¯ÔØÈë³ÌÊ½Óë BIOS ±ØÐëÍ¬Òâ±Ë´Ë¶Ô´ÅµúÂß¼­(geometry)ÉÏµÄ¿´·¨£®
¸ø LILO `{\ttfamily linear}' Õâ¸öÑ¡Ïî²ÎÊý¿ÉÄÜ»áÓÐÐ©°ïÖú£®Ï¸½ÚááÊö£®






\section{´Åµú geometry ÒÔ¼°·Ö¸îÇø}

Èç¹ûÄãµÄ´ÅµúÉÏÓÐºÃ¼¸ÖÖ×÷ÒµÏµÍ³, Ã¿Ò»ÖÖÊ¹ÓÃÒ»¸ö»ò¶à¸ö·Ö¸îÇø£®ÄÇ÷á¶Ôì¶·Ö¸îÇøÎ»ì¶ºÎ´¦²»Í¬µÄ¿´·¨¿ÉÄÜµ¼ÖÂÔÖÄÑÐÔµÄáá¹û£®

MBR ÖÐ°üº¬Ò»¸ö·Ö¸î±íÃèÊö{\itshape ·Ö¸îÇø\/}(Ö÷·Ö¸îÇø: primary) ÔÚÄÇÀï£®ÓÐËÄ¸ö±í¸ñ¸øËÄ¸öÖ÷Òª·Ö¸îÇøÊ¹ÓÃ, ËüÃÇ¿´ÆðÀ´Ïñ
\begin{tscreen}
\begin{verbatim}
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 */
};
\end{verbatim}
\end{tscreen}

(ÆäÖÐ CHS ÊÇ´Å´Ø£¯´ÅÍ·£¯´ÅÇø: Cylinder/Head/Sector µÄËõÐ´)

Òò´Ë, ÓÐÏî×ÊÑ¶ÊÇÖØ¸²µÄ: ·Ö¸îÇøµÄÎ»ÖÃ¿ÉÒÔÓÉ 24 Î»ÔªµÄ {\ttfamily begin} ÒÔ¼° {\ttfamily end} À¸Î», ºÍ 32 Î»ÔªµÄ {\ttfamily start} ÒÔ¼° {\ttfamily length} À¸Î»¸ø¶¨£®

Linux Ö»Ê¹ÓÃ {\ttfamily start} ÒÔ¼° {\ttfamily length} À¸Î», ¹Ê×î¶à¿ÉÒÔ´¦Àí°üº¬ 2\^{}32 ¸ö´ÅÇøµÄ·Ö¸îÇø, Ò²¾ÍÊÇ, ×î´ó 2 TB µÄ·Ö¸îÇø£®ÕâÊÇÏÖ½ñ´Åµú»úµÄÁ½°Ù±¶, ËùÒÔÒ²Ðí×ã¹»ÍùááÊ®ÄêµÄÐèÇó£®

²»ÐÒµÄÊÇ, BIOS INT13  ºô½ÐÊ¹ÓÃÈý¸öÎ»Ôª×éµÄ CHS  ±àÂë,  10 ¸öÎ»Ôª×÷Îª´Å´ØºÅÂë, 8 ¸öÎ»Ôª×÷Îª´ÅÍ·ºÅÂë, ¼° 6  ¸öÎ»Ôª×÷Îª´Å¹ìÉÏµÄ´ÅÇøºÅÂë£®
¿ÉÄÜµÄ´Å´ØºÅÂëÊÇ 0-1023,  ¿ÉÄÜµÄ´ÅÍ·ºÅÂëÊÇ 0-255, ¶ø´Å¹ìÉÏ¿ÉÄÜµÄ´ÅÇøºÅÂëÎª 1-63(ÊÇµÄ, ´Å¹ìÉÏµÄ´ÅÇøÊÇÓÉ 1 ÆðËã, ²»ÊÇ 0)£®
ÒÔÕâ 24 Î»Ôª×î¶à¿ÉÒÔ¶¨Ö· 8455716864 ¸öÎ»Ôª×é(7.875 GB), ÕâÊÇ 1983 Äê´Åµú»úµÄÁ½°Ù±¶£®

¸ü²»ÐÒµÄÊÇ, ±ê×¼µÄ IDE  ½éÃæÈÝÐí 256  ¸ö´ÅÇø£¯´Å¹ì, 65536 ¸ö´Å´ØÒÔ¼° 16 ¸ö´ÅÍ·£®Ëü×Ô¼º±¾Éí¿ÉÒÔ´æÈ¡ 2\^{}37 = 137438953472  ¸öÎ»Ôª×é(128 GB), µ«ÊÇ¼ÓÉÏ BIOS ·½Ãæ 63 ¸ö´ÅÇøÓë 1024 ¸ö´Å´ØµÄÏÞÖÆááÖ»Ê£ 528482304 ¸öÎ»Ôª×é(504 MB)¿ÉÒÔ¶¨Ö·µÄµ½£®

Õâ²»×ãÒÔÓ¦¸¶ÏÖ½ñµÄ´Åµú, ÈËÃÇÊ¹ÓÃ¸÷ÖÖÓ²Ìå»òÈíÌåÉÏµÄ·½·¨À´¿Ë·þ£®






\section{×ª»»Óë´Åµú¹ÜÀí³ÌÊ½}

Ã»ÓÐÈË¶Ô´ÅµúµÄ'ÕæÊµ' geometry ÓÐÐËÈ¤£®´Å¹ìµÄ´ÅÇøÊýÍ¨³£ÊÇ±ä¶¯µÄ - ½Ó½ü´ÅµúÍâÎ§µÄ´Å¹ìÓÐ±È½Ï¶àµÄ´ÅÇø -  ËùÒÔÃ»ÓÐ'ÕæÊµ'µÄÃ¿´Å¹ì´ÅÇøÊý£®
¶Ôì¶Ê¹ÓÃÕß¶øÑÔ×îºÃÊÇ°Ñ´Åµúµ±×÷±àºÅ 0,1,..., µÄ´ÅÇø×éºÏ³ÉµÄÏßÐÔÕóÁÐ, ÈÃ¿ØÖÆÆ÷È¥ÕÒ³ö´ÅÇø¾¿¾¹Î»ì¶´ÅµúµÄÄÇÀï£®

´ËÏßÐÔ±àºÅÒ»°ãÍ¨³ÆÎª LBA£®¶Ôì¶ geometry Îª (C,H,S)  µÄ´Åµú¶øÑÔÊô(c,h,s) µÄÏßÐÔÎ»Ö·Îª c*H*S+h*S+(s-1)£®ËùÓÐ SCSI ¿ØÖÆÆ÷¶¼Ê¹ÓÃ LBA, Ä³Ð© IDE  ¿ØÖÆÆ÷Ò²ÊÇ£®

Èç¹û BIOS °ÑÕâ 24 ¸öÎ»Ôª(c,h,s) ×ª»»³É LBA  ²¢¡õ¸ø¶®µÃ LBA  µÄ¿ØÖÆÆ÷, ÄÇ÷áÓÖ¿ÉÒÔ¶¨Ö·µ½ 7.875 GB £®²¢²»×ãÒÔÓ¦¸¶ËùÓÐµÄ´Åµú, µ«ÈÔÈ»ÊÇ¸ö¸Ä½ø£®×¢Òâ´Ë´¦ BIOS Ê¹ÓÃµÄ CHS, Ëü²»ÔÙÓë'ÊµÌå'ÓÐÈÎºÎ¹ØÏµ£®

µ±¿ØÖÆÆ÷²»¶®ºÎÎª LBA  µ«ÊÇ BIOS ÖªµÀÈçºÎ×ª»»Ê±ÓÐÐ©ÀàËÆµÄ·½·¨¿ÉÐÐ£®(ÔÚ BIOS Éè¶¨ÖÐÍ¨³£³ÆÎª 'Large'£®)ÏÖÔÚ BIOS ½«³ÊÏÖ geometry Îª(C',H',S')¸ø×÷ÒµÏµÍ³, ¶øÔÚÓë´Åµú¿ØÖÆÆ÷¹µÍ¨Ê±ÔòÊ¹ÓÃ(C,H,S)£®
Í¨³£ S=S', C'=C/N  ¶ø H'=H*N,  ÆäÖÐ N  ÊÇÈ·±£ C'{$<$}=1024 Ö® 2  µÄ×îÐ¡´Î·½(ËùÒÔ C'=C/N Ê±ÉáÈ¥µÄÊýÀË·ÑÉÙÐíÈÝÁ¿)£®ÔÙÒ»´Î, ÕâÔÊÐí´æÈ¡×î¶à´ï 7.875 GB£®

Èç¹û BIOS ²»ÖªµÀ 'Large'  »òÊÇ 'LBA', ÄÇ÷á»¹ÊÇÓÐÈíÌåµÄ½â¾ö·½°¸£®ÏñÊÇ OnTracker  »ò EZ-Drive ÕâÐ©¸ö´Åµú¹ÜÀí³ÌÊ½»áÒÔËüÃÇ×Ô¼ºµÄº¯Ê½(routines)Ìæ»»µô BIOS µÄ£®
Í¨³£ÕâÊÇ½åÓÉ½«´Åµú¹ÜÀí³ÌÊ½·ÅÔÚ MBR  ¼°Æäáá¼¸¸ö´ÅÇø(OnTrack ³ÆÕâÐ©³ÌÊ½ÂëÎª DDO: Dynamic Drive Overlay )À´´ï³ÉµÄ, ËùÒÔËü»áÔÚÈÎºÎÆäËü×÷ÒµÏµÍ³Ö®Ç°±»Æô¶¯£®
ÕâÒ²¾ÍÊÇÎªÊ²÷áÔÚ°²×°´Åµú¹ÜÀí³ÌÊ½áá´ÓÈíµúÆô¶¯¿ÉÄÜ»á³öÎÊÌâ£®

ÕâÓ°Ïì¿ÉÄÜ¶àì¶»òÉÙì¶ BIOS ×ª»» -  µ«ÌØ±ðÊÇÔÚÏàÍ¬µÄ´ÅµúÉÏÅÜÊýÖÖ²»Í¬µÄ×÷ÒµÏµÍ³Ê±, ´Åµú¹ÜÀí³ÌÊ½¿ÉÄÜÒýÆðÐí¶àÎÊÌâ£®

Linux ´Ó 1.3.14 °æ¿ªÊ¼Ö§Ô® OnTrack  ´Åµú¹ÜÀí³ÌÊ½, ´Ó 1.3.29 ¿ªÊ¼
Ö§Ô® EZ-Drive £®ÏÂÃæÓÐÐ©¸ü½øÒ»²½µÄ×ÊÑ¶£®






\section{ºËÐÄµÄ IDE ´Åµú×ª»»}

Èç¹û Linux  Õì²âµ½ IDE  ´ÅµúÉÏÓÐÄ³Ð©´Åµú¹ÜÀí³ÌÊ½´æÔÚ, Ëü½«»áÊÔÖøÊ¹ÓÃÓë¸Ã´Åµú¹ÜÀí³ÌÊ½ÏàÍ¬µÄ·½Ê½À´ÖØÐÂ¶ÔÓ¦´Åµú, ËùÒÔ Linux  ¿´µ½Óë, ÀýÈç DOS  ÅäºÏ OnTrack  »òÊÇ EZ-Drive ÏàÍ¬µÄ´Åµú·Ö¸î£®
È»¶ø, µ±ÄãÔÚÖ¸ÁîÁÐÉÏÖ¸¶¨ geometry Ê±, ¾Í²»»á×öÈÎºÎµÄÖØÐÂ¶ÔÓ¦ -  ËùÒÔÒ»ÐÐ `{\ttfamily hd=}{\itshape cyls\/}{\ttfamily ,}{\itshape heads\/}{\ttfamily ,}{\itshape secs\/}' Ö¸ÁîÁÐÑ¡Ïî¿ÉÄÜÈ¡ÏûµôÓë´Åµú¹ÜÀí³ÌÊ½µÄÏàÈÝ£®

´ËÖØÐÂ¶ÔÓ¦µÄ·½Ê½ÊÇ³¢ÊÔ 4,8,16,32,64,128,255 ´ÅÍ·Êý(H*C ±£³Ö²»±ä)Ö±µ½ C $<$= 1024  »òÊÇ H = 255£®

Ï¸½ÚÈçÏÂ -  Ð¡½ÚµÄÌ§Í·ÊÇ³öÏÖÔÚÏà¶ÔÓ¦Ö®Æô¶¯Ñ¶Ï¢ÀïµÄ×Ö´®£®ÔÚ´ËÒÔ¼°ÔÚÕâ·ÝÎÄ¼þÈÎºÎÆäËüµØ·½ÖÐ·Ö¸îµÄÐÍÌ¬¶¼ÒÔÊ®Áù½øÎ»Êý×Ö±íÊ¾£®




\subsection{EZD}

Õì²âµ½ EZ-Drive , ÒòÎªµÚÒ»¸öÖ÷Òª·Ö¸îÇøÐÍÌ¬Îª 55 £®ÈçÉÏÊöÖØÐÂ¶ÔÓ¦ geometry, ÇÒºöÂÔ´ÓµÚ 0  ´ÅÇø¶ÁÈëµÄ·Ö¸î±í -  ÒÔµÚ 1  ´ÅÇøµÄ·Ö¸î±íÈ¡´ú£®´ÅµúµÄÇø¿éºÅÂë(block numbers) Ã»ÓÐ¸Ä±ä, µ«¶Ô´ÅÇø 0  µÄÐ´Èë»á×ªÏò´ÅÇø 1£®´Ë¶¯×÷¿ÉÒÔ½åÓÉÐÞ¸ÄÔÚ {\itshape ide.c\/} ÖÐµÄ
\begin{tscreen}
{\ttfamily  \#define FAKE\_FDISK\_FOR\_EZDRIVE  0 }
\end{tscreen}

²¢ÖØÐÂ±àÒëºËÐÄÀ´¸Ä±ä£®




\subsection{DM6:DDO}

Õì²âµ½ OnTrack DiskManager(ÔÚµÚÒ»¸ö´ÅµúÉÏ), ÒòÎªµÚÒ»¸öÖ÷Òª·Ö¸îÇøÐÍÌ¬Îª 54 £®ÈçÉÏÊöÖØÐÂ¶ÔÓ¦ geometry ¶øÇÒÕû¸ö´ÅµúÆ½ÒÆ 63 ¸ö´ÅÇø£®
(ËùÒÔ¾ÉµÄ´ÅÇø 63 ±ä³É´ÅÇø 0)È»áá´ÓÐÂµÄµÚ 0  ´ÅÇø¶ÁÈëÐÂµÄ MBR (Óë·Ö¸î±í)£®´ËÆ½ÒÆµ±È»ÊÇÎª DDO Áô¿Õ¼ä -  ÕâÒ²¾ÍÊÇÎªÊ²÷áÆäËü´Åµú²»±ØÆ½ÒÆ£®




\subsection{DM6:AUX}

Õì²âµ½ OnTrack DiskManager(ÔÚÆäËü´ÅµúÉÏ), ÒòÎªµÚÒ»¸öÖ÷Òª·Ö¸îÇøÐÍÌ¬Îª 51 »ò 53£®ÈçÉÏÊöÖØÐÂ¶ÔÓ¦ geometry £®




\subsection{DM6:MBR}

Õì²âµ½Ä³¾É°æµÄ OnTrack DiskManager, ²¢·Ç½åÓÉ·Ö¸îÇøÐÍÌ¬, ¶øÊÇÇ©Ãû(signature)£®(²âÊÔÔÚ MBR  ÀïµÚ 2,3  Î»Ôª×éµÄÆ«ÒÆÖµÊÇ·ñ²»´óì¶ 430, ¶øÇÒÔÚ´ËÆ«ÒÆÎ»Ö·ÕÒµ½µÄ short µÈì¶ 0x55AA, ááÃæ²¢¸úÖøÒ»¸öÆæÊýµÄÎ»Ôª×é) ÔÙÒ»´ÎÈçÉÏÊöÖØÐÂ¶ÔÓ¦ geometry £®




\subsection{PTBL}

×îáá, ºËÐÄ»á³¢ÊÔ´ÓÖ÷·Ö¸îÇøµÄ {\ttfamily start} ÒÔ¼° {\ttfamily end} ÖµÍÆ¶Ï×ª»»·½Ê½: ÈôÄ³Ð©·Ö¸îÇøµÄ {\ttfamily start} ÒÔ¼° {\ttfamily end} ´Å´ØÐ¡ì¶ 256, ¶øÇÒ {\ttfamily start} ÒÔ¼° {\ttfamily end} ´ÅÇøºÅÂë·Ö±ðÎª 1  ºÍ 63 , ¶øÇÒ end  ´ÅÍ·Îª 31, 63,  »ò 127, ÄÇ÷á, ÒòÎªÒÀ¹ßÀý·Ö¸îÇø»áÔÚ´Å´Ø±ß½ç½áÊø, ¶øÇÒ¸üÒòÎª IDE  ½éÃæ×î¶àÊ¹ÓÃ 16  ¸ö´ÅÍ·, ¹ÊÍÆ²âÓÐ¿ªÆô BIOS ×ª»», ·Ö±ðÊ¹ÓÃ 32, 64 »ò 128  ´ÅÍ·ÊýÖØÐÂ¶ÔÓ¦ geometry£®
(Ò²ÐíÕâÀïÓÐµãè¦´Ã,  {\itshape genhd.c\/} ²»Ó¦¸Ã²âÊÔ´Å´ØºÅÂëÇ°Á½¸öÎ»ÔªÂð?)ÎÞÂÛÈçºÎ, µ±Ä¿Ç°µÄ geometry ÒÑ¾­ÎªÃ¿´Å¹ì 63 ¸ö´ÅÇøÇÒÖÁÉÙÕâ÷á¶à´ÅÍ·Ê±, ²»»á×öÖØÐÂ¶ÔÓ¦ (ÒòÎªÕâ¿ÉÄÜÒâÎ½ÖøÖØ¶ÔÓ¦ÒÑÍê³É)£®




\section{½áÂÛ}

Õâµ½µ×ÒâÎ½ÖøÊ²÷á? ¶Ô Linux  µÄÊ¹ÓÃÕß¶øÑÔÖ»ÓÐÒ»¼þÊÂ: ¾ÍÊÇËûÃÇ±ØÐëµÃÈ·±£ LILO ÒÔ¼° fdisk  Ê¹ÓÃÕýÈ·µÄ geometry , ÆäÖÐ'ÕýÈ·'µÄ¶¨Òå¶Ô fdisk ¶øÑÔÊÇÓëÆäËüÔÚÍ¬Ò»¸ö´ÅµúÉÏµÄ×÷ÒµÏµÍ³ËùÊ¹ÓÃµÄ geometry ÏàÍ¬, ¶ø¶Ô LILO ¶øÑÔÊÇÄÜ¹»ÔÚÆô¶¯Ê±ÆÚ³É¹¦µØÓë BIOS ½»Ì¸µÄ geometry£®(ÕâÁ½ÕßÍ¨³£Ïà·û£®)

fdisk ÈçºÎµÃÖª¸Ã geometry ? ËüÑ¯ÎÊºËÐÄ, Ê¹ÓÃ {\ttfamily HDIO\_GETGEO} ioctl£®µ«Ê¹ÓÃÕß¿ÉÒÔ½»Ì¸Ê½µØ»òÔÚÖ¸ÁîÁÐÉÏÖØ¶¨ geometry£®

LILO  ÈçºÎµÃÖª¸Ã geometry ? ËüÑ¯ÎÊºËÐÄ, Ê¹ÓÃ {\ttfamily HDIO\_GETGEO} ioctl£®
µ«Ê¹ÓÃÕß¿ÉÒÔÓÃ `{\ttfamily disk=}' Ñ¡ÏîÖØ¶¨£®Ò²¿ÉÒÔ¸ø LILO Ò»¸ö {\ttfamily linear} Ñ¡Ïî, Èç´ËËü½«ÔÚÆä map  µµÖÐ´¢´æ LBA  Î»Ö·ÒÔÈ¡´ú CHS  Î»Ö·, ²¢ÇÒÔÚÆô¶¯Ê±ÆÚÕÒ³ö¸Ã geometry À´Ê¹ÓÃ(½åÓÉ INT 13 ¹¦ÄÜºô½Ð 8 À´Ñ¯ÎÊ´ÅµúµÄ geometry)£®

ºËÐÄÈçºÎÖªµÀ¸ÃÔõ÷á»Ø´ð? Ê×ÏÈ, Ê¹ÓÃÕß¿ÉÄÜÒÔ `{\ttfamily hd=}{\itshape cyls\/}{\ttfamily ,}{\itshape heads\/}{\ttfamily ,}{\itshape secs\/}' Ö¸ÁîÁÐÑ¡ÏîÃ÷È·µØÖ¸¶¨ geometry, ·ñÔòºËÐÄ½«Ñ¯ÎÊÓ²Ìå£®




\subsection{IDE Ï¸½Ú}

ÈÃÎÒÏêÏ¸ËµÃ÷£®IDE Çý¶¯³ÌÊ½ÓÐËÄ¸ö¹Øì¶ geometry µÄ×ÊÑ¶À´Ô´£®µÚÒ»¸ö(G\_user)ÊÇÊ¹ÓÃÕßÔÚÖ¸ÁîÁÐÉÏËùÖ¸¶¨µÄ£®
µÚ¶þ¸ö(G\_bios)ÊÇ BIOS µÄ¹Ì¶¨´Åµú²ÎÊý±í(Ö»ÓÃì¶µÚÒ»¼°µÚ¶þ¸ö´Åµú), ÔÚÏµÍ³Æô¶¯Ê±, ÇÐ»»ÖÁ 32 Î»ÔªÄ£Ê½Ö®Ç°¶ÁÈë£®
µÚÈý¸ö(G\_phys)¼°µÚËÄ¸ö(G\_log) ÊÇÓÉ IDE  ¿ØÖÆÆ÷´«»Ø, ×÷Îª¶Ô IDENTIFY Ö¸ÁîµÄ»ØÓ¦ -  ËüÃÇÊÇ 'ÊµÌåµÄ' ÒÔ¼° 'Ä¿Ç°Âß¼­ÉÏµÄ' geometries£®

ÁíÒ»·½Ãæ, ¶Ôì¶ geometry Çý¶¯³ÌÊ½ÐèÒªÁ½¸öÖµ: ÆäÖÐÖ®Ò»ÊÇ G\_fdisk, ÓÉ {\ttfamily HDIO\_GETGEO} ioctl  ´«»Ø, ÁíÒ»¸öÊÇ G\_used , ÕâÊÇÖ´ÐÐÊä³ö£¯ÈëÊ±Êµ¼ÊÊ¹ÓÃµÄ£®
Èç¹û¸ø¶¨ G\_user Ôò G-fdisk  ÒÔ¼° G\_used Á½Õß¶¼»áÉèÎª G\_user, µ±´Ë×ÊÑ¶ÊÇ¸ù¾Ý CMOS ËùÌá¹©Ê±ÔòÉèÎª G\_bios , ÆäËüÇéÐÎÉèÎª G\_phys£®Èç¹û G\_log  ¿´ÆðÀ´ºÏÀíÔò G\_used ¾ÍÉèÎª G\_log£®
²»È», Èç¹û G\_used  ²»ºÏÀí¶ø G\_phys ¿´ÆðÀ´ºÏÀíÄÇ÷á G\_used ¾ÍÉèÎª G\_phys£®´Ë´¦µÄ'ºÏÀí'´ú±í´ÅÍ·ÊýÔÚ 1-16 µÄ¡õÎ§ÄÚ£®

»»¸ö·½Ê½Ëµ: Ö¸ÁîÁÐÑ¡Ïî´óì¶ BIOS , ²¢ÇÒ¾ö¶¨ fdisk  ¿´µ½µÄÑù×Ó, µ«Èç¹ûËüÖ¸¶¨×ª»»µÄ geometry(´ÅÍ·Êý´óì¶ 16),  ÔòºËÐÄ»á½åÓÉ IDENTIFY Ö¸ÁîµÄÊä³öÖØ¶¨Ëü£®




\subsection{SCSI Ï¸½Ú}

ÔÚ SCSI ·½ÃæÇé¿öÓÐÒ»µãµã²»Í¬, ÒòÎª SCSI Ö¸ÁîÒÑ¾­Ê¹ÓÃÂß¼­Çø¿éºÅÂë, ËùÒÔ 'geometry' ¶ÔÊµ¼ÊµÄÊä³ö£¯ÈëÍêÈ«Ã»¹ØÏµ£®
È»¶ø, ·Ö¸îÇøµÄ¸ñÊ½ÈÔÈ»ÊÇÏàÍ¬µÄ, ËùÒÔ fdisk  ±ØÐëµÃÄóÔìÐ© geometry , ²¢ÇÒÒ²ÔÚ´ËÊ¹ÓÃ {\ttfamily HDIO\_GETGEO} - ÕæµÄ, fdisk ²»»á·Ö±æ IDE  ÒÔ¼° SCSI ´Åµú£®
Äã¿ÉÒÔ´ÓÏÂÃæµÄÏêÏ¸ÃèÊö¼ûµ½¸÷ÖÖÇý¶¯³ÌÊ½ÄóÔìÒ»Ð©¸ö²»Í¬µÄ geometry £®ÕæÊÇ, Ò»ÍÅ»ìÂÒ£®

Èç¹ûÄãÃ»ÓÐÊ¹ÓÃ DOS  »òÕâÀàÏµÍ³, ÄÇ÷á±ÜÃâÊ¹ÓÃËùÓÐ¶îÍâµÄ×ª»»Éè¶¨, ¿ÉÄÜµÄ»°, ¾¡¹ÜÊ¹ÓÃ 64 ´ÅÍ·, Ã¿´Å¹ì 32 ´ÅÇø (Á¼ºÃµÄ, ·½±ãÃ¿´Å´Ø 1 MB), Èç´Ëµ±Äã°Ñ´Åµú´ÓÒ»¸ö¿ØÖÆÆ÷»»µ½ÁíÒ»¸öÈ¥Ê±²»»áÓöµ½ÈÎºÎÎÊÌâ£®
Ä³Ð© SCSI ´ÅµúÇý¶¯³ÌÊ½ (aha152x,pas16,ppa,qlogicfas,qlogicisp)·Ç³£ÔÚÒâÓë DOS  µÄÏàÈÝÐÔ¶ø²»ÔÊÐíÖ»ÓÐ Linux  µÄÏµÍ³Ê¹ÓÃ³¬¹ý  8 GB µÄÈÝÁ¿, ÕâÊÇÖ»³ô¡õ£®

ÕæÊµµÄ geometry ÊÇÊ²÷á? ×î¼òµ¥µÄ´ð°¸ÊÇÃ»ÓÐÕâÖÖ¶«Î÷£®Èç¹ûÕæÓÐµÄ»°, Äã²»»áÏëÖªµÀ, ¶øÇÒµÄµÄÈ·È·´Ó²», ÓÀ²»Ðè¸æËß fdisk  »òÊÇ LILO »òºËÐÄÓÐ¹ØËüµÄÊÂ£®Õâ¾ø¶ÔÊÇ SCSI ¿ØÖÆÆ÷Óë´ÅµúÖ®¼äµÄÊÂ£®
ÈÃÎÒÖØ¸²Õâ¾ä»°: Ö»ÓÐ´Àµ°»á¸æËß fdisk/LILO/Kernel SCSI ´ÅµúÕæÊµµÄ geometry £®

µ«Èç¹ûÄãºÃÑ§ÇÒ¼á³Ö, ¿ÉÒÔÎÊ´Åµú»ú×Ô¼º£®ÓÐ¸öÖØÒªÖ¸Áî READ CAPACITY ½«»á´«»Ø´ÅµúµÄ×ÜÈÝÁ¿, ¶øÇÒÓÐ¸ö MODE SENSE Ö¸Áî  Rigid Disk Drive Page(page 04) »á´«»Ø´Å´ØÒÔ¼°´ÅÍ·µÄÊýÄ¿(ÕâÊÇ²»ÄÜ¸Ä±äµÄ×ÊÑ¶), ¶øÔÚ Format Page(page 03)ÓÐÃ¿´ÅÇøµÄÎ»Ôª×é, ÒÔ¼°Ã¿´Å¹ìµÄ´ÅÇøÊý£®
ÕâÊý×ÖÒ»°ãÓë notch  ÓÐ¹Ø, ¶øÇÒÃ¿´Å¹ìµÄ´ÅÇøÊýÊÇ±ä¶¯µÄ -  ÍâÎ§µÄ´Å¹ìÓµÓÐ±ÈÄÚÈ¦´Å¹ì¶àµÄ´ÅÇø£®Linux ³ÌÊ½ scsiinfo »á¸øÓèÕâÏî×ÊÑ¶£®
ÆäÖÐÓÐÐí¶à·±ËöµÄÏ¸½Ú, ¶øÇÒºÜÃ÷°×µÄ, Ã»ÓÐÈË(Ò²ÐíÉõÖÁÊÇ×÷ÒµÏµÍ³)ÐèÒªÊ¹ÓÃÕâÏî×ÊÑ¶£®
»¹ÓÐ, ÒòÎªÎÒÃÇÖ»¹ØÐÄ fdisk  ÒÔ¼° LILO , Ò»°ãµÃµ½µÄ»Ø´ðÏñ C/H/S=4476/27/171 - ÕâÑùµÄÖµ fdisk  ¸ù±¾²»ÄÜÊ¹ÓÃ, ÒòÎª·Ö¸î±íÖ»±£Áô 10resp. 8resp. 6 bits  ¸ø C/H/S£®

ÄÇºËÐÄÖ® {\ttfamily HDIO\_GETGEO} ´ÓºÎ´¦È¡µÃÆä×ÊÑ¶? àÅ, ²»ÊÇ´Ó SCSI ¿ØÖÆÆ÷, ¾ÍÊÇÍÆÂÛ²Â²â£®
ÓÐÐ©Çý¶¯³ÌÊ½ËÆºõÈÏÎªÎÒÃÇÏëÖªµÀ 'ÕæÏà' , µ«ÎÒÃÇµ±È»Ö»ÏëÖªµÀ DOS  »ò OS/2 FDISK (»ò Adaptec AFDISK µÈµÈ)ËùÓÃµÄ£®

×¢Òâ, Linux fdisk ÐèÒª´ÅÍ·Êý H  ÒÔ¼°Ã¿´Å¹ì´ÅÇøÊý S  ÒÔ±ã×ª»» LBA ´ÅÇøºÅÂë³ÉÎª c/h/s  Î»Ö·, µ«´Å´ØÊý C  ÔÚ´Ë×ª»»ÖÐ²¢Î´°çÑÝÊ²÷á½ÇÉ«£®
ÓÐÐ©Çý¶¯³ÌÊ½Ê¹ÓÃ (C,H,S) = (1023,255,63)  À´±íÊ¾´ÅµúÈÝÁ¿ÖÁÉÙÎª 1023*255*63 ¸ö´ÅÇø£®ÕâÊÇ²»ÐÒµÄ, ÒòÎªÕâ²»ÄÜÏÔÊ¾Êµ¼ÊµÄ´óÐ¡, ¶øÇÒ½«ÏÞÖÆ´ó²¿·Ý°æ±¾Ö® fdisk  µÄÊ¹ÓÃÕßÆä´Åµú×î´óµ½ 8 GB - ÏÖ½ñÊµ¼ÊµÄÏÞÖÆ£®

ÔÚÏÂÃæµÄÃèÊöÖÐ, M ±íÊ¾´ÅµúµÄÈ«²¿ÈÝÁ¿, ¶ø C,H,S  ÊÇ´Å´Ø, ´ÅÍ·ÒÔ¼°Ã¿´Å¹ì´ÅÇøÊý£®Èç¹ûÎÒÃÇ°Ñ C  µ±×÷ M/(H*S) ÄÇ¸ø H,S ¾Í¿ÉÒÔÂú×ã£®

ÒÀÔ¤Éè, H=64, S=32.

\begin{description}
\item[aha1740, dtc, g\_NCR5380, t128, wd7000:] \mbox{}

H=64, S=32.



\item[aha152x, pas16, ppa, qlogicfas, qlogicisp:] \mbox{}

H=64, S=32 ³ý·Ç C {$>$} 1024, ´ËÇé¿öÏÂ H=255, S=63, C = min(1023, M/(H*S)).
(¹Ê C ±»½Ø¶Ï, ÇÒ H*S*C ²»ÊÇ´ÅµúÈÝÁ¿µÄ½üËÆÖµ. Õâ½«»á»ìÒ¡Ïý´ó²¿·Ý°æ±¾µÄ fdisk.)
{\itshape ppa.c\/} ³ÌÊ½ÂëÊ¹ÓÃ M+1 È¡´ú M ²¢ÈÏÎªÕâÊÇÒòÎªÔÚ {\itshape sd.c\/} ÀïµÄÒ»Ö»³ô¡õÊ¹ M µÄÖµÉÙÒ»£®



\item[advansys:] \mbox{}

H=64, S=32 ³ý·Ç C $>$ 1024 ¶øÇÒ»¹¿ªÆô BIOS ÖÐµÄ `$>$ 1 GB' Ñ¡Ïî, ´ËÇé¿öÏÂ
H=255, S=63.



\item[aha1542:] \mbox{}

Ñ¯ÎÊ¿ØÖÆÆ÷Ê¹ÓÃÁ½ÖÖ¿ÉÄÜµÄ schemes ÖÐµÄÄÇÒ»ÖÖ, ²¢ÇÒÊ¹ÓÃ H=255, S=63 »ò
H=64, S=32. Ç°ÕßÓÐ¸öÆô¶¯Ñ¶Ï¢ "aha1542.c: Using extended bios translation".



\item[aic7xxx:] \mbox{}

H=64, S=32 ³ý·Ç C $>$ 1024, ¶øÇÒ»¹¸øÁË "extended" Æô¶¯²ÎÊý, »òÔÚ SEEPROM »ò BIOS
ÉèÁË `extended' Î»Ôª, ´ËÇé¿öÏÂ H=255, S=63.



\item[buslogic:] \mbox{}

H=64, S=32 ³ý·Ç C $>$= 1024, ¶øÇÒ»¹Æô¶¯¿ØÖÆÆ÷µÄÀ©³ä×ª»», ´ËÇé¿öÏÂÈô M $<$
2\^{}22 Ôò H=128, S=32; ·ñÔò H=255, S=63. È»¶ø, Ñ¡Ôñ (C,H,S) Ö®áá, ¶ÁÈë·Ö¸î±í,
ÈôÈýÖÖ¿ÉÄÜµÄ (H,S) = (64,32), (128,32), (255,63) ÖÐ endH=H-1
µÄÖµ¿´À´¿ÉÐÐÔòÊ¹ÓÃ¸Ã¶Ô (H,S) , ²¢Ó¡³öÆô¶¯Ñ¶Ï¢ "Adopting Geometry from Partition Table".



\item[fdomain:] \mbox{}

´Ó BIOS Drive Parameter Table ÕÒ³ö geometry ×ÊÑ¶, »ò´Ó·Ö¸î±í¶ÁÈ¡²¢Ê¹ÓÃ H=endH+1,
S=endS ¸øµÚÒ»¸ö·Ö¸îÇø, Èô·Ç¿Õ, »òÊ¹ÓÃ H=64, S=32 for M $<$ 2\^{}21 (1 GB), H=128, S=63 for M $<$
63*2\^{}17 (3.9 GB) and H=255, S=63 otherwise.



\item[in2000:] \mbox{}

Ê¹ÓÃ (H,S) = (64,32), (64,63), (128,63), (255,63) ÖÐµÚÒ»¸öÈÃ C $<$= 1024 µÄ.
´ËÇé¿öÏÂ, ÔÚ 1023 ½Øµô C .



\item[seagate:] \mbox{}

´Ó´Åµú¶ÁÈ¡ C,H,S. (Õæ³ÏÊµ!) Èç¹û C »ò S Ì«´ó, ·ÅÈë S=17, H=2 ²¢±¶Ôö H Ö±µ½
C $<$= 1024. Õâ±íÊ¾ H ½«Îª 0 Èç¹û M $>$ 128*1024*17 (1.1 GB). ÕâÊÇÖ»³ô¡õ.



\item[ultrastor and u14\_34f:] \mbox{}

ÈýÖÖ¶ÔÓ¦Ö®Ò» ((H,S) = (16,63), (64,32), (64,63)) ¸ù¾Ý¿ØÖÆÆ÷µÄ¶ÔÓ¦Ä£Ê½¶ø¶¨.



\end{description}

Èç¹ûÇý¶¯³ÌÊ½Ã»ÓÐÖ¸¶¨ geometry , ÎÒÃÇ¾Í»Øµ½Ê¹ÓÃ·Ö¸î±í»ò´Åµú×ÜÈÝÁ¿À´ÍÆ¶Ï²Â²â£®

×ÐÏ¸¿´¿´·Ö¸î±í£®ÒòÎªÒÀ¹ßÀý·Ö¸îÇøÔÚ´Å´Ø±ß½ç½áÊø, ÎÒÃÇ¿ÉÒÔÎªÈÎºÎ·Ö¸îÇø¶¨ end=(endC,endH,ednS) , Ö»Òª·ÅÈë H = {\ttfamily endH+1} ¼° S = {\ttfamily endS}£®
(¼ÇµÃ´ÅÇøÓÉ 1 ÆðËã£®)¸üÃ÷È·µØµÄËµ£®Èç¹ûÓÐ¸ö²»ÊÇ¿ÕµÄ·Ö¸îÇø, ÔòÒÔ×î´óµÄ {\ttfamily beginC} ¼Æ£®
¶Ôì¶´Ë·Ö¸îÇø, ¿´¿´ {\ttfamily end+1}, ¼ÆËã¼ÓÉÏ {\ttfamily start} ÒÔ¼° {\ttfamily length} ²¢ÇÒ¼ÙÉè´Ë·Ö¸îÇøÔÚÄ³´Å´Ø±ß½ç½áÊø£®
Èç¹ûÁ½¸öÖµ¶¼Ïà·û, »ò {\ttfamily endC} = 1023 ÇÒ {\ttfamily start+length} ÊÇ {\ttfamily (endH+1)*endS}  µÄ±¶Êý, ÄÇ÷á¼Ù¶¨´Ë·Ö¸îÇøÕæµÄÊÇÔÚ´Å´Ø±ß½ç, ²¢·ÅÈë H = {\ttfamily endH+1} ÒÔ¼° S = {\ttfamily endS}£®
Èç¹û²»¶Ô, ²»ÊÇÒòÎªÃ»ÓÐ·Ö¸îÇø, ¾ÍÊÇÒòÎªËüÃÇµÄ´óÐ¡ºÜÆæ¹Ö, ÄÇ÷áÖ»¿´´ÅµúÈÝÁ¿ M£®
ÑÝËã·¨: ·ÅÈë H = M/(62*1024)(ÎÞÌõ¼þ½øÎ»),S = M/(1024*H)(ÎÞÌõ¼þ½øÎ»), C = M/(H*S)(ÎÞÌõ¼þÉáÈ¥)£®ÕâÄÜ²úÉúÒ» (C,H,S) ÆäÖÐ C ×î´ó 1024 ¶ø S ×î´ó 62£®



\end{document}
