我在虚拟管理器上安装了 3 个虚拟机,并成功在主机上挂载了一个文件系统(已映射),但当我尝试在第二个虚拟机上挂载文件系统并重新启动时,出现了上述错误。我试过了,但nobootwait
无济于事/etc/fstab
,文件系统无法挂载。
我在第二个虚拟机上的内容/etc/fstab
:
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/vda1 during installation
UUID=43ac7681-6e1c-499f-8059-f5b8f3082916 / ext4 errors=remount-ro 0 1
# swap was on /dev/vda5 during installation
UUID=2f00440c-d28c-41ba-8b8a-75e816dea4a6,nobootwait none swap sw 0 0
g2 /mnt 9p trans=virtio,version=9p2000.u,rw 0 0
答案1
从以下行中删除 nobootwait
UUID=2f00440c-d28c-41ba-8b8a-75e816dea4a6,nobootwait none swap sw 0 0
还删除了行
g2 /mnt 9p trans=virtio,version=9p2000.u,rw 0 0
将以下行添加到文件/etc/rc.local
mount -t 9p -o trans=virtio,version=9p2000.L,rw g2 /mnt
当您启动 ubuntu vm 并挂载文件系统时,这将执行此命令。
答案2
您的 fstab 中有错误。该行
UUID=2f00440c-d28c-41ba-8b8a-75e816dea4a6,nobootwait none swap sw 0 0
应该
UUID=2f00440c-d28c-41ba-8b8a-75e816dea4a6 none swap sw 0 0
磁盘 ID 后面有一个空格。如果要添加 nobootwait 选项,它应该位于sw
:之后
UUID=2f00440c-d28c-41ba-8b8a-75e816dea4a6 none swap sw,nobootwait 0 0