虚拟机:centos在主机和虚拟机之间传输文件

问题原因:

  想在虚拟机上跑一下安装oracle的流程,但是官网已经没有11g版本的压缩包了,遂从网盘上找资源,把安装包下载到了本机上。想把压缩文件从主机上直接复制到虚拟机上,却报了如下错误:
复制时错误:No such file or directory
  网上找到的教程说是vmware Tools又问题,遂卸载重装,中间亦走了不少弯路。
  终于vmware Tools安装好了,复制时又报了复制时错误(果然精进能力的旅途中要做很多无用功)
  后来放弃了,采用共享文件夹形式来做文件传输。记录学习与配置过程如下:

1.虚拟机 -> 设置->选择共享文件夹总是启用

在这里插入图片描述

2.配置主机路径

在这里插入图片描述
要进行传输的文件都将放在该目录下

3.配置虚拟机路径

进入centos
(1)进入mnt路径
在这里插入图片描述
(2)创建共享文件夹share_files
在这里插入图片描述
(3)挂载
在这里插入图片描述
(4)永久挂载设置
vim /etc/fstab
添加如下内容:
在这里插入图片描述
至此,教程结束,已可成功在centos虚拟机和主机之间进行文件共享。

补充说明:

命令mount -t fuse.vmhgfs-fuse .host:/ /mnt/share/ -o allow_other详解
(1)查看挂载命令的指令详情
在这里插入图片描述

options: -t

--types <list> limit the set of filesystem types
    限制文件系统类型集
--source <src> explicitly specifies source (path, label, uuid)
    显式指定源(路径、标签、uuid)
    uuid:https://baike.baidu.com/item/UUID/5921266?fr=aladdin
--target <target> explicitly specifies mountpoint
    显式指定挂载点

(2)fuse

fuse - format and options for the fuse file systems

(3)allow_other

allow_other
	      This  option  overrides  the  security measure restricting file access to the user mounting the filesystem.  So all users (including
	      root) can access the files.  This option is by default only allowed to root, but this restriction can be removed with  a	configura-
	      tion option described in the previous section.

参考链接

(1)Unix and Linux Forums
https://www.unix.com/man-page/centos/8/mount.fuse/

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