Linux – cfdisk quits with a fatal error in regards to the partition table

hard drivelinuxpartition

fresh install. 'cfdisk /dev/sda' gives the following output:

"FATAL ERROR: Bad primary partition 2: Partition ends in the final partial cylinder"

what could be the reason for this to happen and what might be the solution?

this is the output of 'fdisk -ucl /dev/sda':

Disk /dev/sda: 61.5 GB, 61492838400 bytes 255 heads, 63 sectors/track, 7476 cylinders, total 120103200 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: 0x00030933

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     3905535     1951744   82  Linux swap / Solaris
/dev/sda2   *     3905536     5859327      976896   83  Linux
/dev/sda3         5859328   120102911    57121792   83  Linux

Best Answer

This is a known cfdisk bug, already fixed by some reports. Partitions haven't needed to be aligned to track boundaries for almost two decades, if indeed ever at all; and most modern partition table utilities don't perform such alignment. (Microsoft stopped doing it in its utilities, to much fanfare, several years ago.)

But cfdisk was checking that they were track-aligned anyway, and complaining (with a fatal error that need not have been fatal) if they weren't. cfdisk clearly wasn't what your installation program used to partition the disc. Partition tables created with tools that have dropped this nonsense track-alignment idea will of course give cfdisk cause for complaint, and that's what has clearly happened here.

Local fix: Don't use cfdisk. Use gparted or parted or some such. (As Rod Smith explains, they don't share a common codebase with the fdisk family, and so won't share this bug.) Or bite the bullet and use GPT fdisk to switch to the EFI partition table format, which has none of this cylinders/heads/sectors residue at all.

Temporary and service fix: Get the fixed cfdisk from your operating system vendor.

Further reading

Related Topic