NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/38352: Bad CHS addresses with fdisk for inner extended partions (EBR)
>Number: 38352
>Category: bin
>Synopsis: Bad CHS addresses with fdisk for inner extended partions (EBR)
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Apr 01 10:55:00 +0000 2008
>Originator: Gregoire Sutre
>Release: NetBSD 4.0 (official release)
>Organization:
>Environment:
System: NetBSD 4.0 NetBSD 4.0 (GENERIC) #0: Sat Dec 15 22:25:31 PST 2007
builds@wb28:/home/builds/ab/netbsd-4-0-RELEASE/amd64/200712160005Z-obj/home/builds/ab/netbsd-4-0-RELEASE/src/sys/arch/amd64/compile/GENERIC
amd64
Architecture: x86_64
Machine: amd64
>Description:
CHS values for inner extended partitions (``link'' extended partitions)
created with NetBSD's fdisk are relative to the outer (primary) extended
partition. However, according to experiments with other partitionning
tools, and from some documentation I could find on the web (e.g. [1]),
I strongly believe that all CHS entries in MBR and EBR partition tables
are supposed to be absolute. However, I could not find a (definitive)
reference on the subject so I could be wrong... It is true that, for
inner extended partitions, the offset entry (number of sectors) should
be relative to the outer (primary) extended partition. But this is not
the case for the CHS entries.
CHS entries in partition tables are not used by modern OS (?), so this
problem should have no impact on modern OS. But it could surely lead to
unreadable logical drives for older OS (in case the hard disk is shared
between OS). Moreover, as shown in the example below, the problem can
lead to a (CHS) loop in the linked-list of inner extended partitions.
The following example illustrates the problem. The partition tables are
displayed using Linux fdisk in expert mode since it is more concise than
NetBSD fdisk. NetBSD fdisk outputs are included at the end of this
report.
The disk geometry is:
255 heads, 63 sectors, 38913 cylinders
1. Creation of the partition table from scratch with Linux cfdisk (from
util-linux). We get:
Primary Partitions and Logical Drives
-------------------------------------
Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID
1 00 1 1 0 254 63 130 63 2104452 a9
2 00 0 1 131 254 63 523 2104515 6313545 05
3 00 0 0 0 0 0 0 0 0 00
4 00 0 0 0 0 0 0 0 0 00
5 00 1 1 131 254 63 261 63 2104452 07
6 00 1 1 262 254 63 392 63 2104452 07
7 00 1 1 393 254 63 523 63 2104452 07
Outer (2) and Inner (5, 6, 7) Extended partitions
-------------------------------------------------
Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID
2 00 0 1 131 254 63 523 2104515 6313545 05
5 00 0 1 262 254 63 392 2104515 2104515 05
6 00 0 1 393 254 63 523 4209030 2104515 05
7 00 0 0 0 0 0 0 0 0 00
1'. Creation of the partition table from scratch with (a) NetBSD fdisk
to create the first primary partition only, and (b) Windows XP Computer
Management tool for the others. We get the same tables as above.
2. Creation of the partition table from scratch with NetBSD fdisk. We
get:
Primary Partitions and Logical Drives
-------------------------------------
Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID
1 00 1 1 0 254 63 130 63 2104452 a9
2 00 0 1 131 254 63 523 2104515 6313545 05
3 00 0 0 0 0 0 0 0 0 00
4 00 0 0 0 0 0 0 0 0 00
5 00 1 1 131 254 63 261 63 2104452 07
6 00 1 1 262 254 63 392 63 2104452 07
7 00 1 1 393 254 63 523 63 2104452 07
Outer (#2) and Inner (#5, #6) Extended partitions
-------------------------------------------------
Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID
2 00 0 1 131 254 63 523 2104515 6313545 05
5 00 0 1 131 254 63 261 2104515 2104515 05
6 00 0 1 262 254 63 392 4209030 2104515 05
7 00 0 0 0 0 0 0 0 0 00
The only differences with the tables from (1) are the CHS entries for
inner extended partitions.
Here the outer extended partition #2 and the first inner extended
partition #5 have the same start CHS address 131/0/1. This CHS
address would be correct for the first inner extended partition #5 when
taken relative to the first sector of the outer extended partition.
[1] http://home.att.net/~rayknights/pc_boot/ext_tbls.htm
------------------------------------------------------------------------
Logs with NetBSD fdisk
Partition table obtained after (1)
----------------------------------
Disk: /dev/rwd1d
NetBSD disklabel disk geometry:
cylinders: 620181, heads: 16, sectors/track: 63 (1008 sectors/cylinder)
total sectors: 625142448
BIOS disk geometry:
cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 625142448
Partition table:
0: NetBSD (sysid 169)
start 63, size 2104452 (1028 MB, Cyls 0/1/1-130)
beg: cylinder 0, head 1, sector 1
end: cylinder 130, head 254, sector 63
Information from PBR:
Not bootable: All bytes are identical (0x00)
Not bootable: Bad magic number (0x0000)>
1: Extended partition (sysid 5)
start 2104515, size 6313545 (3083 MB, Cyls 131-523)
beg: cylinder 131, head 0, sector 1
end: cylinder 523, head 254, sector 63
2: <UNUSED> (sysid 0)
start 0, size 0
beg: cylinder 0, head 0, sector 0
end: cylinder 0, head 0, sector 0
Information from PBR:
PBR appears to be bootable
OEM name: "\320\274\000|\216\300\216\330"
3: <UNUSED> (sysid 0)
start 0, size 0
beg: cylinder 0, head 0, sector 0
end: cylinder 0, head 0, sector 0
Information from PBR:
PBR appears to be bootable
OEM name: "\320\274\000|\216\300\216\330"
Extended partition table:
E0: NTFS, OS/2 HPFS, QNX2 or Advanced UNIX (sysid 7)
start 2104578, size 2104452 (1028 MB, Cyls 131/1/1-261)
beg: cylinder 131, head 1, sector 1
end: cylinder 261, head 254, sector 63
Information from PBR:
Not bootable: All bytes are identical (0x00)
Not bootable: Bad magic number (0x0000)>
link: Extended partition (sysid 5)
start 4209030, size 2104515 (1028 MB, Cyls 262-392)
beg: cylinder 262, head 0, sector 1
end: cylinder 392, head 254, sector 63
E1: NTFS, OS/2 HPFS, QNX2 or Advanced UNIX (sysid 7)
start 4209093, size 2104452 (1028 MB, Cyls 262/1/1-392)
beg: cylinder 262, head 1, sector 1
end: cylinder 392, head 254, sector 63
Information from PBR:
Not bootable: All bytes are identical (0x00)
Not bootable: Bad magic number (0x0000)>
link: Extended partition (sysid 5)
start 6313545, size 2104515 (1028 MB, Cyls 393-523)
beg: cylinder 393, head 0, sector 1
end: cylinder 523, head 254, sector 63
E2: NTFS, OS/2 HPFS, QNX2 or Advanced UNIX (sysid 7)
start 6313608, size 2104452 (1028 MB, Cyls 393/1/1-523)
beg: cylinder 393, head 1, sector 1
end: cylinder 523, head 254, sector 63
Information from PBR:
Not bootable: All bytes are identical (0x00)
Not bootable: Bad magic number (0x0000)>
link: <UNUSED> (sysid 0)
start 6313545, size 0
beg: cylinder 0, head 0, sector 0
end: cylinder 0, head 0, sector 0
Information from PBR:
PBR appears to be bootable
Bootselector disabled.
Partition table obtained after (2)
----------------------------------
Disk: /dev/rwd1d
NetBSD disklabel disk geometry:
cylinders: 620181, heads: 16, sectors/track: 63 (1008 sectors/cylinder)
total sectors: 625142448
BIOS disk geometry:
cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 625142448
Partition table:
0: NetBSD (sysid 169)
start 63, size 2104452 (1028 MB, Cyls 0/1/1-130)
beg: cylinder 0, head 1, sector 1
end: cylinder 130, head 254, sector 63
Information from PBR:
Not bootable: All bytes are identical (0x00)
Not bootable: Bad magic number (0x0000)>
1: Extended partition (sysid 5)
start 2104515, size 6313545 (3083 MB, Cyls 131-523)
beg: cylinder 131, head 0, sector 1
end: cylinder 523, head 254, sector 63
2: <UNUSED> (sysid 0)
start 0, size 0
beg: cylinder 0, head 0, sector 0
end: cylinder 0, head 0, sector 0
Information from PBR:
PBR appears to be bootable
OEM name: "\320\274\000|\216\300\216\330"
3: <UNUSED> (sysid 0)
start 0, size 0
beg: cylinder 0, head 0, sector 0
end: cylinder 0, head 0, sector 0
Information from PBR:
PBR appears to be bootable
OEM name: "\320\274\000|\216\300\216\330"
Extended partition table:
E0: NTFS, OS/2 HPFS, QNX2 or Advanced UNIX (sysid 7)
start 2104578, size 2104452 (1028 MB, Cyls 131/1/1-261)
beg: cylinder 131, head 1, sector 1
end: cylinder 261, head 254, sector 63
Information from PBR:
Not bootable: All bytes are identical (0x00)
Not bootable: Bad magic number (0x0000)>
link: Extended partition (sysid 5)
start 4209030, size 2104515 (1028 MB, Cyls 262-392)
beg: cylinder 131, head 0, sector 1
end: cylinder 261, head 254, sector 63
E1: NTFS, OS/2 HPFS, QNX2 or Advanced UNIX (sysid 7)
start 4209093, size 2104452 (1028 MB, Cyls 262/1/1-392)
beg: cylinder 262, head 1, sector 1
end: cylinder 392, head 254, sector 63
Information from PBR:
Not bootable: All bytes are identical (0x00)
Not bootable: Bad magic number (0x0000)>
link: Extended partition (sysid 5)
start 6313545, size 2104515 (1028 MB, Cyls 393-523)
beg: cylinder 262, head 0, sector 1
end: cylinder 392, head 254, sector 63
E2: NTFS, OS/2 HPFS, QNX2 or Advanced UNIX (sysid 7)
start 6313608, size 2104452 (1028 MB, Cyls 393/1/1-523)
beg: cylinder 393, head 1, sector 1
end: cylinder 523, head 254, sector 63
Information from PBR:
Not bootable: All bytes are identical (0x00)
Not bootable: Bad magic number (0x0000)>
link: <UNUSED> (sysid 0)
start 6313545, size 0
beg: cylinder 0, head 0, sector 0
end: cylinder 0, head 0, sector 0
Information from PBR:
PBR appears to be bootable
Bootselector disabled.
------------------------------------------------------------------------
>How-To-Repeat:
Partition as above and inspect the partition table with fdisk -vv.
>Fix:
Unknown
Home |
Main Index |
Thread Index |
Old Index