【virtiofs】virtio-fs-howto-qemu

https://virtio-fs.gitlab.io/howto-qemu.html

virtio-fs

环境:

  1. A Linux 5.4 or later guest kernel with virtiofs support
  2. QEMU 4.2.0 or later for built-in virtiofs support
  3. virtiofsd

guest kernel

 git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
 
 CONFIG_VIRTIO_FS
 CONFIG_FUSE_DAX   # optional

 make -j 8 && make -j 8 modules && make -j 8 modules_install && make -j 8 install

Building QEMU

git clone https://gitlab.com/qemu-project/qemu.git
cd qemu
mkdir build && cd build
../configure --prefix=$PWD --target-list=x86_64-softmmu
make -j 8 && make install

Create qcow2 img

qemu-img create -f qcow2 rootfsimage.qcow2.img  10G

Building virtiofsd

git clone https://gitlab.com/virtio-fs/virtiofsd.git
cd virtiofsd
cargo build --release

Running with virtiofs

qemu-img create -f qcow2 test-qcow2.img  10G

/usr/libexec/virtiofsd --socket-path=/tmp/vhostqemu -o source=$TESTDIR -o cache=always
  
qemu-system-x86_64 -M pc -cpu host --enable-kvm -smp 2 \
     -m 4G -object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on -numa node,memdev=mem \
     -chardev socket,id=char0,path=/tmp/vhostqemu -device vhost-user-fs-pci,queue-size=1024,chardev=char0,tag=myfs \
     -chardev stdio,mux=on,id=mon -mon chardev=mon,mode=readline -device virtio-serial-pci -device virtconsole,chardev=mon -vga none -display none \
     -drive if=virtio,file=test-qcow2.qcow2
     
#guest os
mount -t virtiofs myfs /mnt

Enabling DAX

-device vhost-user-fs-pci,queue-size=1024,chardev=char0,tag=myfs,cache-size=2G
#guest os
mount -t virtiofs myfs /mnt -o dax
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Yengi

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值