我最近开始尝试在最新版本的 KVM/QEMU/libvirt 中支持直通文件系统。使文件系统可用于读取访问“刚刚奏效”,但我对写入访问应该如何工作感到有些困惑。在客户机中挂载文件系统后:
# mount -t 9p -o trans=virtio /fs/data /mnt
Run Code Online (Sandbox Code Playgroud)
如果现有文件具有 mode ,我可以修改它o+w:
# cd /mnt/work
# ls -l foo
-rw-rw-rw-. 1 root root 17 Dec 20 11:16 foo
# cat foo
this is line one
# echo this is line two >> foo
# cat foo
this is line one
this is line two
Run Code Online (Sandbox Code Playgroud)
但是无论目录权限如何,我都无法创建新文件或目录:
# ls -ld /mnt/work
drwxrwxrwx. 2 root root 4096 Dec 20 11:16 /mnt/work
# cd /mnt/work
# …Run Code Online (Sandbox Code Playgroud)