fdisk head inconsistency
Mauro Condarelli
mc5686 at mclink.it
Sun Sep 29 12:57:12 UTC 2019
Hi,
I have Busybox (self-compiled using Buildroot) on a small embedded
system (mips/MT7628/Vocore2, if it matters).
I tried to use Busybox fdisk to reformat an attached SD card.
I needed to delete unused partitions 3 and 4, recreate a different P3,
add Extended in P4, create Logical Partition P5.
Note: the SD card was originally formatted using Debian GNU/Linux fdisk
on a desktop.
I have several problems here, possibly all stemming from a bogus
detection of "disk geometry":
- (n)ew partition always suggested sector 16 as starting point
(obviously useless).
- (p)rint shows bogus values in CHS of newly created Partitions.
- (v)erify complains about "old" partition geometry.
I did *not* save new Partition Table to SD.
I thought about forcing geometry using fdisk [-C CYLINDERS] [-H HEADS]
[-S SECTORS] options, but I'm unsure if this is the right option and I
can't determine the right values to use (I don't have the original
desktop available).
Can someone advise?
Here follows transcript:
# fdisk /dev/mmcblk0
The number of cylinders for this disk is set to 242560.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): d
Partition number (1-4): 4
Command (m for help): d
Partition number (1-4): 3
Command (m for help): p
Disk /dev/mmcblk0: 7580 MB, 7948206080 bytes, 15523840 sectors
242560 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA
Sectors Size Id Type
/dev/mmcblk0p1 0,33,3 17,96,10 2048 264191
262144 128M c Win95 FAT32 (LBA)
/dev/mmcblk0p2 17,96,11 293,126,14 264192 4458495
4194304 2048M 83 Linux
Command (m for help): n
Partition type
p primary partition (1-4)
e extended
p
Partition number (1-4): 3
First sector (16-15523839, default 16): 4458496
Last sector or +size{,K,M,G,T} (4458496-15523839, default 15523839): +100M
Command (m for help): p
Disk /dev/mmcblk0: 7580 MB, 7948206080 bytes, 15523840 sectors
242560 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA
Sectors Size Id Type
/dev/mmcblk0p1 0,33,3 17,96,10 2048 264191
262144 128M c Win95 FAT32 (LBA)
/dev/mmcblk0p2 17,96,11 293,126,14 264192 4458495
4194304 2048M 83 Linux
/dev/mmcblk0p3 1023,3,16 1023,3,16 4458496 4663295
204800 100M 83 Linux
Command (m for help): n
Partition type
p primary partition (1-4)
e extended
e
Selected partition 4
First sector (16-15523839, default 16): 4663296
Last sector or +size{,K,M,G,T} (4663296-15523839, default 15523839):
Using default value 15523839
Command (m for help): p
Disk /dev/mmcblk0: 7580 MB, 7948206080 bytes, 15523840 sectors
242560 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA
Sectors Size Id Type
/dev/mmcblk0p1 0,33,3 17,96,10 2048 264191
262144 128M c Win95 FAT32 (LBA)
/dev/mmcblk0p2 17,96,11 293,126,14 264192 4458495
4194304 2048M 83 Linux
/dev/mmcblk0p3 1023,3,16 1023,3,16 4458496 4663295
204800 100M 83 Linux
/dev/mmcblk0p4 1023,3,16 1023,3,16 4663296 15523839
10860544 5303M 5 Extended
Command (m for help): p
Disk /dev/mmcblk0: 7580 MB, 7948206080 bytes, 15523840 sectors
242560 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA
Sectors Size Id Type
/dev/mmcblk0p1 0,33,3 17,96,10 2048 264191
262144 128M c Win95 FAT32 (LBA)
/dev/mmcblk0p2 17,96,11 293,126,14 264192 4458495
4194304 2048M 83 Linux
/dev/mmcblk0p3 1023,3,16 1023,3,16 4458496 4663295
204800 100M 83 Linux
/dev/mmcblk0p4 1023,3,16 1023,3,16 4663296 15523839
10860544 5303M 5 Extended
Command (m for help): n
First sector (4663312-15523839, default 4663312):
Using default value 4663312
Last sector or +size{,K,M,G,T} (4663312-15523839, default 15523839): +1g
Command (m for help): p
Disk /dev/mmcblk0: 7580 MB, 7948206080 bytes, 15523840 sectors
242560 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA
Sectors Size Id Type
/dev/mmcblk0p1 0,33,3 17,96,10 2048 264191
262144 128M c Win95 FAT32 (LBA)
/dev/mmcblk0p2 17,96,11 293,126,14 264192 4458495
4194304 2048M 83 Linux
/dev/mmcblk0p3 1023,3,16 1023,3,16 4458496 4663295
204800 100M 83 Linux
/dev/mmcblk0p4 1023,3,16 1023,3,16 4663296 15523839
10860544 5303M 5 Extended
/dev/mmcblk0p5 1023,3,16 1023,3,16 4663312 6760463
2097152 1024M 83 Linux
Command (m for help): v
Partition 1: head 97 greater than maximum 4
Partition 2: head 127 greater than maximum 4
8765438 unallocated sectors
Command (m for help):
More information about the busybox
mailing list