[parted-devel] Trying to figure out whats going wrong with sun disk label (off by one?)
Bryce
bryce at zeniv.linux.org.uk
Thu Nov 1 10:24:54 UTC 2012
On 31/10/12 20:59, Phillip Susi wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 10/30/2012 8:15 AM, Bryce wrote:
>
>> Partition alignment seems to be set for cylinder boundry's so
>> sectors * heads (255 * 63 = 16065 but is this not wrong since
>> sector and head 0 exist so the math should work out as 256*64 =
>> 16384 instead? or am I the victim of lack of sleep? (technically I
>> guess LBA drives logically don't give a damn)
>>
> There are 63 sectors, numbered 0-62, thus a cylinder is 63 * 255 sectors.
>
Oh, ok,.. 0-62 it is then,. I've always assumed that it ran 0-63 (ie 64
sectors) Then again It's been decades since I've had to meddle with CHS
disk details since it's usually all LBA with little regard for CHS values.
>> Similarly the python call to
>> optimumAlignment.intersect(disk.partitionAlignment) is WAAAAAAAY
>> out of whack being some weird 15.68 *GB* interval, which seems to
>> be the cylinder boundry * 2048. What the correct math for that
>> should be I'm unclear on. I think the code is trying to find the
>> least common multiple which would spilt out that value. If so the
>> LCM would be 16384 (16Mb) which would be significantly more sane.
>> I'd just like to confirm that this is the source of the wild values
>> I'm getting and that fixing the math would fix the issue so that
>> I'm not trashing some other consideration I'm being ignorant of.
>>
> The math looks correct to me, the question is why are you trying to
> align *both* to a cylinder boundary *and* to a MiB boundary?
>
>
I'm probably misreading the docs here. The material I have states that
partition alignment for SMI VTOC label drives (Sun disk label) is to be
done on cylinder boundaries. So I would expect it to be 63*255 = 16065
given your correction. So,..
>>> print disk.partitionAlignment
parted.Alignment instance --
offset: 0 grainSize: 16065
would be correct, Fair enough. I would have considered that value to be
what I need for Sun label alignment, but I'm working from the anaconda
alignment code
anaconda/storage/formats/disklabel.py: def alignment(self), which ping
pongs it's way through exceptions to
try:
a = optimum_device_alignment.intersect(disklabel_alignment)
except (ArithmeticError, AttributeError):
try:
a =
minimum_device_alignment.intersect(disklabel_alignment)
except (ArithmeticError, AttributeError):
a = disklabel_alignment
self._alignment = a
Although I've just poked at a later fc18 version and it looks like they
abandoned that to use
#self._alignment = a
# order is important here set with minimal THEN if possible
overwrite
# with the optimal value
if minimum_device_alignment is not None:
self._alignment = optimum_device_alignment
if optimum_device_alignment is not None:
self._alignment = optimum_device_alignment
instead,.. -sigh- never mind 8/ I was trying to make sense of the older
code which seems to have been changed since, though it looks to be MiB
boundary specific.
More information about the parted-devel
mailing list