记一次Vagrantfile创建virtualbox文件夹共享 /sbin/mount.vboxsf: mounting failed with the error: No such device

过程:

    执行vagrant up 使用vagrantfile 去创建virtualbox虚拟机,想宿主机和虚拟机共享一个文件夹所以使用了config.vm.synced_folder  导致错误:


记一次Vagrantfile创建virtualbox文件夹共享 /sbin/mount.vboxsf: mounting failed with the error: No such device_第1张图片



 解决方法:

        1.在宿主机执行:  vagrant vbguest      (boxname为虚拟机名称,这一步会把宿主机次目录下的

/Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso  文件挂载到虚拟机 /tmp/VBoxGuestAdditions.iso 目录),如下图

    

        2.进入虚拟机执行:

                  linux系统执行:      sudo apt-get update && sudo apt-get install kernel-devel

                     centos系统执行:sudo yum update && sudo yum -y install kernel-headers kernel-devel


         结束后退出虚拟机


        3.宿主机执行: vagrant reload   (重启虚拟机 boxname为虚拟机名称,如下图)

        


    4.进入宿主机就可以发现文件已经共享


       如有疑问可以邮箱联系: [email protected]


 

        





你可能感兴趣的:(记一次Vagrantfile创建virtualbox文件夹共享 /sbin/mount.vboxsf: mounting failed with the error: No such device)