[parted-devel] > 63 heads. Why does this keep coming up?
Curtis Gedak
gedakc at gmail.com
Sun Feb 13 18:28:18 UTC 2011
Hi Phillip,
Thank you for creating this proposed patch. My initial testing with
your patch has gone well.
Following are some thoughts on improving the patch, and also my patch
testing steps.
THOUGHTS FOR IMPROVEMENT
========================
It might be useful to print a message indicating a problem with invalid
CHS geometry, and that parted will write a geometry when edits are made
to the partition table.
What are your thoughts regarding informing the user about invalid CHS?
PATCH TESTING STEPS
===================
In my testing I used a patched parted-2.3 and the upcoming GParted 0.8.0
release planned for Feb 15th, 2011.
TEST A - TRY TO GROW PARTITION
------------------------------
1) Place a copy of the problem MBR on my 160 GB hard drive (/dev/sda).
Also print out the partition table using fdisk and parted.
I noted that the fdisk output indicates 86 heads, 22 sectors/track,
etc.
Problem MBR is from the following mailing list post:
http://lists.gnu.org/archive/html/bug-parted/2011-02/msg00008.html
$ sudo dd if=sdg.mbr of=/dev/sda bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.00422147 s, 121 kB/s
$ sudo fdisk -l -u /dev/sda
Disk /dev/sda: 160.0 GB, 160041885696 bytes
86 heads, 22 sectors/track, 165212 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sda1 8064 7827455 3909696 c W95 FAT32 (LBA)
$ sudo parted /dev/sda unit s print
Model: ATA ST3160022ACE (scsi)
Disk /dev/sda: 312581808s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 8064s 7827455s 7819392s primary lba
2) Since fdisk indicates that the file system for the original
partition was FAT32, I reformatted the partition as FAT32 with GParted.
I noted that the fdisk output still indicates 86 heads, 22
sectors/track, etc.
$ sudo fdisk -l -u /dev/sda
Disk /dev/sda: 160.0 GB, 160041885696 bytes
86 heads, 22 sectors/track, 165212 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a340e
Device Boot Start End Blocks Id System
/dev/sda1 8064 7827455 3909696 c W95 FAT32 (LBA)
$ sudo parted /dev/sda unit s print
Model: ATA ST3160022ACE (scsi)
Disk /dev/sda: 312581808s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 8064s 7827455s 7819392s primary fat32 lba
3) Using GParted I grew the FAT32 file system from ~3818 MiB to 8192 MiB.
I noted that the disk CHS geometry has changed.
fdisk now reports 255 heads, 63 sectors/track, etc.
Hence it would appear that parted created a valid CHS geometry
and overwrote the old invalid geometry.
$ sudo fdisk -l -u /dev/sda
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a340e
Device Boot Start End Blocks Id System
/dev/sda1 8064 16785407 8388672 c W95 FAT32 (LBA)
$ sudo parted /dev/sda unit s print
Model: ATA ST3160022ACE (scsi)
Disk /dev/sda: 312581808s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 8064s 16785407s 16777344s primary fat32 lba
TEST A SUMMARY
--------------
It would appear that parted will try to correct the partition CHS
geometry when parted edits the partition table entry.
TEST B - TRY TO CREATE CYLINDER ALIGNED PARTITION
--------------------------------------------------
1) Place a copy of the problem MBR on my 160 GB hard drive (/dev/sda).
Also print out the partition table using fdisk and parted.
I noted that the fdisk output indicates 86 heads, 22 sectors/track,
etc.
$ sudo dd if=sdg.mbr of=/dev/sda bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.0173541 s, 29.5 kB/s
$ sudo fdisk -l -u /dev/sda
Disk /dev/sda: 160.0 GB, 160041885696 bytes
86 heads, 22 sectors/track, 165212 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sda1 8064 7827455 3909696 c W95 FAT32 (LBA)
$ sudo parted /dev/sda unit s print
Model: ATA ST3160022ACE (scsi)
Disk /dev/sda: 312581808s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 8064s 7827455s 7819392s primary fat32 lba
2) Using GParted, create a cylinder aligned 16 GiB ext2 partition
after the fat32 partition.
I noted that the disk CHS geometry has changed.
fdisk now reports 255 heads, 63 sectors/track, etc.
Hence it would appear that parted created a valid CHS geometry
and overwrote the old invalid geometry.
$ sudo fdisk -l -u /dev/sda
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000381ef
Device Boot Start End Blocks Id System
/dev/sda1 8064 7827455 3909696 c W95 FAT32 (LBA)
Partition 1 does not end on cylinder boundary.
/dev/sda2 7839720 41383439 16771860 83 Linux
$ sudo parted /dev/sda unit s print
Model: ATA ST3160022ACE (scsi)
Disk /dev/sda: 312581808s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 8064s 7827455s 7819392s primary fat32 lba
2 7839720s 41383439s 33543720s primary ext2
TEST B SUMMARY
--------------
Parted also changes the disk geometry to a valid one when a new
partition is created. Now that the CHS geometry has changed, fdisk no
longer sees the original partition as cylinder aligned. I wonder if
this change in geometry could possibly cause problems later on....
Regards,
Curtis Gedak
More information about the parted-devel
mailing list