Wandering Thoughts archives

2008-07-14

What some fdisk options actually do

Since I was just looking into this recently, I will write down what I've learned about the less obvious effects of some of the fdisk commands.

The u command
As a side effect of switching to using sectors as the size unit, fdisk stops rounding up the end of your partitions to the nearest track or cylinder boundary.

The c command
This stops fdisk from rounding up the start of partitions to the nearest track or cylinder boundary. (Fdisk gives this the cryptic description of turning off "dos compatibility".)

An example may help show the effects:

  • with the default settings, a disk with just an extended partition that takes up the whole disk will have it start at sector 63 and end somewhat before the end of the disk.
  • with u alone, the partition will start at sector 63 but run to the end of the disk.
  • with u plus c, the partition will start at sector 1 and run to the end of the disk.

If you care about the exact size of your partitions, for example because you are trying to get some number of exactly identically sized partitions, you should use u. Using c is optional but will get you somewhat more disk space.

(Note that even with sector units and no DOS compatibility fdisk will still silently add one sector to your logical partition sizes, apparently so that partitions always start on an even sector number. This is not visible in fdisk output (which always reports the size of partitions in Kbytes, regardless of the setting of u); you have to use a tool like sfdisk to see the exact details.)

I see no reason not to use u and c all the time, with the possible exception of leaving some disk space at the front of disks for the bootloader. The tracks and cylinders that fdisk talks about are purely imaginary constructs on any disk made since at least the turn of the century, all of which have much more complicated internal geometries and actively hide them from you anyways, so you might as well just use straight sectors (or kilobytes, megabytes, and so on) and dispense with all the complexity and artificial limitations.

linux/FdiskOptionsEffects written at 22:49:02; Add Comment


Page tools: See As Normal.
Search:
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.