Re: Howto for properly partitioning new drives with 4096 byte sectors (like Western Digital Advanced Format EARS drives)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Feb 14, 2010 at 04:53:40PM -0800, H. Peter Anvin wrote:
> 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.

 I'm not sure if I good understand how the layout can outlive
 respective media. dd(1) to any other disk?

 In some cases we cannot ignore disk topology, for example for
 desktop-class 4K disks (or some NetApp setups, etc.) you have to use
 alignment_offset to calculate the physical block boundary.

 Currently, we (fdisk / parted) use 1MiB offset (and grain) for
 devices with unknown topology only.

    Karel


> 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)


-- 
 Karel Zak  <kzak@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux