= Disk Alignment = 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. Common block boundaries are powers of two, and the largest block boundaries i've heard of on modern equipment are 4MiB in size (in particular, this is [https://lwn.net/Articles/428584/ the eraseblock size on certain large flash devices]). So this suggestion is to align on 4MiB boundaries (as that will also guarantee alignment on smaller power-of-two boundaries). == setting up == here are the things to think about when setting up a disk: * physical disk partitions -- should start at a multiple of 8192s (where s means "512Byte sector"). See [wiki:install_debian debian install page] for more details. * 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. [http://www.issociate.de/board/goto/2027709/Alignment_of_RAID_on_specific_boundary.html there does not seem to be a way to force a custom data_offset with metadata 1.1 or 1.2] (i filed [DebianBug:614841] as a wishlist). in squeeze, 1.2 is the default, so use `--metadata 1.0` during `mdadm --create` :( * dm_crypt/LUKS -- `cryptsetup LuksFormat` should use `--align-payload=8192` * LVM * `pvcreate` should use `--dataalignment 8192s` * `vgcreate` should use `--physicalextentsize 8192s` (this is currently the default) == checking == * Partitions: (look at Start column -- you want multiples of 8192) `parted /dev/sda unit s print` * RAID: `mdadm --examine $COMPONENTDEVICE | grep Version` * if the version is 1.1 or 1.2, then look at the data offset: `mdadm --examine $COMPONENTDEVICE | grep 'Data Offset:` * dm_crypt/LUKS: `cryptsetup luksDump $BASEDEVICE | grep '^Payload offset:'` (this reports [http://sources.debian.net/src/cryptsetup/2:1.6.6-5/lib/libcryptsetup.h/?hl=981#L973 in sectors apparently], which means that we want to make sure it's a multiple of 8192 as well. * LVM * Physical volumes: (look at "1st PE"): `pvs --units s -o +pe_start` (this should be a multiple of 8192S) * Volume groups: (look at "Ext"): `vgs --units s -o +vg_extent_size` (this should be a multiple of 8192S as well) See also [source:puppet/modules/mayfirst/files/misc-utils/mf-check-block-alignment mf-check-block-alignment] == fixing == if any of these are wrong, what do we do?