On 02/05/2010 12:07 PM, H. Peter Anvin wrote: > On 01/28/2010 02:44 PM, Karel Zak wrote: >> On Thu, Jan 28, 2010 at 10:10:05PM +0100, Christoph Zimmermann wrote: >>> to be prepared for the switch to hdd with sector sizes larger than 512 >>> byte there must be a new default to align partitions to. >> >> The plan is to use 2048 sectors (1MiB) as a default for disks with >> unknown topology. I'll do this change in fdisk next week and the same >> is planned for parted. > > I think this should be a minimum regardless of any detected disk > topology, except perhaps in the case of extremely small media. Let me reiterate that. I would like to suggest the following patch. Otherwise, we are using the minimum alignment *for the current device*, but disk layouts have a nasty tendency to outlive their respective media. -hpa -- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c index affea09..c6242c3 100644 --- a/fdisk/fdisk.c +++ b/fdisk/fdisk.c @@ -1069,13 +1069,16 @@ update_sector_offset(void) * device where the offset is quarter of of whole size * of the device). */ - unsigned long long x; - + unsigned long long x = 0; + if (has_topology) x = alignment_offset ? alignment_offset : io_size; else x = grain = 2048 * 512; + if (x < 2048 * 512) + x = 2048 * 512; + sector_offset = x / sector_size; if (total_number_of_sectors <= sector_offset * 4)