2009-03-16 14:51:42

by Greg Freemyer

[permalink] [raw]
Subject: Re: ATA support for 4k sector size

On Thu, Feb 26, 2009 at 5:02 PM, H. Peter Anvin <[email protected]> wrote:
> Martin K. Petersen wrote:
>>>>>>>
>>>>>>> "hpa" == H Peter Anvin <[email protected]> writes:
>>
>>>> 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.
>>>>
>>
>> hpa> Oh God.
>>
>> hpa> This is a disaster.
>>
>> Rationale being that modern Microsoft operating systems know how to
>> interpret the alignment bits. ?Legacy XP will work without changes
>> thanks to the shifted alignment. ?And Vista+ will do the right thing to
>> align partition 1 to what the drive reports.
>>
>> Also note that Windows only aligns the first partition. ?That's
>> something we need to be aware of when setting up dual boot systems.
>>
>
> Yeah, but all of this completely breaks the disk image abstraction, which is
> a very powerful paradigm.
>
> ? ? ? ?-hpa
>
If the reported geometry of these drives was changed to have sectors /
track be a multiple of 8, wouldn't that fix most of the issues.

ie. If the drive were to report 56 sectors per track, then a
traditional partitioning tool would start the first partition as
sector 56 and a Vista like partitioning tool would place the first
partition at sector 2048. Both would have the same 4K sector
alignment.

If my logic is sound, anyway to get this recommendation upstream to
hardware manufacturers. It seems like an almost trivial change for
them.

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.

Thanks
Greg
--
Greg Freemyer
Head of EDD Tape Extraction and Processing team
Litigation Triage Solutions Specialist
http://www.linkedin.com/in/gregfreemyer
First 99 Days Litigation White Paper -
http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf

The Norcross Group
The Intersection of Evidence & Technology
http://www.norcrossgroup.com


2009-03-16 16:29:18

by H. Peter Anvin

[permalink] [raw]
Subject: Re: ATA support for 4k sector size

Greg Freemyer wrote:
> If the reported geometry of these drives was changed to have sectors /
> track be a multiple of 8, wouldn't that fix most of the issues.
>
> ie. If the drive were to report 56 sectors per track, then a
> traditional partitioning tool would start the first partition as
> sector 56 and a Vista like partitioning tool would place the first
> partition at sector 2048. Both would have the same 4K sector
> alignment.
>
> If my logic is sound, anyway to get this recommendation upstream to
> hardware manufacturers. It seems like an almost trivial change for
> them.
>
> 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.

As long as BIOSes played along with it (which some of them may not do --
remember the geometry that matters is the one reported by the BIOS)
However, it definitely would be a major step in the right direction, as
it would let *most* systems Do The Right Thing instead of weirdly
misaligning the partitions and trying to cope with that.

-hpa

--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

2009-03-16 17:37:28

by Greg Freemyer

[permalink] [raw]
Subject: Re: ATA support for 4k sector size

On Mon, Mar 16, 2009 at 12:27 PM, H. Peter Anvin <[email protected]> wrote:
> Greg Freemyer wrote:
>> If the reported geometry of these drives was changed to have sectors /
>> track be a multiple of 8, wouldn't that fix most of the issues.
>>
>> ie. If the drive were to report 56 sectors per track, then a
>> traditional partitioning tool would start the first partition as
>> sector 56 and a Vista like partitioning tool would place the first
>> partition at sector 2048. ?Both would have the same 4K sector
>> alignment.
>>
>> If my logic is sound, anyway to get this recommendation upstream to
>> hardware manufacturers. ?It seems like an almost trivial change for
>> them.
>>
>> 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.
>
> As long as BIOSes played along with it (which some of them may not do --
> remember the geometry that matters is the one reported by the BIOS)
> However, it definitely would be a major step in the right direction, as
> it would let *most* systems Do The Right Thing instead of weirdly
> misaligning the partitions and trying to cope with that.
>
> ? ? ? ?-hpa

I'm not intimate with the details, but I would hope most boot loaders
by now use LBA values to find the boot code, not CHS.

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?

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

A bigger issue in my mind is lots of clones, images, etc. are probably
LBA based today and simply start the first partition at sector 63.
Thus the hardware vendors will need to have drives that perform well
with partitions that start at sector 63. The existing scheme
described may be as good as it gets for that need.

Also, how are SDD manufacturers handling this. Their erase blocks
don't align with partitions that start at sector 63 either I assume?

