Unraid Windows虚拟机使用Virtio-FS共享文件
2023-4-11
| 2023-11-1
字数 624阅读时长 2 分钟
type
status
date
slug
summary
tags
category
icon
password
Property
Nov 1, 2023 02:30 PM

virtiofs

unraid目前支持通过virtiofs的方式直接挂在挂载宿主机目录(不基于网络), 效率要远好于smb/nfs
Virtiofs is a shared file system that lets virtual machines access a directory tree on the host. Unlike existing approaches, it is designed to offer local file system semantics and performance.
 
对已经创建的VM使用virtiofs需要在xml下进行如下修改

usage

在windows VM下需要安装额外的驱动: virtiofs已经包含在virtio-win.iso中, 但是还需要winFsp
WinFsp is system software that provides runtime and development support for custom file systems on Windows computers.
 
virtio-win.iso会安装如下Service
notion image
在winFsp安装好后, 需要配置一下与该Service的联动关系
在cmd管理员模式下(powershell不支持下面命令)
Note: 上述设置, 如果在host中设置了多个挂载点, 只能挂载最后一个, 原因如下
Multiple mounts can't be served by VirtIO-FS service because it's a single process, but WinFsp.Launcher service can run multiple VirtIO-FS processes:
 
如果需要挂载多个硬盘, 需要进行如下操作:
先把VirtioFsSvc停止并关闭自动启动(不执行上述命令就行):
-i 可以酌情添加, 表示CaseInsensitive. 如果是用来安装一些软件, 该选项可以提高兼容性.
 
 
Note:
  • Here viofsY and viofsZ are instance names for WinFsp.Launcher. They are selected arbitrary, but must differ between instances.
  • 上述命令只能在cmd(admin)下运行, 不支持powershell
 
 
BAT脚本 (使用win下的“任务计划程序”设置为开机以管理员身份运行):
Note: 需要等待WinFsp.Launcher启动后才能执行命令, 否则是无效的.
 
有关WinFsp.Launcher和fsreg.bat更多说明:
 
Virtio-FS之前在windows上有个case-sensitive issue(#669), 不过目前已经被解决
  • in the Windows guest, open regedit, add HKEY_LOCAL_MACHINE\SOFTWARE\VirtIO-FS\CaseInsensitive as a DWORD with value 1 and restart the virtio-fs service or reboot.
  • Alternatively, the virtiofs binary can be started with -i.
 
  • 工具
  • 微信小技巧合集OpenRGB实现海盗船k70 音乐律动
    Loading...