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 Mon, Feb 15, 2010 at 03:06:10PM +0100, Karel Zak wrote:
> 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:
> > 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.
[...]
>  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.

 The proper patch to implement your request is:

diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index b752d9b..1c7aee1 100644
--- a/fdisk/fdisk.c
+++ b/fdisk/fdisk.c
@@ -1080,11 +1080,15 @@ 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
+		if (has_topology) {
+			if (alignment_offset)
+				x = alignment_offset;
+			else if (io_size > 2048 * 512)
+				x = io_size;
+		}
+		if (x == 0)
 			x = grain = 2048 * 512;
 
 		sector_offset = x / sector_size;
 
--
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