Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

混合存储磁盘加速 #67

Open
tiancheng91 opened this issue Feb 2, 2023 · 0 comments
Open

混合存储磁盘加速 #67

tiancheng91 opened this issue Feb 2, 2023 · 0 comments

Comments

@tiancheng91
Copy link
Owner

背景: arm小主机外置tf卡存储性能太差, 与内置emmc/memdisk一起构建混合存储加速.
方案: lvm-cache
结论:
lvm-cache不能放在ramdisk上,重启会丢失数据.
lvm-cache配置太麻烦了, 换用juicefs缓存

lvm配置

新建内存块设备

dd if=/dev/zero of=/dev/shm/memcache bs=3M count=100
losetup /dev/loop0 /dev/shm/memcache
losetup -d /dev/loop0

lvm-volume

# 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

lvm-cache

# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant