[CentOS] ext4, 4k sector alignment

Tue Jul 26 05:31:45 UTC 2011
Nataraj <incoming-centos at rjl.com>

On 07/25/2011 10:10 AM, Les Mikesell wrote:
> I've mentioned this problem before but put off doing anything about it 
> and maybe now someone can suggest the best solution.
>
> I have a 3-member RAID1 set where one of the members is periodically 
> swapped and rotated offsite.  The filesystem contains a backuppc archive 
> which has millions of hardlinks that make it impractical to copy with a 
> file-oriented approach.  The current filesystem is ext3 with one 
> partition that uses the entire disk capacity (no lvm).  It works as is, 
> but...
>
> I'd like to use a laptop size drive for the swapped member and the only 
> ones available that match the size have 4k sectors.  I have swappable, 
> trayless SATA bays available for both drive sizes.  The problem is that 
> with the current partition layout, the drive with 4k sectors takes more 
> than a day to re-sync even though on read access the speed is a match 
> for the full sized drives that sync in a few hours.
>
> 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.
>
> Is it worth converting to ext4?
>
> Is there a difference between doing this on 5.6 or 6.x?
>
> If I start over from scratch with 6.x, will the partitioning tools 
> automatically align for 4k sector drives (with/without lvm?)?
>
For LVM's see the --dataalignment and --dataalignmentoffset options. 
For md devices, my understanding is that the raid superblock is at the
end of the partition, so the data is aligned with wherever the partition
starts.  I verified this using: 
     hexdump /dev/md1 | head -6
     hexdump /dev/sda4 | head -6

Nataraj