访问网络文件共享服务
• 挂载网络共享
• 自动挂载网络共享
cifs linux&unix<----->windows
nfs linux&unix<----->linux&unix
挂载网络文件系统
• 网络文件系统是由网络附加存储服务器通过网络向多个主机提供的一种文件系统 , 而不是由块设备 ( 例如硬盘驱动器 ) 提供的。客户端通过特殊的文件系统协议和格式访问远程存储
• Linux 中有两种主要协议可用访问网络文件系统 : NFS 和CIFS 。 NFS ( Network File System ) 可看作是 Linux 、UNIX 及其它类似操作系统的标准文件系统。 CIFS( Comon Internet File System ) 则是针对 MicrosoftWindows 系统的标准网络文件系统
• 访问网络共享的三个基本步骤
– 1. 识别要访问的远程共享
– 2. 确定挂载点 ( 应该将共享挂载到的位置 ), 并创建挂载点的空目录
– 3. 通过相应的名利或配置更改挂载网络文件系统
CIFS: 通用网络文件系统
•
CIFS 是针对 Microsoft Windows 操作系统的本地网络文件系统。Linux 系统可以挂载和访问 CIFS 文件共享 , 如同常见的网络文件系统一样。然而 , 由于 CIFS 是基于 NTFS 文件系统权限模型及其自身的身份验证系统来构建的 , 因而 CIFS 协议中的所有内容并不能很好地映射到 Linux 中
• samba-client RPM 软件包所包含的 smbclient 实用程序可用来识别由 Windows 或 Samba 文件服务器提供的 CIFS 共享。该实用程序工作起来犹如在 Microsoft Windows 中单击网上邻居。然后 mount命令可用于挂载共享。访问 CIFS 共享的命令
– . 识别 :# smbclient -L instructor.example.com
– 2. 确定挂载点 :# mkdir /remote2
– 3. 挂载 :# mount //instructor.example.com/ftp /remote2
ls与!ls区别:
59 yum install samba-client.x86_64 -y
60 smbclient -L //172.25.254.250 ##识别
62 smbclient //172.25.254.250/westos1 ##确定挂载点
63 mount //172.25.254.250/westos1 /mnt ##挂载
64 mount //172.25.254.250/westos1 /mnt -o username=guest ##因为windows匿名用户名称为guest,所以直接执行63会有错误,要改名字。
65 df
66 ls
67 touch file{1..5} ##此时可以在服务器的相应挂载点上看到你建立的文件
68 ls
69 rm -fr file{1..5}
70 ls
71 history
------------------windows和linux之间共享文件系统-----------------------------------
[root@localhost mnt]# yum install samba-client.x86_64 -y
Loaded plugins: langpacks
Resolving Dependencies
--> Running transaction check
---> Package samba-client.x86_64 0:4.1.1-31.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
samba-client x86_64 4.1.1-31.el7 rhel_dvd 513 k
Transaction Summary
================================================================================
Install 1 Package
Total download size: 513 k
Installed size: 1.4 M
Downloading packages:
samba-client-4.1.1-31.el7.x86_64.rpm | 513 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : samba-client-4.1.1-31.el7.x86_64 1/1
Verifying : samba-client-4.1.1-31.el7.x86_64 1/1
Installed:
samba-client.x86_64 0:4.1.1-31.el7
Complete!
[root@localhost mnt]# smbclient -L //172.25.254.250
Enter root's password: ####不需密码,直接回车就好
Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1]
Sharename Type Comment
--------- ---- -------
westos1 Disk test share
westos2 Disk test share
westos3 Disk test share
westos4 Disk test share
westos5 Disk test share
westos6 Disk test share
westos7 Disk test share
westos8 Disk test share
westos9 Disk test share
westos10 Disk test share
IPC$ IPC IPC Service (Samba Server Version 4.1.1)
Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1]
Server Comment
--------- -------
Workgroup Master
--------- -------
[root@localhost mnt]# smbclient //172.25.254.250 westos1
\\172.25.254.250: Not enough '\' characters in service
Usage: smbclient [-?EgBVNkPeC] [-?|--help] [--usage]
[-R|--name-resolve NAME-RESOLVE-ORDER] [-M|--message HOST]
[-I|--ip-address IP] [-E|--stderr] [-L|--list HOST]
[-m|--max-protocol LEVEL] [-T|--tar <c|x>IXFqgbNan] [-D|--directory DIR]
[-c|--command STRING] [-b|--send-buffer BYTES] [-t|--timeout SECONDS]
[-p|--port PORT] [-g|--grepable] [-B|--browse]
[-d|--debuglevel DEBUGLEVEL] [-s|--configfile CONFIGFILE]
[-l|--log-basename LOGFILEBASE] [-V|--version] [--option=name=value]
[-O|--socket-options SOCKETOPTIONS] [-n|--netbiosname NETBIOSNAME]
[-W|--workgroup WORKGROUP] [-i|--scope SCOPE] [-U|--user USERNAME]
[-N|--no-pass] [-k|--kerberos] [-A|--authentication-file FILE]
[-S|--signing on|off|required] [-P|--machine-pass] [-e|--encrypt]
[-C|--use-ccache] [--pw-nt-hash] service <password>
[root@localhost mnt]# smbclient //172.25.254.250/westos1
Enter root's password:
Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1]
smb: \> ls
. D 0 Sun Apr 30 01:35:05 2017
.. D 0 Wed Dec 2 20:43:01 2015
file1 A 0 Sun Apr 30 01:34:47 2017
anaconda-ks.cfg A 8619 Sun Apr 30 01:35:06 2017
48936 blocks of size 2097152. 10655 blocks available
smb: \> !ls
passwd userfile
smb: \> exit
[root@localhost mnt]# mount //172.25.254.250/westos1 /mnt
mount: wrong fs type, bad option, bad superblock on //172.25.254.250/westos1,
missing codepage or helper program, or other error
(for several filesystems (e.g. nfs, cifs) you might
need a /sbin/mount.<type> helper program)
In some cases useful info is found in syslog - try
dmesg | tail or so.
[root@localhost mnt]# mount //172.25.254.250/westos1 /mnt -o username=guest
[root@localhost mnt]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 3160396 7313504 31% /
devtmpfs 927072 0 927072 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17036 925624 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
//172.25.254.250/westos1 100221120 78407752 21813368 79% /mnt
[root@localhost mnt]# ls
passwd userfile
[root@localhost mnt]# touch file{1..5}
[root@localhost mnt]# ls
file1 file2 file3 file4 file5 passwd userfile
[root@localhost mnt]# rm -fr file{1..5}
[root@localhost mnt]# ls
passwd userfile
[root@localhost mnt]#
------------------------------------------------------------------------------
开机自动挂载cifs
(1)可以挂载在/etc/rc.d/rc.local文件中,写在最后一行,
但此文件时系统最后扫描的,如果有些文件在开机时需要用,就不行了。故推荐第二种。
(2)72 umount /mnt
73 df
76 vim /etc/fstab
77 mount -a ##刷新没有挂载的使其挂载
78 df
79 umount /mnt
80 cat /etc/fstab
81 history
tip:做完实验要把文件删除,否则服务关闭后开机会有问题(因为服务器会关)
-----------------------------------------------------------------------------
[root@localhost mnt]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 3160352 7313548 31% /
devtmpfs 927072 0 927072 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17036 925624 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
[root@localhost mnt]# vim /etc/fstab
[root@localhost mnt]# mount -a
[root@localhost mnt]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 3160372 7313528 31% /
devtmpfs 927072 0 927072 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17036 925624 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
//172.25.254.250/westos1 100221120 78407756 21813364 79% /mnt
[root@localhost mnt]# umount /mnt
[root@localhost mnt]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed May 7 01:22:57 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=9bf6b9f7-92ad-441b-848e-0257cbb883d1 / xfs defaults 1 1
//172.25.254.250/westos1 /mnt cifs defaults,username=guest 0 0
----------------------------------------------------------------------------
NFS : 网络文件系统
• NFS ( Network File System ) 是由 Linux 、 UNIX 及其他类似操作系统使用的互联网标准协议 , 可作为它们的本地网络文件系统。它是一种活动扩展之下的开放标准 , 可支持本地 Linux 权限和文件系统功能
• Red Hat Enterprise Linux 7 在默认情况下支持 NFSv4 ( 该协议的版本 4 ), 并在该版本不可用的情况下自动回退到 NFSv3 和NFSv2 。对于在客户端上运行的所有版本的 NFS , 均应启用两种服务 : rpcbind 和 nfslock 。 NFSv4 使用 TCP 协议与服务器进行通信 , 而较早版本的 NFS 则可能使用 TCP 或 UDP
• 有两种方法用来确定由服务器提供的 NFS 导出 , 或叫做文件共享。如果服务器支持 NFSv3 或 NFSv2 , 您可以使用 showmount -eserver 命令来获取导出项列表。如果服务器支持 NFSv4 , 则可以将 / 导出项挂载到一个空目录并浏览所有导出文件系统的内容
访问 NFS 导出的命令
• 1. 识别
– # showmount -e instructor.example.com
• 2. 确定挂载点
– # mkdir /remote1
• 3. 挂载
– # mount
instructor.example.com:/var/ftp/pub /remote1
nfs与开机自动挂载:
83 yum install nfs-utils -y
84 showmount -e 172.25.254.250
85 mount 172.25.254.250:/nfsshare/nfs1 /mnt
86 df
87 ls
88 touch file{1..5}
90 touch ff{1..2}
91 touch /mnt/ff
92 rm -fr file1
93 rm -fr ff
94 cd umount /mnt
95 cd
96 umount /mnt
97 vim /etc/fstab
98 df
99 mount -a
100 df
101 cat /etc/fstab
102 umount /mnt
103 history
----------------------------------------------------------------------------
[root@localhost mnt]# yum install nfs-utils -y
Loaded plugins: langpacks
Package 1:nfs-utils-1.3.0-0.el7.x86_64 already installed and latest version
Nothing to do
[root@localhost mnt]# showmount -e 172.25.254.250
Export list for 172.25.254.250:
/nfsshare/nfs5 *
/nfsshare/nfs4 *
/nfsshare/nfs3 *
/nfsshare/nfs2 *
/nfsshare/nfs1 *
/content 172.25.0.0/255.255.0.0
[root@localhost mnt]# mount 172.25.254.250:/nfsshare/nfs1 /mnt
[root@localhost mnt]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 3160404 7313496 31% /
devtmpfs 927072 0 927072 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17040 925620 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
172.25.254.250:/nfsshare/nfs1 100221952 78411776 21810176 79% /mnt
[root@localhost mnt]# ls
passwd userfile
[root@localhost mnt]# touch file{1..5}
[root@localhost mnt]# touch file{50..55}
[root@localhost mnt]# touch ff{1..2}
[root@localhost mnt]# touch /mnt/ff
[root@localhost mnt]# rm -fr file1
[root@localhost mnt]# rm -fr ff
[root@localhost mnt]# cd umount /mnt
-bash: cd: umount: No such file or directory
[root@localhost mnt]# cd
[root@localhost ~]# umount /mnt
[root@localhost ~]# vim /etc/fstab
[root@localhost ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 3160392 7313508 31% /
devtmpfs 927072 0 927072 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17036 925624 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
[root@localhost ~]# mount -a
[root@localhost ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 3160392 7313508 31% /
devtmpfs 927072 0 927072 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17040 925620 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
172.25.254.250:/nfsshare/nfs1 100221952 78544896 21677056 79% /mnt
[root@localhost ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed May 7 01:22:57 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=9bf6b9f7-92ad-441b-848e-0257cbb883d1 / xfs defaults 1 1
172.25.254.250:/nfsshare/nfs1 /mnt nfs defaults 0 0
[root@localhost ~]# umount /mnt
[root@localhost ~]#
-----------------------------------------------------------------------------
自动挂载网络存储
•
使用 mount 命令 , 需要具有 root 用户权限以连接到网络共享。或者 , 我们可以向 /etc/fstab 添加条目 , 但是随后与网络服务器的连接将始终处于活动状态。当某一程序试图访问网络共享中的文件时 , 可以将 automounter ( 或 autofs )服务配置为 “ 按需 ” 挂载网络共享。当共享不再使用并处于不活动状态一定时间以后 ,automounter 会对共享解除挂载
• 不活动状态的时间间隔默认为五分钟 , 但该时间间隔可在
/etc/sysconfig/autofs 中进行全局更改
• [root@instructor ~]# grep TIMEOUT /etc/sysconfig/autofs
# TIMEOUT - set the default mount timeout (default 600).
TIMEOUT=300
...output omitted....
通常 , 我们需要使用网络共享在不活动状态下保持挂载一小段时间 , 从而防止在段时间内对其进行再次使用。这能够避免不必要的挂载 / 解除挂载的周期
• 在本节中 , 我们将介绍使用自动挂载器的两种方法。首先 ,使用特殊的 /net 自动挂载挂载点 , 然后手动配置间接自动挂载映射。特殊映射 /net
• 默认情况下 , autofs 服务运行时 , 存在一个名为 /net 的特殊目录 , 但是该目录将显示为空
• 访问不存在的目录 /net/instructor.example.com 会使自动挂载器创建该子目录 , 并显示该 NFS 服务器上的所有NFS 导出项。这有时称为 “ 浏览 ” 共享
– # cd /net/instructor.example.com
– # ls
– home kickstart var
• 在 /net/instructor.example.com 之下的所有文件和目录停止使用且超时期满子后 ,autofs 将共享解除挂载并删除空的 /net/instructor.example.com 子目录.
1 yum install autofs.x86_64 -y
2 cd /net ##此时报错
3 systemctl start autofs ##打开此服务
4 cd /net
5 ls
6 cd 172.25.254.250
7 ls
8 pwd
9 cd nfsshare/
10 ls
11 cd nfs2
12 pwd ##查看自己此时的工作区在哪
13 ls
14 touch yy
15 rm -fr yy
16 df
17 cd
19 vim /etc/sysconfig/autofs ##查看或更改系统设定的自动取消挂载的时间
20 df
21 systemctl restart autofs.service ##更新此服务
22 df
23 vim /etc/sysconfig/autofs
24 history
-------------------------------------------------------------------------
[root@localhost ~]# yum install autofs.x86_64 -y
Loaded plugins: langpacks
Resolving Dependencies
--> Running transaction check
---> Package autofs.x86_64 1:5.0.7-40.el7 will be installed
--> Processing Dependency: libhesiod.so.0()(64bit) for package: 1:autofs-5.0.7-40.el7.x86_64
--> Running transaction check
---> Package hesiod.x86_64 0:3.2.1-3.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
autofs x86_64 1:5.0.7-40.el7 rhel_dvd 550 k
Installing for dependencies:
hesiod x86_64 3.2.1-3.el7 rhel_dvd 30 k
Transaction Summary
================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 579 k
Installed size: 3.6 M
Downloading packages:
(1/2): hesiod-3.2.1-3.el7.x86_64.rpm | 30 kB 00:00
(2/2): autofs-5.0.7-40.el7.x86_64.rpm | 550 kB 00:00
--------------------------------------------------------------------------------
Total 5.2 MB/s | 579 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : hesiod-3.2.1-3.el7.x86_64 1/2
Installing : 1:autofs-5.0.7-40.el7.x86_64 2/2
Verifying : hesiod-3.2.1-3.el7.x86_64 1/2
Verifying : 1:autofs-5.0.7-40.el7.x86_64 2/2
Installed:
autofs.x86_64 1:5.0.7-40.el7
Dependency Installed:
hesiod.x86_64 0:3.2.1-3.el7
Complete!
[root@localhost ~]# cd /net
-bash: cd: /net: No such file or directory
[root@localhost ~]# systemctl start autofs
[root@localhost ~]# cd /net
[root@localhost net]# ls
[root@localhost net]# cd 172.25.254.250
[root@localhost 172.25.254.250]# ls
content nfsshare
[root@localhost 172.25.254.250]# pwd
/net/172.25.254.250
[root@localhost 172.25.254.250]# cd nfsshare/
[root@localhost nfsshare]# ls
nfs1 nfs2 nfs3 nfs4 nfs5
[root@localhost nfsshare]# cd nfs2
[root@localhost nfs2]# pwd
/net/172.25.254.250/nfsshare/nfs2
[root@localhost nfs2]# ls
westos
[root@localhost nfs2]# touch yy
[root@localhost nfs2]# rm -fr yy
[root@localhost nfs2]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 3164448 7309452 31% /
devtmpfs 927072 0 927072 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17048 925612 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
172.25.254.250:/nfsshare/nfs2 100221952 78413824 21808128 79% /net/172.25.254.250/nfsshare/nfs2
[root@localhost nfs2]# cd
[root@localhost ~]# vim /etc/sysconfig/aut
[root@localhost ~]# vim /etc/sysconfig/autofs
[root@localhost ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 3164528 7309372 31% /
devtmpfs 927072 0 927072 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17048 925612 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
172.25.254.250:/nfsshare/nfs2 100221952 78409728 21812224 79% /net/172.25.254.250/nfsshare/nfs2
[root@localhost ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 3164488 7309412 31% /
devtmpfs 927072 0 927072 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17048 925612 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
172.25.254.250:/nfsshare/nfs2 100221952 78409728 21812224 79% /net/172.25.254.250/nfsshare/nfs2
[root@localhost ~]# systemctl restart autofs.service
[root@localhost ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 3164488 7309412 31% /
devtmpfs 927072 0 927072 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17048 925612 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
-----------------------------------------------------------------------------
测试网络存储的自动挂载与取消
1 mkdir /westos
2 cd /westos/nfs1
3 172.25.254.250:/nfsshare/nfs1 /westos/nfs1
4 vim /etc/auto.master ##/westos /etc/auto.westos
5 vim /etc/auto.westos ##* 172.25.254.250:/nfsshare/& ##把任意的都挂载到其对应位置
6 head -10 /etc/auto.master
7 cat /etc/auto.westos
8 systemctl restart autofs.service
9 cd /westos
10 ls
11 cd nfs1
12 ls
13 pwd
14 df
15 cd /westos/nfs2
16 df
17 ls
18 df
19 date
20 df
21 cd
22 date
23 df
24 cd /westos/nfs1
25 ls
26 df
27 cd
28 history
----------------------------------------------------------------------------
[root@localhost ~]# mkdir /westos
mkdir: cannot create directory ‘/westos’: File exists
[root@localhost ~]# cd /westos/nfs1
-bash: cd: /westos/nfs1: No such file or directory
[root@localhost ~]# 172.25.254.250:/nfsshare/nfs1 /westos/nfs1
-bash: 172.25.254.250:/nfsshare/nfs1: No such file or directory
[root@localhost ~]# vim /etc/auto.master
[root@localhost ~]# vim /etc/auto.westos
[root@localhost ~]# head -10 /etc/auto.master
#
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
/misc /etc/auto.misc
/westos /etc/auto.westos ##后面文件名时自己任意指定的
#
# NOTE: mounts done from a hosts map will be mounted with the
[root@localhost ~]# cat /etc/auto.westos
* 172.25.254.250:/nfsshare/& ##把任意的都挂载到其对应位置
[root@localhost ~]# systemctl restart autofs.service
[root@localhost ~]# cd /westos
[root@localhost westos]# ls
[root@localhost westos]# cd nfs1
[root@localhost nfs1]# ls
473 508 543 579 613 649 684 719 754 79 824 86 895 93 965
474 509 544 58 614 65 685 72 755 790 825 860 896 930 966
475 51 545 580 615 650 686 720 756 791 826 861 897 931 967
476 510 546 581 616 651 687 721 757 792 827 862 898 932 968
[root@localhost nfs1]# pwd
/westos/nfs1
[root@localhost nfs1]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 3164460 7309440 31% /
devtmpfs 927072 0 927072 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17048 925612 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
172.25.254.250:/nfsshare/nfs1 100221952 78409728 21812224 79% /westos/nfs1
[root@localhost nfs1]# cd /westos/nfs2
[root@localhost nfs2]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 3164460 7309440 31% /
devtmpfs 927072 0 927072 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17048 925612 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
172.25.254.250:/nfsshare/nfs1 100221952 78410752 21811200 79% /westos/nfs1
[root@localhost nfs2]# ls
[root@localhost nfs2]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 3164460 7309440 31% /
devtmpfs 927072 0 927072 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17048 925612 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
172.25.254.250:/nfsshare/nfs2 100221952 78409728 21812224 79% /westos/nfs2
[root@localhost nfs2]# date
Sun Apr 30 02:37:36 EDT 2017
[root@localhost nfs2]# date
Sun Apr 30 02:37:42 EDT 2017
[root@localhost nfs2]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 3164460 7309440 31% /
devtmpfs 927072 0 927072 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17048 925612 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
172.25.254.250:/nfsshare/nfs2 100221952 78409728 21812224 79% /westos/nfs2
[root@localhost nfs2]# cd
[root@localhost ~]# date
Sun Apr 30 02:37:57 EDT 2017
[root@localhost ~]# date
Sun Apr 30 02:38:04 EDT 2017
[root@localhost ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 3164460 7309440 31% /
devtmpfs 927072 0 927072 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17048 925612 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
[root@localhost ~]# cd /westos/nfs1
[root@localhost nfs1]# ls
lin
[root@localhost nfs1]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 3164460 7309440 31% /
devtmpfs 927072 0 927072 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17048 925612 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
172.25.254.250:/nfsshare/nfs1 100221952 78413824 21808128 79% /westos/nfs1
[root@localhost nfs1]# cd
[root@localhost ~]# history
-----------------------------------------------------------------------------
间接映射
• 除了使用 /net 映射 , 系统管理员也可以手动配置任意目录
, 以便访问时在其子目录上 “ 按需 ” 挂载特定共享。示例:
• 间接映射使用两层配置文件语法。在顶级文件
/etc/auto.master 中 , 每个管理的 “ 父 ” 目录和包含子目录
挂载点与网络共享的单独的第二个配置文件的名称占一行
–# cat /etc/auto.master
–/demo /etc/auto.demo
–# cat /etc/auto.demo
–public -ro nfsserver.domain:/exported/path
–service autofs reload 重载 autofs 服务
–#cd /demo/public
上一个里面有应用(重难点)
[root@localhost ~]# vim /etc/auto.master
[root@localhost ~]# vim /etc/auto.westos
[root@localhost ~]# head -10 /etc/auto.master
#
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
/misc /etc/auto.misc
/westos /etc/auto.westos ##后面文件名时自己任意指定的
#
# NOTE: mounts done from a hosts map will be mounted with the
[root@localhost ~]# cat /etc/auto.westos
* 172.25.254.250:/nfsshare/& ##把任意的都挂载到其对应位置
访问网络文件共享服务相关推荐
- Linux实战教学笔记22:企业级NFS网络文件共享服务
第二十二节 企业级NFS网络文件共享服务 标签(空格分隔): Linux实战教学笔记-陈思齐 ---本教学笔记是本人学习和工作生涯中的摘记整理而成,此为初稿(尚有诸多不完善之处),为原创作品,允许转载 ...
- (转)企业级NFS网络文件共享服务
企业级NFS网络文件共享服务 原文:http://www.cnblogs.com/chensiqiqi/archive/2017/03/10/6530859.html --本教学笔记是本人学习和工作生 ...
- 28 网络文件共享服务
文章目录 网络文件共享服务 本章内容 存储类型 FTP服务 NFS服务 SAMBA服务 网络数据同步 1 存储类型 存储类型分为三种 1.1 DAS存储 1.2 NAS存储 但NAS有一个关键性问题, ...
- Linux网络文件共享服务(一)存储类型和文件传输协议FTP
成功不易,加倍努力! 网络文件共享服务 本章总目录 1 存储类型 1.1 DAS存储 1.2 NAS存储 1.3 SAN存储 1.4 三种存储比较 2 文件传输协议 FTP 2.1 FTP工作原理介绍 ...
- NFS网络文件共享服务
NFS网络文件共享服务 1.1 NFS介绍 1)什么是NFS? NFS是Network File System的缩写,中文意思是网络文件系统.它的主要功能是通过网络(一般是局域网)让不同的主机系统之间 ...
- Samba网络文件共享服务介绍
Samba网络文件共享服务 一.samba简介 Samba是一个能让Linux系统应用Microsoft网络通讯协议的软件,而SMB是Server Message Block的缩写,即为服务器消息块, ...
- 23.网络文件共享服务
文章目录 1 存储类型 1.1 DAS存储 1.2 NAS存储 1.3 SAN存储 1.4 三种存储比较 2 FTP 文件传输协议 2.1 FTP工作原理介绍 2.2 常见 FTP 相关软件 2.3 ...
- Linux 网络文件共享服务详细介绍
Linux 网络文件共享介绍 一.常见的存储类型 1.1 DAS 类型的存储 1.2 NAS 类型的存储 1.3 SAN 类型的存储 1.4 三种存储类型的比较 二.文件传输协议 FTP 2.1 FT ...
- 网络文件共享服务(三):NFS
NFS NFS用前了解及注意事项 NFS工作原理及流程 exports文件的格式 showmount命令: NFS的相关文件: NFS服务搭建及使用 NFS开启如何开启防火墙,及如何访问? NFS用前 ...
最新文章
- python使用笔记:if __name__ == ‘__main__‘ 如何理解
- 主曲率 matlab,基于Matlab的Hertz接触参数和主曲率差函数关系的拟合
- 鸿蒙发布官网,鸿蒙发布在即,高情商似乎也非常重要
- mysql数据库 集群_mysql数据库集群
- linux 查看触摸屏信息,英创信息技术eGalax触摸屏在Linux/X11下的标定方法
- NoticeBoard 一个仿原生UI的消息通知控件
- web前端基础知识-(六)jQuery-补
- CCF201312试题
- linux 查看tomcat日志 关键字
- python中ix用法_在python的pandas模块中,DataFrame对象,如何选择一行?索引、loc、iloc、ix的用法及区别...
- 华为鸿蒙与小米新系统,华为鸿蒙系统硬刚谷歌!小米也发布新系统:却选择和谷歌系统互补...
- [USACO18JAN] Lifeguards S (线段树:扫描线面积)
- Web3还没实现,Web5乍然惊现!
- 连续信号、离散信号、模拟信号与数字信号区别
- matlab 频域滤波
- 某淘宝卖家靠微头条引流,月销1000单
- 物联网安全技术——思维导图
- 放假倒计时弹幕单页网站源码
- LM个人发卡网系统开源源码「免授权」
- 测试之第四集找bug的专业与素养
热门文章
- 剑指offer-python代码解释-习题解答-空白请点击阅读更多
- 玉伯:前端的现状之痛及未来趋势
- 数据分析python PCA主成分分析
- 《制冷原理及设备》专业名词了解笔记——第一章
- Type-C分线器实现高清屏幕的理想体验
- 计算机cad理论试题,2017年cad考试试题「含答案」
- 朴素贝叶斯算法——文本分类(离散型)
- macbook pro 2015 13寸装单系统win_MacBook 全系列选购指南丨学生党或者设计师,入手哪款最合适?...
- 企业微信如何批量添加好友、导入客户联系人的微信?
- 书架添加页面html,页面如何呈现书架效果?