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
    顯式指定掛載點
相關文章
相關標籤/搜索