Você está na página 1de 21

Large Disk HOWTO

Andries Brouwer, aeb@cwi.nl


v2.2m, 15 2000
1024
. --- , ,

: panos@panos.uklinux.net
1.
1024 .
INT13 BIOS
/ . ,
10-bit
/, 1024 .
, Linux BIOS, .
, :
(1) , Linux
BIOS.
LILO .
(2)
. ,
Linux , , DOS ,
.
Linux fdisk.
.
2.0.8 .
.
2.
. ;
: fdisk (, , cfdisk)
, mke2fs
, mount
.
:
HOWTO
.

fdisk expert mode,
LILO .
, : () ,
() , , ()
.
. 2.3.21
.
:

SCSI: Linux .
.
IDE ( 8.4GB):
(2.0.34 ). ,
BIOS LBA .
IDE ( 33.8 GB): ``IDE
34+ GB '' .
LILO , linear
etc/lilo.conf

/LILO/fdisk.
fdisk ``''
: , cfdisk
.
,
``'',
df

.
, ,
.
3.
kilobyte (kB) 1000 bytes. megabyte (MB) 1000 kB.
gigabyte (GB) 1000 MB. terabyte (TB) 1000 GB.
SI . ,
1 MB=1024000 bytes 1.44 MB
1 MB=1048576 bytes.
standard Ki, Mi, Gi, Ti
, 1440 KiB (1.47 MB, 1.41 MiB), 1 MiB
1048576 bytes (1.05 MB), 1 GiB 1073741824 bytes (1.07 GB)
1 TiB 1099511627776 bytes (1.1 TB).
, SI
. ,
Linux fdisk MB GB
, - . ,

,
( bytes).
,
Knuth ,
KKB, MMB, GGB, TTB, PPB, EEB, ZZB, YYB
kilobyte, megabyte, ... yottabyte. `

. , ` gigabyte'
`gibibyte'.
megabyte 1000000 bytes,
.

3.1.
512 bytes.
, MO 2048 bytes,

. ( fdisk ,
2.9i ,
`-b 2048'.)

3.2.
C , S
C*H*S C*H*S*512 bytes.
, C/H/S=4092/16/63
4092*16*63=4124736 4124736*512=2111864832 bytes
(2.11 GB). , C/H/S=16383/16/63
8.4 GB,
C/H/S .
4.
,
, .
SCSI,
SCSI . IDE
LBA, . RLL
MFM IDE -LBA ,
(, , ) .
3D
: C , H S /
(c,h,s) 3D CHS c*H*S + h*S + (s-1)
LBA. (
1, 0 3D).
, o -SCSI ,
, , C, H S.
4.1. BIOS 1024
Linux BIOS,
. BIOS, LBA,
INT13 (c,h,s) . (: AH
, CH 8 bits
, CL bits 7-6 bits
bits 5-0 , DH
, DL (80h
81h). .)
, CHS 3 bytes, 10 bits
, 8 bits 6 bits
(1-63).
0 1023 1024
BIOS.

DOS Windows IDE LBA


, DOS Windows
, /
, BIOS.
Linux BIOS
, .


INT13 ( 10+8+6=24 bits (c,h,s)
8.5 GB) BIOS
: Extended INT13 ,
DS:SI 16-byte Disk Address Packet
8 .
Microsoft
Extended INT13 . ,
.
4.2. BIOS IDE
ATA Specification ( IDE ) - 137 GB
65536 ( 0-65535), 16
( 0-15), 255 / ( 1-255)
267386880 (512 bytes ),
, 136902082560 bytes (137 GB).
( 1999), .
BIOS Int 13 - 8.5 GB
1024 (0-1023), 256 (0-255), 63
/ (1-63) 8455716864 bytes
(8.5 GB). .
DOS
.
528 MB
c,h,s BIOS Int 13 call
/ DE ,
1024
, 16 63 /
528482304 bytes (528MB), 504
MiB DOS BIOS. 1993
, (LBA), firmware
( BIOS) software ( ).
'' (1994): BIOS

, , DOS,
.
2.1 GB ( 1996)
BIOS 12 bits
CMOS RAM . ,
4095,
4095*16*63*512=2113413120 bytes .

. 4092/16/63
.

