美文网首页
mac 下Virtual Box 与linux共享文件夹配置

mac 下Virtual Box 与linux共享文件夹配置

作者: UUID | 来源:发表于2020-03-16 19:53 被阅读0次

    由于测试的东西内核版本不一样,所以新装了版本的,但是发现文件共享有问题,我另一个虚拟机是OK的,早就忘了以前是怎么弄的了,人不能在同一个坑栽多次不是么?好记性不如烂笔头,所以特此记录解决过程:

    1、正常配置文件共享,如下图:


    image.png

    但是启动linux 客户机,执行sudo mount 发现并没有生效,/mnt/mac_share下面并没有任何东西

    安装客户端增强工具,报错:


    image.png

    手动mount工具:

    jin@k53:~$ sudo mount  /dev/cdrom  /media/cdrom
    [sudo] password for jin: 
    mount: unknown filesystem type 'iso9660'
    

    2、解决问题:
    2.1 未知的文件类型iso9660

    jin@k53:~$ sudo apt-get install --reinstall linux-image-$(uname -r)
    

    安装好以后,重新mount

    jin@k53:~$ sudo mount  /dev/cdrom  /media/cdrom
    mount: block device /dev/sr0 is write-protected, mounting read-only
    jin@k53:~$ cd /media/cdrom/
    jin@k53:/media/cdrom$ ls
    AUTORUN.INF  OS2        VBoxDarwinAdditions.pkg            VBoxLinuxAdditions.run    VBoxWindowsAdditions-amd64.exe  VBoxWindowsAdditions.exe  cert
    NT3x         TRANS.TBL  VBoxDarwinAdditionsUninstall.tool  VBoxSolarisAdditions.pkg  VBoxWindowsAdditions-x86.exe    autorun.sh                runasroot.sh
    jin@k53:/media/cdrom$ sudo ./VBoxLinuxAdditions.run 
    ......
    This system is currently not set up to build kernel modules.
    Please install the gcc make perl packages from your distribution.
    Running kernel modules will not be replaced until the system is restarted
    vboxadd-service.sh: Starting VirtualBox Guest Addition service.
    jin@k53:/media/cdrom$ sudo apt install gcc make perl
    

    2.2 报错了,发现有依赖没有安装,那就安装依赖:

    This system is currently not set up to build kernel modules.
    Please install the gcc make perl packages from your distribution.
    Running kernel modules will not be replaced until the system is restarted
    vboxadd-service.sh: Starting VirtualBox Guest Addition service.
    jin@k53:/media/cdrom$ sudo apt install gcc make perl
    ......
    jin@k53:/media/cdrom$ sudo ./VBoxLinuxAdditions.run 
    .....
    Building the VirtualBox Guest Additions kernel modules.  This may take a while.
    To build modules for other installed kernels, run
      /sbin/rcvboxadd quicksetup <version>
    or
      /sbin/rcvboxadd quicksetup all
    Running kernel modules will not be replaced until the system is restarted
    vboxadd-service.sh: Starting VirtualBox Guest Addition service.
    

    3、安装好以后,重新启动

      ~ ssh226
    Welcome to Ubuntu 14.04.6 LTS (GNU/Linux 4.4.0-142-generic x86_64)
    
    Your Hardware Enablement Stack (HWE) is supported until April 2019.
    Last login: Mon Mar 16 19:27:53 2020 from 10.0.2.2
    jin@k53:~$ sudo mount
    [sudo] password for jin: 
    /dev/sda1 on / type ext4 (rw,errors=remount-ro)
    proc on /proc type proc (rw,noexec,nosuid,nodev)
    sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
    none on /sys/fs/cgroup type tmpfs (rw)
    none on /sys/fs/fuse/connections type fusectl (rw)
    none on /sys/kernel/debug type debugfs (rw)
    none on /sys/kernel/security type securityfs (rw)
    udev on /dev type devtmpfs (rw,mode=0755)
    devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
    tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
    none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
    none on /run/shm type tmpfs (rw,nosuid,nodev)
    none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
    none on /sys/fs/pstore type pstore (rw)
    systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
    VM_share on /mnt/mac_share type vboxsf (ttl=0,gid=999,rw)
    jin@k53:~$ 
    

    这样,mac和虚拟机之间的文件共享就OK了

    相关文章

      网友评论

          本文标题:mac 下Virtual Box 与linux共享文件夹配置

          本文链接:https://www.haomeiwen.com/subject/hkdoehtx.html