# sequential write
sudo fio --name=write_throughput --directory=. --numjobs=4 \
--size=2G --time_based --runtime=5m --ramp_time=2s --ioengine=libaio \
--direct=1 --verify=0 --bs=1M --iodepth=64 --rw=write \
--group_reporting=1 --iodepth_batch_submit=64 \
--iodepth_batch_complete_max=64
# random write
sudo fio --name=write_iops --directory=. --size=2G \
--time_based --runtime=5m --ramp_time=2s --ioengine=libaio --direct=1 \
--verify=0 --bs=4K --iodepth=256 --rw=randwrite --group_reporting=1 \
--iodepth_batch_submit=256 --iodepth_batch_complete_max=256
# sequential read
sudo fio --name=read_throughput --directory=. --numjobs=4 \
--size=2G --time_based --runtime=5m --ramp_time=2s --ioengine=libaio \
--direct=1 --verify=0 --bs=1M --iodepth=64 --rw=read \
--group_reporting=1 \
--iodepth_batch_submit=64 --iodepth_batch_complete_max=64
# random read
sudo fio --name=read_iops --directory=. --size=2G \
--time_based --runtime=5m --ramp_time=2s --ioengine=libaio --direct=1 \
--verify=0 --bs=4K --iodepth=256 --rw=randread --group_reporting=1 \
--iodepth_batch_submit=256 --iodepth_batch_complete_max=256
dd if=/dev/zero of=/tmp/output bs=64k count=100k conv=fdatasync
dd if=/tmp/output of=/dev/null bs=64k
# scan block devices
sudo lvmdiskscan
# create physical volumn
sudo pvcreate /dev/sda /dev/sdb
# list physical volumn
sudo pvs
# create volumn group
sudo vgcreate lvms /dev/sda /dev/sdb
# list volumn group
sudo vgs
# create raid0-like striped volumn
sudo lvcreate --type striped -i 2 -L 10G -n lvmcache lvms
# format
sudo mkfs.ext4 /dev/lvms/lvmcache
# mount
sudo mkdir -p /mnt/lvmcache
sudo mount /dev/lvms/lvmcache /mnt/lvmcache
# create cache meta
sudo lvcreate -n meta -L 122m lvms /dev/nvme1n1
# create cache
sudo lvcreate -n cache -L 100g lvms /dev/nvme1n1
# create slow LV
sudo lvcreate -n ebs -l 100%FREE lvms /dev/nvme2n1
# create cache
sudo lvconvert --type cache-pool --poolmetadata lvms/meta lvms/cache
# map the cache
sudo lvconvert --type cache --cachepool lvms/cache lvms/ebs
# writethrough -> writeback
sudo lvchange --cachemode writeback lvms/ebs
test with
dd bs=64k