Open tiancheng91 opened 1 year ago
背景: arm小主机外置tf卡存储性能太差, 与内置emmc/memdisk一起构建混合存储加速. 方案: lvm-cache 结论: lvm-cache不能放在ramdisk上,重启会丢失数据. lvm-cache配置太麻烦了, 换用juicefs缓存
dd if=/dev/zero of=/dev/shm/memcache bs=3M count=100 losetup /dev/loop0 /dev/shm/memcache losetup -d /dev/loop0
# Create volume pvcreate /dev/sdb vgcreate vg /dev/sdb lvcreate --size 400g --name lv vg mkfs.xfs /dev/vg/lv mkdir /mnt/lv mount /dev/vg/lv /mnt/lv # Write test dd bs=1M if=/dev/zero of=/mnt/lv/zero count=10000
# Create a RAM disk modprobe brd rd_nr=1 rd_size=4585760 max_part=0 pvcreate /dev/ram0 vgextend vg /dev/ram0 # Create a cache lvcreate -L 300M -n cache_meta vg /dev/ram0 lvcreate -L 4G -n cache_vol vg /dev/ram0 lvconvert –type cache-pool –poolmetadata vg/cache_meta –cachemode=writeback vg/cache_vol -y # Add cache to a LV lvconvert –type cache –cachepool vg/cache_vol vg/lv # Write test dd bs=1M if=/dev/zero of=/mnt/lv/zero2 count=10000 # Crash test echo 'c' > /proc/sysrq-trigger
背景: arm小主机外置tf卡存储性能太差, 与内置emmc/memdisk一起构建混合存储加速. 方案: lvm-cache 结论: lvm-cache不能放在ramdisk上,重启会丢失数据. lvm-cache配置太麻烦了, 换用juicefs缓存
lvm配置
新建内存块设备
lvm-volume
lvm-cache