
希望加入自动挂载 9p or Virtiofs 文件夹功能,谢谢。
目前是通过一堆代码搞定的,既然驱动层是支持的,希望能内置自动挂载功能,
======================================================
一、虚拟机飞牛OS挂载宿主机共享的文件 9P模式:
mount -t 9p unraid /vol1/1000/unraid/ -o trans=virtio,version=9p2000.L,rw,noatime,uid=1024,gid=100
二、创建开机挂载脚本,自动挂载
建立挂载脚本文件
nano /root/autostart.sh
添加内容:
#!/bin/sh
mount -t 9p unraid /vol1/1000/unraid/ -o trans=virtio,version=9p2000.L,rw,noatime,uid=1024,gid=100
2.2 给脚本文件添加可执行权限
chmod +x /root/autostart.sh
- 创建开机启动服务
3.1创建开机服务
nano /etc/systemd/system/autostart.service
添加内容:
[Unit]
Description=guazai service
After=network.target
[Service]
Type=simple
ExecStartPre=-/bin/sleep 10
ExecStart=/root/autostart.sh
User=root
Restart=always
[Install]
WantedBy=default.target
3.2 让创建的服务生效
更新systemd目录
systemctl daemon-reload
创建开机启动快捷方式
systemctl enable autostart.service
启动服务
systemctl start autostart.service
查看服务状态
systemctl status autostart.service

