Monday, May 11, 2020

LVM Create RAID0 for 2 NVME SSD and 4 SATA HDD

My example application is reading and writing 256 kilobyte blocks of data.

EXT4
stride = RAID stripe / filesystem block-size
stripe-width = stride * number of data bearing drives in RAID array


XFS
su = RAID stripe in kilobytes
sw = number of data bearing drives in RAID array


RAID0 over 4x HDD
pvcreate /dev/sdc
pvcreate /dev/sdd
pvcreate /dev/sde
pvcreate /dev/sdf
vgcreate sata /dev/sdc /dev/sdd /dev/sde /dev/sdf -y
lvcreate --type raid0 -l 100%free --stripes 4 --stripesize 256 -n scratch sata -y

 > EXT4
mkfs.ext4 -b 4096 -E stride=64,stripe-width=256 /dev/mapper/sata-scratch
tune2fs -O ^has_journal /dev/mapper/sata-scratch

> XFS
mkfs.xfs -b size=4096 -d su=256k,sw=4 /dev/mapper/sata-scratch


RAID0 over 2x NVME SSD
pvcreate /dev/nvme0n1
pvcreate /dev/nvme1n1
vgcreate nvme /dev/nvme0n1 /dev/nvme1n1 -y
lvcreate --type raid0 -l 100%free --stripes 2 --stripesize 256 -n scratch nvme -y

> EXT4
mkfs.ext4 -b 4096 -E stride=64,stripe-width=128 /dev/mapper/nvme-scratch
tune2fs -O ^has_journal /dev/mapper/nvme-scratch
tune2fs -o ^discard /dev/mapper/nvme-scratch

> XFS
mkfs.xfs -b size=4096 -d su=256k,sw=2 /dev/mapper/nvme-scratch


Resources:
https://uclibc.org/~aldot/mkfs_stride.html
https://gryzli.info/2015/02/26/calculating-filesystem-stride_size-and-stripe_width-for-best-performance-under-raid/
https://erikugel.wordpress.com/tag/raid0/
https://xfs.org/index.php/XFS_FAQ#Q:_How_to_calculate_the_correct_sunit.2Cswidth_values_for_optimal_performance


sysfs interface
---------------
/sys/block/<disk>/alignment_offset
/sys/block/<disk>/<partition>/alignment_offset
/sys/block/<disk>/queue/physical_block_size
/sys/block/<disk>/queue/logical_block_size
/sys/block/<disk>/queue/minimum_io_size
/sys/block/<disk>/queue/optimal_io_size

https://people.redhat.com/msnitzer/docs/io-limits.txt

No comments:

Post a Comment