| 1 | = Disk Alignment = |
| 2 | |
| 3 | We use a complex stack of block device tools. As it turns out, these tools will perform slightly better if they all agree on block boundaries. |
| 4 | |
| 5 | == setting up == |
| 6 | |
| 7 | here are the things to think about when setting up a disk: |
| 8 | |
| 9 | * physical disk partitions -- should start at a multiple of 8192s (where s means "512Byte sector") |
| 10 | * RAID -- mdadm should use 0.90 or 1.0 [https://raid.wiki.kernel.org/index.php/RAID_superblock_formats superblocks], which are written at the end of the device. If metadata version 1.1 or 1.2 are used, then the `data_offset` field needs to be a multiple of 8192. |
| 11 | * dm_crypt/LUKS -- `cryptsetup LuksFormat` should use `--align-payload=8192` |
| 12 | * LVM |
| 13 | * `pvcreate` should use `--dataalignment 8192s` |
| 14 | * `vgcreate` should use `--physicalextentsize 8192s` (this is currently the default) |
| 15 | |
| 16 | |
| 17 | == checking == |
| 18 | |
| 19 | * Partitions: (look at Start column -- you want multiples of 8192) `parted /dev/sda unit s print` |
| 20 | * RAID: `mdadm --examine $COMPONENTDEVICE | grep Version` |
| 21 | * dm_crypt/LUKS: `cryptsetup luksDump $BASEDEVICE | grep '^Payload offset:'` |
| 22 | * LVM |
| 23 | * Physical volumes: (look at "1st PE"): `pvs --units s -o +pe_start` |
| 24 | * Volume groups: (look at "Ext"): `vgs --units s -o +vg_extent_size` |
| 25 | |
| 26 | == fixing == |
| 27 | |
| 28 | if any of these are wrong, what do we do? |