On 7/26/2011 3:11 AM, Andrzej Szymanski wrote:
On 2011-07-25 19:10, Les Mikesell wrote:
My questions for any filesystem experts are:
Is there a way to adjust the existing md partitions to get the right alignment for 4k sectors without having to do a file-oriented copy to new partitions? A resize + a dd copy to shift the position might be feasible time-wise if that would work.
I think so. Your partition starts at sector 63, you need anything divisible by 8, so:
- 64 is my expectation,
- 56 is a fallback solution if the partition does not fit on the disk
with 64 sector offset
- 2048 would be perfect (1M alignment is currently preferred by Centos 6
and many other OSs)
To be on the safe side, take the disk out of the array (mdadm -f /dev/md0 /dev/sdX1 ; mdadm -r /dev/md0 /dev/sdX1) and clear superblock using mdadm --zero-superblock /dev/sdX1.
Then repartition the disk using fdisk using the following commands: fdisk /dev/sdX u -- display units are sectors c -- no DOS compatibility (== no cyllinder rounding, you definitely want that) o -- new dos partition table n -- new partition p -- primary 1 -- partition 1 64 -- starting offset 1465144065 -- exact size here, because (just to be on the safe side) you do not want to have a larger partition on a rescue disk than on a base disk. Your partition sdh1 has 732572001 1k-blocks, as you wrote in one e-mail, multiply this by 2 (sectors) add 64, (starting offset) subtract 1 because the offset is inclusive. You get 2*732572001+64-1=1465144065. If fdisk complains that this is too much then offset 64 cannot be used and you need to repeat the procedure using offset 56 (don't forget to recalculate ending sector). t -- type fd -- linux raid autodetect w
mdadm -a /dev/mdX /dev/sdX1
And everything should be fine.
One more follow-up on this. This did work fine but it turned out that the disk I was using was defective which is probably what threw off my earlier attempts to get the alignment right. It would start with some promising values for the resync speed, but would keep slowing down more and more as it went and eventually it got to the point where there were errors reported. I returned it and the replacement is a pretty close match to the 3.5" drives in speed.