4092/16/63.
over2gb.htm.
3.2 GB
bug Phoenix 4.03 4.04 BIOS
CMOS setup
3227MB. over3gb.htm.
4.2 GB ( 1997)
BIOS (ECHS=Extended CHS,
`Large disk support' `Large')

DOS,
1024. DOS Windows
95 256 ,
16 ,

8192*16*63*512=4227858432 bytes ( 1024
, 128 , 63 /).
ECHS ,
63, .
over4gb.htm.
7.9 GB
BIOS
15 (`revised ECHS'),
240 ,
1024*240*63*512=7927234560 bytes.
8.4 GB
, BIOS ,
, 255 63 /
(`assisted LBA' or just `LBA')
1024*255*63*512=8422686720 bytes,
8.5 GB, 256
. (
16, 32, 64, 128,
255
1024*H*63*512, C
(H*63*512).)
The 33.8 GB limit (August 1999)
33.8 GB.
16 63/
65535,
short . BIOS
. ( Asus upgrades
.) 2.2.14 / 2.3.21
patch. ``IDE 34+ GB ''
.
Breaking the Barriers
, , IDE Hard Drive Capacity Barriers.
8.4 GB

16383/16/63. ''
.
5.
, BIOS 0 (
MBR - Master Boot Record) ( CD-ROM)
- .

BIOS. Linux
1024 .
:
,
LILO)
1024 BIOS
- .

: , 10MB,
,
1024 .
/boot LILO , .

5.1. LILO `linear'


BIOS
. To LILO
,
,
LILO BIOS. ,
.
LILO `linear'.
LILO

. ;
: `linear' LILO
,
1024
.
5.2. bug LILO
LILO v21 :

: c*H 65536 ,
. 64
c c < 1024; , =255
LILO c < 258. (c=
, = ).
5.3. 1024 1024
Tim Williams : ` Linux
1024 . 1
GB '. ; SCSI

AHA2940UW H=64, S=32 (


1 MiB = 1.05 MB), H=255, S=63 ( 8.2 MB),
BIOS. BIOS
, 1024 1 GiB,
Linux LILO
8.4 GB.
6. , `'
,
.
.
MBR
() . 4 4
,
struct partition {
char active;
char begin[3];
char type;
char end[3];
int start;
int length;
};

/* 0x80: bootable, 0: not bootable */


/* CHS for first sector */
/* CHS for last sector */
/* 32 bit sector number (counting from 0) */
/* 32 bit number of sectors */

( CHS Cylinder/Head/Sector).
:
24-bit begin end,
32-bit start length.
Linux start length , ,
2^32 , ,
2 TiB. 100
, 8
. (, ,
ext2
32-bit
2 GiB.)
DOS begin end , BIOS
INT13 ,
8.4GB, BIOS . (
2.1 GB FAT16
). Windows 3.11 WfWG
Windows NT 3.* Novell NetWare.
Windows 95 Extended INT13,
(c, e, f b, 6, 5)
.
, begin end
(1023/255/63). Windows 95 OSR2 FAT32
( b or c),

2 TiB.
fdisk `'
, ;
'': begin end ,
DOS, . ( ,

1024 - '' 1024
.). , start length ,
Linux, Windows 95
c, e f, . ,
cfdisk
Linux. DOS.
cfdisk -Ps /dev/hdx cfdisk -Pt /dev/hdx
/dev/hdx.

7.
( , )
MFM RLL.
. , IDE SCSI,
`' . ,
:
`'
. : IDE INITIALIZE DRIVE PARAMETERS (91h)
/
.
2 15 16 BIOS, BIOS
255 .

0, 1, ...,
.
LBA.
: DOS, ,
BIOS, (c,h,s). BIOS LBA
.
LBA
. , (c',h',s')
.
`LBA':
`
= Linear Block Addressing' (
CHS). BIOS Setup,
` LBA = assisted
LBA' - ```'''.
LBA
BIOS . ( setup
`Large'.) BIOS (C,H,S)
(C',H',S') .
S = S', C = C'/N H = H'*N, e N
C' <= 1024 (
C' = C/N).
8.4 GB (7.8 GiB).

( setup `Normal',
.)
BIOS `Large' `LBA',
. OnTrack EZ-Drive
BIOS .

MBR ( OnTrack
DDO: Dynamic Drive Overlay),
.

.
- BIOS -

.
Linux OnTrack 1.3.14, EZ-Drive
1.3.29. .

8. IDE

IDE , ,
Linux ,
, DOS OnTrack EZ-Drive. ,
`hd=cyls,heads,secs'
.
4, 8, 16, 32, 64, 128, 255
( H*C ) C <= 1024 H = 255.
-
.
.
8.1. EZD
EZ-Drive
55.
0 - 1.
,
0 1.
#define
FAKE_FDISK_FOR_EZDRIVE 0 ide.c.
8.2. DM6:DDO
OnTrack DiskManager ( )
54.
63
( 63 0). ,
MBR ( )
0. DDO -

.
8.3. DM6:AUX
OnTrack DiskManager ( )
51 53.
.
8.4. DM6:MBR
OnTrack DiskManager
. (
2 3 bytes MBR
430, 055AA
byte). .
8.5. PTBL
,
start end :
1 63
31, 63, 127 254, ,
, , , IDE
16 , BIOS
32, 64, 128 255 .
,
63 63 (
).
9.
; Linux :
LILO fdisk
, fdisk
,
LILO BIOS
( ).
fdisk ; ,
HDIO_GETGEO ioctl, .
LILO ;
HDIO_GETGEO ioctl.
`disk=' /etc/lilo.conf ( lilo.conf(5)).
linear LILO,
LBA CHS ,
( INT 13 Function 8
).
; ' ,
`hda=cyls,heads,secs'
( bootparam(7)), boot
loader .
LILO
`append = "hda=cyls,heads,secs"' /etc/lilo.conf (

lilo.conf(5)). ,
BIOS .
( 2.1.79)
/proc.
# 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. LILO

`hda=cyls,heads,secs' .
secs=63,
heads. ( heads=16
heads=255.) cyls?
C*H*S .
, 71346240 (36529274880 bytes) C
71346240/(255*63)=4441 (
bc),
hdc=4441,255,63. ; ,
# 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

71346240.

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

() 34837*2048=71346176
() 70780*16*63=71346240 . ,
,
.
hdparm
. cyls!
SCSI

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

( MB, GB , ,
`').
10.
10.1. IDE -
IDE .
(G_user) .
(G_bios) BIOS (Fixed
Disk Parameter Table) ( )
,
32-bit. (G_phys) (G_log)
IDE IDENTIFY -
`' ` ' .
, :
G_fdisk, HDIO_GETGEO ioctl,
G_used, I/O.
G_user , G_bios
CMOS, G_phys
. G_log
G_used . , G_used
G_phys G_phys
G_used. `'
1-16.
: BIOS,
fdisk, (
16 ), /
IDENTIFY.
G_bios :
SCSI SCSI
BIOS sda
hda. ,
setup BIOS BIOS. , ..,
IDE , hdb BIOS setup,
BIOS
hda hdc.
10.2. SCSI
SCSI ,
SCSI , `'
/. ,
, fdisk ,
HDIO_GETGEO. , fdisk

IDE SCSI . ,
.
.
DOS,
, 64 , 32 / (
1 MiB ), ,
.
SCSI (aha152x, pas16, ppa, qlogicfas, qlogicisp)
DOS
8 GiB Linux.
bug.
;
. ,
fdisk LILO .
SCSI . :
fdisk/LILO/kernel SCSI
.
.
READ CAPACITY
MODE SENSE Rigid Disk
Drive Geometry (04)
( ) Format (03)
bytes .
, /
:
/. scsiinfo Linux
.
( )
. , fdisk LILO,
C/H/S=4476/27/171 -
fdisk
10/8/6 bits C/H/S.
HDIO_GETGEO ;
SCSI .
, , ,
DOS fdisk OS/2 ( AFDISK Adaptec, ) .
fdisk linux
/ S LBA c/h/s
C .
(C,H,S) = (1023,255,63)
1023*255*63 sectors. ,
fdisk
8 GiB - .
,
C, H, S , /.
H, S C M / (H*S).
, H=64, S=32.
aha1740, dtc, g_NCR5380, t128, wd7000:
H=64, S=32.

aha152x, pas16, ppa, qlogicfas, qlogicisp:


H=64, S=32 C > 1024, H=255, S=63, C = min(1023,
M/(H*S)). ( C H*S*C
M. fdisk.)
ppa.c M+1 M
bug sd.c, M 1.
advansys:
H=64, S=32 C > 1024 `> 1 GB'
BIOS , H=255, S=63.
aha1542:

H=255, S=63 H=64, S=32.
"aha1542.c: Using extended
bios translation".
aic7xxx:
H=64, S=32 C > 1024, "extended"
`extended' bit
SEEPROM BIOS, H=255, S=63. Linux 2.0.36
SEEPROM,
Linux 2.2.6 SEEPROM
,
( SEEPROM, ).
setup 2.0.36
2.2.6 ( `linear' LILO,
`aic7xxx=extended' ).
buslogic:
H=64, S=32 C >= 1024, extended
, M < 2^22 H=128, S=32;
H=255, S=63. ,
(C,H,S),
(H,S) = (64,32), (128,32), (255,63)
H=H-1 , (H,S) ,
"Adopting Geometry from Partition Table"
.
fdomain:
BIOS,
H=H+1,
S=S , ,
H=64, S=32 M < 2^21 (1 GiB), H=128, S=63
M < 63*2^17 (3.9 GiB) H=255, S=63 .
in2000:
(H,S) = (64,32), (64,63),
(128,63), (255,63) C <= 1024.
, C 1023.
seagate:
C,H,S . C S

, S=17, H=2 H C <=


1024. H 0 M > 128*1024*17 (1.1
GiB). bug.
ultrastor and u14_34f:
(H,S) = (16,63), (64,32), (64,63)
, .
,
.
. , ,
, , =
(C,H,S) , H =
H+1 S = S. (
1.) , .
,
C. , +1,

.
C = 1023 +
(H+1)*S,
, H = H+1
S = S. ,
, ,
. : H = M/(62*1024)
( ), S = M/(1024*H) (
), C = M/(H*S) ( ).
(C,H,S) C 1024 S 62.
11. Linux DE 8 GiB
O Linux IDE
( ) ATA IDENTIFY.
, lba
(lba_capacity), 10%
C*H*S. , , IDE
( 16514064 ) C=16383,
H=16, S=63, 16514064 (7.8 GB),
,
lba.
(2.0.34, 2.1.90)
.
, 8 GiB
, lba_capacity_is_ok
/usr/src/linux/drivers/block/ide.c
static int lba_capacity_is_ok (struct hd_driveid *id) {
id->cyls = id->lba_capacity / (id->heads * id->sectors);
return 1;
}

2.1.90.
11.1. BIOS
, C=16383, H=16, S=63
,
LBAcapacity. BIOS
16383/16/63
, .. 1024/255/63 1027/255/63. ,
16383/16/63,
BIOS. 2.2.2
( S BIOS
C = /(H*S)).
Normal BIOS ( None,
BIOS).
DOS/Windows
2.2.2 ,
.
BIOS 16320/16/63, 8
1024/255/63 .
.
,

hda: [PTBL] [1027/255/63].
8.4GB. 2.3.21. ,
.
11.2.
(jumpers)
15 16 .
16 .
, 15
. : Petri
Kaukasoina : ` 10.1 Gig IBM Deskstar 16 GP (IBM-DTTA-351010)
16 PC ( AMI BIOS)
15 . hdparm -i
RawCHS=16383/15/63 LBAsects=19807200. 20960/15/63
.' 16383/15/63
, .

http://www.storage.ibm.com/techsup/hddtech/hddtech.htm.
11.3.

. , Linux
, BIOS
. BIOS.
.
4096 (, 16
63/, 2.11GB). , Fujitsu MPB3032ATU 3.24
GB 6704/15/63,
4092/16/63, LBA 4124736 ,


. ( BIOS

) Linux
.
2GB
4092/16/63 4096/16/63,
LBA .
Linux,
.
`` 33.8 GB''.
2.3.21 patch
IDE 33.8GB.

33.8 GB. , IBM Deskstar 37.5 GB
(DPTA-353750) 33.8 GB,
16383/16/63 ,
LBA 66055248 ( 65531/16/63 4111/255/63)).
, 33.8GB,
Linux. the BIOS 33.8 GB limit.
12. 65535 linux
HDIO_GETGEO ioctl
short. 65535 ,
( SCSI 1 MiB )
80 GiB 16 GiB.
, .
12.1. IDE 34+ GB
33.8 GB
2.3.21. :
IBM-DPTA-373420 66835440 (34.2 GB).
2.3.21
769*16*63 = 775152 (0.4 GB),
. hdc=4160,255,63
- . ; idedisk_setup()
( 16383/16/63)
, ,
BIOS.
current_capacity() idedisk_capacity()
66835440/(16*63)=66305, short
, 769. lba_capacity_is_ok()
id->cyls,
769*16*63. patch. 2.0.38
ftp.kernel.org. 2.2.12
www.uwsg.indiana.edu. 2.2.14pre
. 2.3.* , 2.3.21.
, `' ``
'' 33.8 GB.
`` BIOS''
.

13.
``,'' MBR ( 0):
4 16 byte ,
AA55 . 5 F 85
() :
:
. (, ,
,
.)
.
4 : ,
.
,
,

.
:
, :
; .
,

.
sfdisk . ..,

# 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
/dev/hda1
0+
101
/dev/hda2
102
2133
/dev/hda3
2134 33482
/dev/hda4
0
-

#cyls #blocks Id System


10251376+ 83 Linux
2032 1024128 83 Linux
31349 15799896
5 Extended
0
0
0 Empty

/dev/hda5
-

2134+ 6197
6198 10261
2134
2133
2134
2133

4064- 2048224+ 83 Linux


4064 2048256
5 Extended
0
0
0 Empty
0
0
0 Empty

/dev/hda6
...
/dev/hda10
-

6198+ 10261
10262 16357
6198
6197
6198
6197

4064- 2048224+ 83 Linux


6096 3072384
5 Extended
0
0
0 Empty
0
0
0 Empty

30581+ 33482
30581 30580

2902- 1462576+ 83 Linux


0
0
0 Empty

30581
30581

30580
30580

0
0

0
0

0 Empty
0 Empty

.

.

. ( , fdisk
5, F, 85 5
F.) fdisk
,
. Linux
. ,
. ,
5 DOS 85, DOS, Linux,
fdisk DOS
1024 .

14.
,
.
,
.
:
`linear' LILO
`LI' .
: (
LILO, fdisk )
.
.
: Linux ,
.
LILO fdisk. , LILO
, .
,
. . , mount
.
14.1. : Linux
.
.
BIOS hd0 hd1 ( 80H 81 BIOS)
hda hdb. SCSI,
SCSI ,
IDE hda , sda.
`hda=C,H,S'
C, H S,
/etc/lilo.conf.

14.2. :
` 10GB IBM. fdisk
. :
# 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
/dev/hdd1
1

End Blocks Id System


19650 9903568+ 83 Linux native

;'
; , 10GB: hdb
255*63*1232*512 = 10133544960, hdd 16*63*19650*512
= 10141286400,
10.1 GB. ;
IDE
BIOS, BIOS hdb 255 (
16*19650/255=1232 cylinders). 8MB.
hdd
`hdd=1232,255,63'.
14.3. : fdisk df
To fdisk (blocks) .
, .. mke2fs,
4%
, inodes. :

# 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
/dev/hda9
#

Inodes IUsed IFree %IUsed Mounted on


4096000
11 4095989
0% /mnt

4095976 blocks, ext2 ,


3574475 blocks 521501 blocks (12%)
inodes .
3574475 3369664 blocks 13
204798 .
tune2fs. `-i 1024'
,
. :
# mke2fs /dev/hda9
# mount /dev/hda9 /somewhere
# df /somewhere
Filesystem
1024-blocks Used
/dev/hda9
3958475
13
# df -i /somewhere
Filesystem
Inodes IUsed
/dev/hda9
1024000
11
#

Available Capacity Mounted on


3753664
0% /mnt
IFree %IUsed Mounted on
1023989
0% /mnt

137501 blocks (3.3%) inodes,


384 MB . ( inode
128 bytes). , 1024000
( ), 4096000 ( )
.

Você também pode gostar