--- Begin Message ---
Subject: |
Change in MBR between parted 3.2 and 3.3 |
Date: |
Thu, 26 Jan 2023 11:52:36 +0100 |
Hello,
I have an arm based board with an eMMC card for storage.
I cross compil an GNU/Linux OS (with yocto) for this boardand and I came
across an issue after updating parted to 3.3 and above.
Below are my commands to partition the 4GB storage (2 partitions of 1.8GB,
1 bootable partition of 400MB) :
:~# parted /dev/mmcblk0 mklabel msdos
:~# parted -a none /dev/mmcblk0 unit s mkpart primary ext4 2048 3474431
:~# parted -a none /dev/mmcblk0 unit s mkpart primary ext4 3474432 6946815
:~# parted -a none /dev/mmcblk0 unit s mkpart primary ext4 6946816 7733247
:~# parted /dev/mmcblk0 set 3 boot on
With parted 3.2, I have the following MBR:
:~# hexdump -n 1024 -C /dev/mmcblk0
00000000 fa b8 00 10 8e d0 bc 00 b0 b8 00 00 8e d8 8e c0 |................|
00000010 fb be 00 7c bf 00 06 b9 00 02 f3 a4 ea 21 06 00 |...|.........!..|
00000020 00 be be 07 38 04 75 0b 83 c6 10 81 fe fe 07 75 |....8.u........u|
00000030 f3 eb 16 b4 02 b0 01 bb 00 7c b2 80 8a 74 01 8b |.........|...t..|
00000040 4c 02 cd 13 ea 00 7c 00 00 eb fe 00 00 00 00 00 |L.....|.........|
00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001b0 00 00 00 00 00 00 00 00 34 15 3b 6e 00 00 00 20 |........4.;n... |
000001c0 21 00 83 45 2d d8 00 08 00 00 00 fc 34 00 00 45 |!..E-.......4..E|
000001d0 2e d8 83 6a 7a b0 00 04 35 00 00 fc 34 00 80 6a |...jz...5...4..j|
000001e0 7b b0 83 5e 7d e1 00 00 6a 00 00 00 0c 00 00 00 |{..^}...j.......|
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000400
With parted 3.3, I have that:
:~# hexdump -n 1024 -C /dev/mmcblk0
00000000 fa b8 00 10 8e d0 bc 00 b0 b8 00 00 8e d8 8e c0 |................|
00000010 fb be 00 7c bf 00 06 b9 00 02 f3 a4 ea 21 06 00 |...|.........!..|
00000020 00 be be 07 38 04 75 0b 83 c6 10 81 fe fe 07 75 |....8.u........u|
00000030 f3 eb 16 b4 02 b0 01 bb 00 7c b2 80 8a 74 01 8b |.........|...t..|
00000040 4c 02 cd 13 ea 00 7c 00 00 eb fe 00 00 00 00 00 |L.....|.........|
00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001b0 00 00 00 00 00 00 00 00 85 1a 7c 02 00 00 00 04 |..........|.....|
000001c0 01 04 83 fe c2 ff 00 08 00 00 00 fc 34 00 00 fe |............4...|
000001d0 c2 ff 83 fe c2 ff 00 04 35 00 00 fc 34 00 80 fe |........5...4...|
000001e0 c2 ff 83 fe c2 ff 00 00 6a 00 00 00 0c 00 00 00 |........j.......|
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000400
The first and last CHS address of the partition entries are completely different
and for the entry 2 and 3, first address is equal to the last !
Below is more information by parted 3.2:
:~# parted /dev/mmcblk0 print unit s print unit chs print
Model: MMC 004GA0 (sd/mmc)
Disk /dev/mmcblk0: 3959MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 1779MB 1778MB primary
2 1779MB 3557MB 1778MB primary
3 3557MB 3959MB 403MB primary ext4 boot
Model: MMC 004GA0 (sd/mmc)
Disk /dev/mmcblk0: 7733248s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 2048s 3474431s 3472384s primary
2 3474432s 6946815s 3472384s primary
3 6946816s 7733247s 786432s primary ext4 boot
Model: MMC 004GA0 (sd/mmc)
Disk /dev/mmcblk0: 481,94,60
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 481,255,63. Each cylinder is 8225kB.
Partition Table: msdos
Disk Flags:
Number Start End Type File system Flags
1 0,32,32 216,69,44 primary
2 216,69,45 432,106,57 primary
3 432,106,58 481,94,60 primary ext4 boot
And the same with parted 3.3:
:~# parted /dev/mmcblk0 print unit s print unit chs print
Model: MMC 004GA0 (sd/mmc)
Disk /dev/mmcblk0: 3959MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 1779MB 1778MB primary
2 1779MB 3557MB 1778MB primary
3 3557MB 3959MB 403MB primary ext4 boot
Model: MMC 004GA0 (sd/mmc)
Disk /dev/mmcblk0: 7733248s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 2048s 3474431s 3472384s primary
2 3474432s 6946815s 3472384s primary
3 6946816s 7733247s 786432s primary ext4 boot
Model: MMC 004GA0 (sd/mmc)
Disk /dev/mmcblk0: 15163,58,1
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 15163,255,2. Each cylinder is 261kB.
Partition Table: msdos
Disk Flags:
Number Start End Type File system Flags
1 4,4,0 6812,155,1 primary
2 6812,156,0 13621,52,1 primary
3 13621,53,0 15163,58,1 primary ext4 boot
The main difference I spotted is the BIOS geometry:
- parted 3.2: 481 cylinder, 255 head, 63 sector (cylinder size 8225 kB)
- parted 3.3: 15163 cylinder, 255 head, 2 sector (cylinder size 261 kB)
I also tested parted 3.4 and parted 3.5 with the same result.
Nevertheless, the partition table created by parted 3.3 and above is
perfectly usable from what I see.
Long story short, do you know the origin of this discrepancy (I didn't
see nothing
in release not that could explain that though I obviously don't understan all
the mechanics) and if it is possible to come back to the same kind of
MBR generated
by parted 3.2 ?
One additional question arises for my understanding though, how come a partition
with CHS address of the first sector equal to the last one is usable ?
Thanks in advance for all insights/advices you can bring to my issue.
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#61076: Change in MBR between parted 3.2 and 3.3 |
Date: |
Thu, 26 Jan 2023 08:28:18 -0800 |
On Thu, Jan 26, 2023 at 11:52:36AM +0100, Frédéric Martinsons wrote:
> Hello,
>
> I have an arm based board with an eMMC card for storage.
> I cross compil an GNU/Linux OS (with yocto) for this boardand and I came
> across an issue after updating parted to 3.3 and above.
[snip]
>
> The main difference I spotted is the BIOS geometry:
> - parted 3.2: 481 cylinder, 255 head, 63 sector (cylinder size 8225 kB)
> - parted 3.3: 15163 cylinder, 255 head, 2 sector (cylinder size 261 kB)
>
> I also tested parted 3.4 and parted 3.5 with the same result.
> Nevertheless, the partition table created by parted 3.3 and above is
> perfectly usable from what I see.
>
> Long story short, do you know the origin of this discrepancy (I didn't
> see nothing
> in release not that could explain that though I obviously don't understan all
> the mechanics) and if it is possible to come back to the same kind of
> MBR generated
> by parted 3.2 ?
This change was introduced by commit
61dd3d4c5eb782eb43caa95342e63727db3f8281, it was needed to fix problems
growing partitions when using SD cards on the Raspberry Pi.
> One additional question arises for my understanding though, how come a
> partition
> with CHS address of the first sector equal to the last one is usable ?
Well, nothing should be actually using the CHS values these days. So
it's possible that's a bug that doesn't matter in practice, but I'll
have to look into that.
Brian
--
Brian C. Lane (PST8PDT) - weldr.io - lorax - parted - pykickstart
--- End Message ---