Movatterモバイル変換


[0]ホーム

URL:


NextPreviousContents

13. Extended and logical partitions

Above, we saw the structure ofthe MBR (sector 0): boot loader code followed by 4 partitiontable entries of 16 bytes each, followed by an AA55 signature.Partition table entries of type 5 or F or 85 (hex) have a specialsignificance: they describeextended partitions: blobs ofspace that are further partitioned intological partitions.(So, an extended partition is only a box, it cannot be used itself,one uses the logical partitions inside.)Only the location of the first sector of an extended partition isimportant. This first sector contains a partition table with fourentries: one a logical partition, one an extended partition, andtwo unused. In this way one gets a chain of partition table sectors,scattered over the disk, where the first one describes three primarypartitions and the extended partition, and each following partitiontable sector describes one logical partition and the location ofthe next partition table sector.

It is important to understand this: When people do something stupidwhile partitioning a disk, they want to know: Is my data still there?And the answer is usually: Yes. But if logical partitions were createdthen the partition table sectors describing them are written at thebeginning of these logical partitions, and data that was there before is lost.

The program sfdisk will show the full chain. E.g.,

# sfdisk -l -x /dev/hdaDisk /dev/hda: 16 heads, 63 sectors, 33483 cylindersUnits = 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#

It is possible to construct bad partition tables.Many kernels get into a loop if some extended partition points backto itself or to an earlier partition in the chain.It is possible to have two extended partitions in one of thesepartition table sectors so that the partition table chain forks.(This can happen for example with an fdisk that does not recognizeeach of 5, F, 85 as an extended partition, and creates a 5 next to an F.)No standard fdisk type program can handle such situations, and somehandwork is required to repair them.The Linux kernel will accept a fork at the outermost level.That is, you can have two chains of logical partitions.Sometimes this is useful - for example, one can use type 5 and beseen by DOS, and the other type 85, invisible for DOS, so thatDOS FDISK will not crash because of logical partitions past cylinder 1024.Usually one needssfdisk to create such a setup.


NextPreviousContents
[8]ページ先頭

©2009-2025 Movatter.jp