I'm trying to create a LVM VG and LV, but the LV is not aligned.
Here's my starting position:
% lsblk -t /dev/sdd
NAME ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE RA WSAME
sdd 0 4096 33553920 4096 512 1 mq-deadline 60 128 32M
├─sdd1 0 4096 33553920 4096 512 1 mq-deadline 60 128 32M
├─sdd2 0 4096 33553920 4096 512 1 mq-deadline 60 128 32M
└─sdd3 0 4096 33553920 4096 512 1 mq-deadline 60 128 32M
Note the ALIGNMENTs are all 0 (correct).
On sdd2, I create a VG test and then a LV align-me:
% sudo vgcreate --pvmetadatacopies 2 --vgmetadatacopies 2 test /dev/6TBd1p2
Physical volume "/dev/6TBd1p2" successfully created.
Volume group "test" successfully created
% sudo lvcreate -L 64g -n align-me test
Logical volume "align-me" created.
However, ALIGNMENT for test-align--me is wrong:
% lsblk -t /dev/sdd
NAME ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE RA WSAME
sdd 0 4096 33553920 4096 512 1 mq-deadline 60 128 32M
├─sdd1 0 4096 33553920 4096 512 1 mq-deadline 60 128 32M
├─sdd2 0 4096 33553920 4096 512 1 mq-deadline 60 128 32M
│ └─test-align--me -1 4096 0 4096 512 1 128 128 32M
└─sdd3 0 4096 33553920 4096 512 1 mq-deadline 60 128 32M
I also see the following log message (repeated 4 times):
kernel: device-mapper: table: 254:6: adding target device sdd2 caused an alignment inconsistency: physical_block_size=4096, logical_block_size=512, alignment_offset=0, start=33553920
I've calling vgcreate with --dataalignmentoffset 4k and also --dataalignment with 1m and 4m but the results are the same.
I'm running:
LVM version: 2.02.182(2) (2018-10-30)
Library version: 1.02.152 (2018-10-30)
Driver version: 4.39.0
--dataalignmentoffset 4kwhy though? You could try using--dataalignmentsame as PE size (and set PE size to something larger, e.g.64M). Mind showing avgcfgbackup(created w/o the offset) andparted unit s print?