CentOS与Windows共享文件夹

1.虚拟机 -> 设置
1.pngoop

2.选项 -> 共享文件夹 -> 老是启用 -> 添加 打开向导 -> 下一步
2.pngui

3.选择主机路径,即Windows系统中的文件夹,也能够新建一个指定位置的文件夹
3.pngthis

4.启用共享,点击完成
4.pngspa

5.点击肯定
5.png命令行

6.进入 CentOS,进入mnt文件夹(cd mnt,也能够在根目录直接建立文件夹:mkdir /mnt/share)
建立共享文件夹:mkdir share
挂载:mount -t fuse.vmhgfs-fuse .host:/ /mnt/share/ -o allow_other
(命令的详解在最后,若是想自定义 Linux 中 共享文件夹的位置,能够参照最后的命令解析自行改动命令)
6.png3d

7.永久挂载设置
命令:vi /etc/fstab
.host:/ /mnt/share fuse.vmhgfs-fuse allow_other 0 0
7.png
编辑完后,按键:Esc -> :wq,保存并退出
下面是个人操做历史,通常建立文件夹不会失败的,因此ls命令查看是否建立成功能够免了code

[root@localhost ~\]# history
    1 vmware-hgfsclient
    2 cd /mnt
    3 ls
    4 mkdir share
    5 ls
    6 mount -t fuse.vmhgfs-fuse .host:/ /mnt/share/ -o allow\_other
    7 cd /mnt/share
    8 ls
    9 cd /.
    10 vi /etc/fstab
    11 history
[root@localhost ~\]#

8.进入文件系统,手动查看:
8.pngblog

9.Windows 10 复制文件进入共享文件夹:
9.pngip

10.Linux 文件系统查看:
10.png
也能够命令行查看:
11.png
(这里文件不一样是由于命令行查看是我几天后新加的,因此文件有改变)ci

[root@localhost ~]# mount -h

Usage:
 mount [-lhV]
 mount -a [options]
 mount [options] [--source] <source> | [--target] <directory>
 mount [options] <source> <directory>
 mount <operation> <mountpoint> [<target>]

Mount a filesystem.

Options:
 -a, --all               mount all filesystems mentioned in fstab
 -c, --no-canonicalize   don't canonicalize paths
 -f, --fake              dry run; skip the mount(2) syscall
 -F, --fork              fork off for each device (use with -a)
 -T, --fstab <path>      alternative file to /etc/fstab
 -i, --internal-only     don't call the mount.<type> helpers
 -l, --show-labels       show also filesystem labels
 -n, --no-mtab           don't write to /etc/mtab
 -o, --options <list>    comma-separated list of mount options
 -O, --test-opts <list>  limit the set of filesystems (use with -a)
 -r, --read-only         mount the filesystem read-only (same as -o ro)
 -t, --types <list>      limit the set of filesystem types
     --source <src>      explicitly specifies source (path, label, uuid)
     --target <target>   explicitly specifies mountpoint
 -v, --verbose           say what is being done
 -w, --rw, --read-write  mount the filesystem read-write (default)

 -h, --help              display this help
 -V, --version           display version

Source:
 -L, --label <label>     synonym for LABEL=<label>
 -U, --uuid <uuid>       synonym for UUID=<uuid>
 LABEL=<label>           specifies device by filesystem label
 UUID=<uuid>             specifies device by filesystem UUID
 PARTLABEL=<label>       specifies device by partition label
 PARTUUID=<uuid>         specifies device by partition UUID
 <device>                specifies device by path
 <directory>             mountpoint for bind mounts (see --bind/rbind)
 <file>                  regular file for loopdev setup

Operations:
 -B, --bind              mount a subtree somewhere else (same as -o bind)
 -M, --move              move a subtree to some other place
 -R, --rbind             mount a subtree and all submounts somewhere else
 --make-shared           mark a subtree as shared
 --make-slave            mark a subtree as slave
 --make-private          mark a subtree as private
 --make-unbindable       mark a subtree as unbindable
 --make-rshared          recursively mark a whole subtree as shared
 --make-rslave           recursively mark a whole subtree as slave
 --make-rprivate         recursively mark a whole subtree as private
 --make-runbindable      recursively mark a whole subtree as unbindable

For more details see mount(8).
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
    显式指定挂载点
相关文章
相关标签/搜索