Greg
--
Greg Freemyer
Head of EDD Tape Extraction and Processing team
Litigation Triage Solutions Specialist
http://www.linkedin.com/in/gregfreemyer
First 99 Days Litigation White Paper -
http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf

The Norcross Group
The Intersection of Evidence & Technology
http://www.norcrossgroup.com

2009-03-16 18:12:04

by H. Peter Anvin

[permalink] [raw]
Subject: Re: ATA support for 4k sector size

Greg Freemyer wrote:
>
> I'm not intimate with the details, but I would hope most boot loaders
> by now use LBA values to find the boot code, not CHS.
>

Yes, for "true" hard drives this is pretty much universal these days
(except for MS-DOS and its ilk.) For USB and so on some BIOSes are
still stuck in old times. Sigh.

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

> A bigger issue in my mind is lots of clones, images, etc. are probably
> LBA based today and simply start the first partition at sector 63.
> Thus the hardware vendors will need to have drives that perform well
> with partitions that start at sector 63. The existing scheme
> described may be as good as it gets for that need.
>
> Also, how are SDD manufacturers handling this. Their erase blocks
> don't align with partitions that start at sector 63 either I assume?

Some SDD manufacturers (I don't know which ones) are actually examining
the partition table and doing different things. I know this because
they are permanently bricked if one writes an invalid partition table.

Not recommended.

-hpa

2009-03-18 14:33:58

by James Bottomley

[permalink] [raw]
Subject: Re: ATA support for 4k sector size

On Mon, 2009-03-16 at 10:51 -0400, Greg Freemyer wrote:
> On Thu, Feb 26, 2009 at 5:02 PM, H. Peter Anvin <[email protected]> wrote:
> > Martin K. Petersen wrote:
> >>>>>>>
> >>>>>>> "hpa" == H Peter Anvin <[email protected]> writes:
> >>
> >>>> 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.
> >>>>
> >>
> >> hpa> Oh God.
> >>
> >> hpa> This is a disaster.
> >>
> >> Rationale being that modern Microsoft operating systems know how to
> >> interpret the alignment bits. Legacy XP will work without changes
> >> thanks to the shifted alignment. And Vista+ will do the right thing to
> >> align partition 1 to what the drive reports.
> >>
> >> Also note that Windows only aligns the first partition. That's
> >> something we need to be aware of when setting up dual boot systems.
> >>
> >
> > Yeah, but all of this completely breaks the disk image abstraction, which is
> > a very powerful paradigm.
> >
> > -hpa
> >
> If the reported geometry of these drives was changed to have sectors /
> track be a multiple of 8, wouldn't that fix most of the issues.
>
> ie. If the drive were to report 56 sectors per track, then a
> traditional partitioning tool would start the first partition as
> sector 56 and a Vista like partitioning tool would place the first
> partition at sector 2048. Both would have the same 4K sector
> alignment.
>
> If my logic is sound, anyway to get this recommendation upstream to
> hardware manufacturers. It seems like an almost trivial change for
> them.

This is Ted Ts'o's proposed fix for the problem as well ... we do the
C/H/S translation in scsicam.c and it's then stored in the DOS partition
label. The only problems are that changing this on the fly might be
problematic for things that believe scsicam_bios_param without first
checking the DOS label (because they'll then be mismatched). And also,
if the vendors use their power to offset the first 4k block, we'll be
mismatched again. Plus, once the values are written in the label we
can't update them.

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

The DOS label is the problematic one ... all the rest have (mostly) more
sensible schemes. The problem is that the DOS label is the most
prevalent one.

James

2009-03-22 01:21:07

by Bill Davidsen

[permalink] [raw]
Subject: Re: ATA support for 4k sector size

H. Peter Anvin wrote:
> Greg Freemyer wrote:
>>
>> I'm not intimate with the details, but I would hope most boot loaders
>> by now use LBA values to find the boot code, not CHS.
>>
>
> Yes, for "true" hard drives this is pretty much universal these days
> (except for MS-DOS and its ilk.) For USB and so on some BIOSes are
> still stuck in old times. Sigh.
>
>> 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.
>
I can recall playing with the disk "geometry" in the expert part of fdisk and
not getting any particular bad effects, so I'm not sure why you MUST NOT other
than the SSD you mentioned. However, the reason it was long ago is that aligning
things in some possibly batter way didn't make a measurable difference in
performance, so I went back to defaults, so I agree with your advice, it doesn't
seem to help.

--
Bill Davidsen <[email protected]>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot