Movatterモバイル変換


[0]ホーム

URL:


NextPreviousContents

6. Disk geometry, partitions and `overlap'

If you have several operating systems on your disks, then eachuses one or more disk partitions. A disagreement on where thesepartitions are may have catastrophic consequences.

The MBR contains apartition table describing where the(primary) partitions are. There are 4 table entries, for 4primary partitions, and each looks like

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 */};
(where CHS stands for Cylinder/Head/Sector).

This information is redundant: the location of a partitionis given both by the 24-bitbegin andend fields,and by the 32-bitstart andlength fields.

Linux only uses thestart andlength fields, and cantherefore handle partitions of not more than 2^32 sectors,that is, partitions of at most 2 TiB. That is twelve timeslarger than the disks available today, so maybe it will beenough for the next five years or so.(So, partitions can be very large, but there is a seriousrestriction in that a file in an ext2 filesystem on hardwarewith 32-bit integers cannot be larger than 2 GiB.)

DOS uses thebegin andend fields, and uses theBIOS INT13 call to access the disk, and can therefore onlyhandle disks of not more than 8.4 GB, even with a translatingBIOS. (Partitions cannot be larger than 2.1 GB because ofrestrictions of the FAT16 file system.) The same holds forWindows 3.11 and WfWG and Windows NT 3.*.

Windows 95 has support for the Extended INT13 interface, anduses special partition types (c, e, f instead of b, 6, 5)to indicate that a partition should be accessed in this way.When these partition types are used, thebegin andend fieldscontain dummy information (1023/255/63).Windows 95 OSR2 introduces the FAT32 file system (partition typeb or c), that allows partitions of size at most 2 TiB.

What is this nonsense you get fromfdisk about `overlapping'partitions, when in fact nothing is wrong?Well - there is something `wrong': if you look at thebeginandend fields of such partitions, as DOS does, they overlap.(And that cannot be corrected, because these fields cannot storecylinder numbers above 1024 - there will always be `overlap'as soon as you have more than 1024 cylinders.)However, if you look at thestart andlength fields,as Linux does, and as Windows 95 does in the case of partitionswith partition type c, e or f, then all is well.So, ignore these warnings whencfdisk is satisfied and youhave a Linux-only disk. Be careful when the disk is shared with DOS.Use the commandscfdisk -Ps /dev/hdx andcfdisk -Pt /dev/hdxto look at the partition table of/dev/hdx.

6.1 The last cylinder

Many old IBM PS/2 systems used disks with a defect map writtento the end of the disk. (Bit 0x20 in the control word of thedisk parameter table is set.)Therefore, FDISK would not use the last cylinder. Just to be sure, the BIOSoften already reports the size of the disk as one cylinder smaller thanreality, and that may mean that two cylinders are lost.Newer BIOSes have several disk size reporting functions, where internallyone calls the other. When both subtract 1 for this reserved cylinder andalso FDISK does so, then one may lose three cylinders.These days all of this is irrelevant, but this may provide an explanationif one observes that different utilities have slightly different opinionsabout the disk size.

6.2 Cylinder boundaries

A well-known claim says that partitions should start and endat cylinder boundaries.

Since "disk geometry" is something without objective existence,different operating systems will invent different geometriesfor the same disk. One often sees a translated geometry like */255/63used by one and an untranslated geometry like */16/63 used by another OS.(People tell me Windows NT uses */64/32 while Windows 2K uses */255/63.)Thus, it may be impossible to align partitions to cylinder boundariesaccording to each of the the various ideas about the size of a cylinderthat one's systems have. Also different Linux kernels may assigndifferent geometries to the same disk.Also, enabling or disabling the BIOS of a SCSI card may change thefake geometry of the connected SCSI disks.

Fortunately, for Linux there is no alignment requirement at all.(Except that some semi-broken installation software likes to be very surethat all is OK; thus, it may be impossible to install RedHat 7.1on a disk with unaligned partitions because DiskDruid is unhappy.)

People report that it is easy to create nonaligned partitionsin Windows NT, without any noticeable bad effects.

But MSDOS 6.22 has an alignment requirement. Extended partition sectorsthat are not on a cylinder boundary are ignored by its FDISK.The system itself is happy with any alignment, but interpretsrelative starting addresses as if relative to an aligned address:The starting address of a logical partition is given relative notto the address of the extended partition sector that describes it,but relative to the start of the cylinder that contains that sector.(So, it is not surprising that also PartitionMagic requires alignment.)

What is the definition of alignment?MSDOS 6.22 FDISK will do the following:1. If the first sector of the cylinder is a partitiontable sector, then the rest of the track is unused,and the partition starts with the the next track.This applies to sector 0 (the MBR) and the partition table sectorspreceding logical partitions.2. Otherwise, the partition starts at the first sector of thecylinder. Also the extended partition starts at a cylinder boundary.Thecfdisk man page says that old versions of DOS did notalign partitions.

Use of partition type 85 for the extended partition makes it invisibleto DOS, making sure that only Linux will look inside.

As an aside: on a Sparc, the boot partition must start on a cylinderboundary (but there is no requirement on the end).


NextPreviousContents
[8]ページ先頭

©2009-2025 Movatter.jp