fixing badly aligned storage
Table of Contents
In the olden days, one would have to manually calculate[1] to get a file system (FS), in a logical volume (LV) that was part of a volume group (VG) living on a software RAID, properly aligned. I would get this calculation wrong in about 10% of the cases.
These days, modern Linux distributions like Fedora 14 and RHEL 6 parse hints from the storage.
But, I had a VG that I had been using since Fedora 9 and it was one of those 10% I calculated wrong. The following steps got me nicely aligned FS (you want 0 in /sys/block/dm-*/alignment_offset
at the end of the procedure):
- plugged in a temporary HD to contain the LVs while re-doing the RAID
- pvadd the temporary HD
- if you have swap on an LV, do `swapoff -a` before attempting to pvmove
- pvmove from the old PV (where alignment_offset is not 0)
- pvremove old RAID device
- tear down the badly aligned software RAID
- remove RAID component partitions
- set up in F14/RHEL6 (as per docs linked above)
- pvadd the newly recreated RAID
- pvmove away from the temp HD
- pvremove the temp HD
- check that `/etc/mdadm.conf` does not contain references to the old RAID
[1] links I used previously to calculate the offset
- http://www.ibm.com/developerworks/linux/library/l-4kb-sector-disks/index.html?ca=dgr-lnxw074KB-Disksdth-LX
- https://orezpraw.com/blog/your-filesystem-starts-where
- http://insights.oetiker.ch/linux/raidoptimization.html
- http://tldp.org/HOWTO/html_single/Software-RAID-HOWTO
- http://tldp.org/HOWTO/html_single/LVM-HOWTO/
- http://wiki.centos.org/HowTos/Disk_Optimization