lar*_*sks 17 virtualization filesystems libvirt qemu 9p
我最近开始尝试在最新版本的 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
# touch bar
touch: setting times of `bar': No such file or directory
# mkdir bar
# mkdir: cannot create directory `bar': Operation not permitted
Run Code Online (Sandbox Code Playgroud)
我能够找到的文档(例如,this)没有明确解决这个问题。我希望 Serverfault 的某个人可以帮助我设置一个直通文件系统,让我可以向来宾中的用户授予对主机文件系统的写访问权限。
小智 8
在我看来,这就像主机上的权限问题:
默认情况下,qemu/kvm 进程以非特权用户身份启动(Debian Wheezy 中的 libvirt-qemu)。因此,只有该用户可访问(或可写)的文件才能被 VM 来宾访问(可写)。
您可以尝试将目录的所有权设置为 qemu 运行的用户(请参阅 /etc/libvirt/qemu.conf 中的 user= 和 group=)
也许这对你的情况有帮助?
归档时间: |
|
查看次数: |
13466 次 |
最近记录: |