Hi! Concerning the recent rollout of HDDs with 4 kb physical sectors and 512 byte logical ones (see: http://anandtech.com/storage/showdoc.aspx?i=3691), what's the official correct method to partition the drives using util-linux's fdisk so that the sector/partition alignment ends up being correct? There's no consensus about that, considering the following LKML thread and other threads (see below): http://www.gossamer-threads.com/lists/linux/kernel/1039141 Citing: "hpa> Martin K. Petersen wrote: >> >> Modern Windows aligns the first partition on a 1 MB boundary. >> >> As far as disks go, initially the plan was to have "legacy" branded >> drives with 63-sector alignment. But I think that has been abandoned >> in favor of instant one-time formatting. I.e. you can pick your >> poison *once* and that formatting will be done in constant time. Any >> subsequent changes to blocking and alignment will require a real >> low-level format. >> hpa> Why one-time? It's a compromise to avoid hours of low-level formatting before you can use a drive. New drives will come from the factory formatted in a special way that can be switched instantaneously. But once you start writing you're stuck with it. " also: "> Are we *sure* that this is what they plan to be doing? Is there a way > we can query the hardware to find out for sure what drives are doing > what? The drive I have that's pretending to be a 512/4k drive reports this: $ sudo sg_readcap -l /dev/sdc Read Capacity results: Protection: prot_en=0, p_type=0 Last logical block address=625142447 (0x2542eaaf), Number of logical blocks=625142448 Logical block length=512 bytes Logical blocks per physical block=3 (log base 2) [actual=8] Lowest aligned logical block address=0 Hence: Device size: 320072933376 bytes, 305245.3 MiB, 320.07 GB This disagrees with Martin's assertion." and: "martin.petersen at oracle: Matthew> This disagrees with Martin's assertion. Quick answer from one of my contacts. Desktop drives will indeed ship with an alignment of 1(*). The alignment is hardwired at time of manufacture and can't be changed. (*) I had to go back and reread the ATA spec to grok this. READ CAPACITY(16) indicates the lowest naturally aligned LBA. With LBA 63 offset in play that would be LBA 7. ATA, on the other hand, indicates how much LBA 0 is offset from the beginning of the first physical sector. If LBA 63 is naturally aligned that means that LBA 0 is offset 512 bytes (physical sector 0 starts at LBA -1 if you will). Hence IDENTIFY DEVICE word 209 will contain 0x4001. So you need to tweak your RC16 response a bit..." and: "FYI: It sounds to me like partitioning tools should totally drop efforts to align with cylinders, instead they should start asking what the unit of atomic read/writes is at the physical layer and if any offsets are needed to align the partition with the atomic write areas. That would fit better for both SSD technology and for this 4K sectors issue than trying to continue to support cylinders at all. " and this one especially important for fdisk: "> If so the issue becomes the partitioning tools (fdisk etc.) putting > the partitions at the right place. Can't those tools bypass the bios > somehow and ask the drive itself what it's geometry is? It can, but it MUST NOT do so. The fields that are to be entered into the partition table are BIOS CHS values, not any other kind of CHS. > From what I understand Vista has already made the jump and is now > ignoring CHS and instead just putting the first partition at 1 MiB > into the drive. (sector 2048 with 512 byte sectors.) > Sounds like fdisk and friends should be updated to do the same. Yes, that is way overdue." however, for the Advanced Format drives, it seems that Western Digital has made a sane move: "> The plan does seem to have changed - WD's shipping 4k sector drives that > are sane and require a drive jumper or tool for WinXP and old cloning > utilities. > http://techreport.com/discussions.x/18115 > http://wdc.com/en/products/advancedformat/ > http://www.wdc.com/wdproducts/library/whitepapers/en/2579-771430-A00.pdf Even more important, the alignment can be changed as opposed to being fixed for the manufacture of the disk. " Leaving the LKML thread, there are other places on the net where people try to establish how to properly handle these drives and not end up with block/sector misalignment: http://centos.org/modules/newbb/viewtopic.php?topic_id=24055&forum=37 "So now I get to the silly (question?): CentOS tools, like 'fdisk', 'LVM', and 'mkfs.ext3', do have options to "align right", if you know what you are doing. No need to wait for critical feature updates from upstream. But it seems that they do not offer the "4k alignment" (or whatever a particular brand of SSD prefers) by default, and that the user has to know the correct magical incantations. INET is full of "incantations", but whom can you trust? WD attempts to "educate" their customers, should we increase our awareness too?" So I figured that the best way is to ask at the source, on the mailing list of fdisk developers - what incantations are needed for the current version of fdisk and whether there are any code/documentation changes planned to clarify this and possibly add extra options to the tool? Could someone qualified write a simple fdisk HOWTO for that? Another question, would using GUID Partition Table (GPT) format be a proper solution (as the table has a fixed size of 4 * 4096 bytes)? If so, is it still true that fdisk does not support GPT (seems that it's in the TODO: http://git.kernel.org/?p=utils/util-linux-ng/util-linux-ng.git;a=blob;f=TODO;h=9df5b7b447cd4f379caae8d08b59ee18fa641544;hb=HEAD)? What are the chances that it will be implemented in the near future? -- Best Regards, Aleksander Adamowski http://olo.org.pl -- 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