Linux 2 unit7 挂载网络共享
##挂载网络共享###
###文件的共享(samba)###
[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.2.3-10.el7 will be installed
--> Processing Dependency: samba-common = 4.2.3-10.el7 for package: samba-client-4.2.3-10.el7.x86_64
--> Processing Dependency: samba-common = 4.2.3-10.el7 for package: samba-client-4.2.3-10.el7.x86_64
Installed:
samba-client.x86_64 0:4.2.3-10.el7
Dependency Installed:
samba-client-libs.x86_64 0:4.2.3-10.el7
samba-common-libs.x86_64 0:4.2.3-10.el7
samba-common-tools.x86_64 0:4.2.3-10.el7
Complete!
[root@localhost mnt]# smbclient -L //172.25.254.250 ##共享此ip下的文件
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 ##进入到westos1
Enter root's password:
Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1]
smb: \> ls
. D 0 Sun Apr 30 01:32:45 2017
.. D 0 Wed Dec 2 20:43:01 2015
100221120 blocks of size 1024. 21820400 blocks available
smb: \> !ls ##查看本机有什么
creat_user.sh passwd userfile
file.sh rule westos
smb: \> put file.sh
putting file file.sh as \file.sh (32.7 kb/s) (average 32.7 kb/s)
smb: \> exit
[root@localhost ~]# mount //172.25.254.250/westos1 /mnt -o username=guest
[root@localhost ~]# touch xiao
[root@localhost ~]# cd mnt/
[root@localhost mnt]# touch xiao
[root@localhost mnt]# rm -f xiao
[root@localhost mnt]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 4230560 6243340 41% /
devtmpfs 922268 0 922268 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17028 925632 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
/dev/sr0 3654720 3654720 0 100% /run/media/root/RHEL-7.0 Server.x86_64
//172.25.254.250/westos1 100221120 78405328 21815792 79% /mnt
[root@localhost mnt]# touch file1
[root@localhost mnt]# touch file2
[root@localhost mnt]# exit
###开机自动挂载###
[root@localhost ~]# vim /etc/fstab
[root@localhost ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 4230600 6243300 41% /
devtmpfs 922268 0 922268 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17028 925632 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
/dev/sr0 3654720 3654720 0 100% /run/media/root/RHEL-7.0 Server.x86_64
//172.25.254.250/westos1 100221120 78407756 21813364 79% /mnt
[root@localhost ~]# mount -a
[root@localhost ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 4230600 6243300 41% /
devtmpfs 922268 0 922268 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17028 925632 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
/dev/sr0 3654720 3654720 0 100% /run/media/root/RHEL-7.0 Server.x86_64
//172.25.254.250/westos1 100221120 78407756 21813364 79% /mnt
做下次实验室时保证实验环境干净##
[root@localhost ~]# vim /etc/fstab
[root@localhost ~]# mount -a
[root@localhost ~]# umount /mnt/
[root@localhost ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 4230584 6243316 41% /
devtmpfs 922268 0 922268 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17028 925632 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
/dev/sr0 3654720 3654720 0 100% /run/media/root/RHEL-7.0 Server.x86_64
###nfs-utils共享软件
[root@localhost ~]# yum install nfs-utils.x86_64 -y ##安装nfs共享软件
Loaded plugins: langpacks
Resolving Dependencies
--> Running transaction check
---> Package nfs-utils.x86_64 1:1.3.0-0.el7 will be updated
---> Package nfs-utils.x86_64 1:1.3.0-0.21.el7 will be an update
--> Processing Dependency: gssproxy >= 0.3.0-0 for package: 1:nfs-utils-1.3.0-0.21.el7.x86_64
Dependencies Resolved
===================================================
Package Arch Version Repository
Size
===================================================
Updating:
nfs-utils x86_64 1:1.3.0-0.21.el7
rhel_dvd 370 k
Installing for dependencies:
gssproxy x86_64 0.4.1-7.el7 rhel_dvd 84 k
libbasicobjects
x86_64 0.1.1-25.el7 rhel_dvd 25 k
libcollection x86_64 0.6.2-25.el7 rhel_dvd 40 k
libini_config x86_64 1.2.0-25.el7 rhel_dvd 59 k
libpath_utils x86_64 0.2.1-25.el7 rhel_dvd 27 k
libref_array x86_64 0.1.5-25.el7 rhel_dvd 26 k
libverto-tevent
x86_64 0.2.5-4.el7 rhel_dvd 9.0 k
Updating for dependencies:
krb5-libs x86_64 1.13.2-10.el7 rhel_dvd 837 k
Transaction Summary
===================================================
Install ( 7 Dependent packages)
Upgrade 1 Package (+1 Dependent package)
Total size: 1.4 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updated:
nfs-utils.x86_64 1:1.3.0-0.21.el7
Dependency Updated:
krb5-libs.x86_64 0:1.13.2-10.el7
Complete!
[root@localhost ~]# 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 ~]# mount 172.25.254.250:/nfsshare/nfs1 /mnt/
[root@localhost ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 4231560 6242340 41% /
devtmpfs 922268 0 922268 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17032 925628 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
/dev/sr0 3654720 3654720 0 100% /run/media/root/RHEL-7.0 Server.x86_64
172.25.254.250:/nfsshare/nfs1 100221952 78403584 21818368 79% /mnt
[root@localhost ~]# cd /mnt/
[root@localhost mnt]# ls
[root@localhost mnt]# touch xiaoxiaoxiao
[root@localhost mnt]# ls
xiaoxiaoxiao
[root@localhost mnt]# rm -fr xiaoxiaoxiao
[root@localhost mnt]# cd
[root@localhost ~]# umount /mnt
[root@localhost ~]# vim /etc/fstab
[root@localhost ~]# mount -a
[root@localhost ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 4231600 6242300 41% /
devtmpfs 922268 0 922268 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17032 925628 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
/dev/sr0 3654720 3654720 0 100% /run/media/root/RHEL-7.0 Server.x86_64
172.25.254.250:/nfsshare/nfs1 100221952 78411776 21810176 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 ~]# yum install autofs.x86_64 -y
Loaded plugins: langpacks
Resolving Dependencies
--> Running transaction check
---> Package autofs.x86_64 1:5.0.7-54.el7 will be installed
--> Processing Dependency: libhesiod.so.0()(64bit) for package: 1:autofs-5.0.7-54.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-54.el7 rhel_dvd 793 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: 823 k
Installed size: 5.1 M
Downloading packages:
(1/2): hesiod-3.2.1-3.el7.x86 | 30 kB 00:00
(2/2): autofs-5.0.7-54.el7.x8 | 793 kB 00:00
---------------------------------------------------
Total 3.0 MB/s | 823 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-54.el7.x86_64 2/2
Verifying : 1:autofs-5.0.7-54.el7.x86_64 1/2
Verifying : hesiod-3.2.1-3.el7.x86_64 2/2
Installed:
autofs.x86_64 1:5.0.7-54.el7
Dependency Installed:
hesiod.x86_64 0:3.2.1-3.el7
Complete!
[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 nfs3
[root@localhost nfs3]# ls
[root@localhost nfs3]# touch xiao
[root@localhost nfs3]# rm -fr xiao
[root@localhost nfs3]# ls
[root@localhost nfs3]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 4237048 6236852 41% /
devtmpfs 922268 0 922268 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17044 925616 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
/dev/sr0 3654720 3654720 0 100% /run/media/root/RHEL-7.0 Server.x86_64
172.25.254.250:/nfsshare/nfs1 100221952 78411776 21810176 79% /mnt
172.25.254.250:/nfsshare/nfs3 100221952 78411776 21810176 79% /net/172.25.254.250/nfsshare/nfs3
[root@localhost nfs3]# vim /etc/sysconfig/autofs ##在配置文件中更改自动挂载不使用卸载时间
[root@localhost nfs3]# umount /mnt
[root@localhost nfs3]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 4237068 6236832 41% /
devtmpfs 922268 0 922268 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17044 925616 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
/dev/sr0 3654720 3654720 0 100% /run/media/root/RHEL-7.0 Server.x86_64
[root@localhost ~]# mkdir /westos
[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 a 'master' automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(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/& ##将任意挂载到/nfsshare/下面
[root@localhost ~]# systemctl restart autofs.service
[root@localhost ~]# cd /westos
[root@localhost westos]# ls
[root@localhost westos]# cd nfs1
[root@localhost nfs1]# pwd
/westos/nfs1
[root@localhost nfs1]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 4237068 6236832 41% /
devtmpfs 922268 0 922268 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17048 925612 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
/dev/sr0 3654720 3654720 0 100% /run/media/root/RHEL-7.0 Server.x86_64
172.25.254.250:/nfsshare/nfs1 100221952 78409728 21812224 79% /westos/nfs1
[root@localhost nfs1]# cd
[root@localhost ~]# cd /westos/nfs2
[root@localhost nfs2]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 4237068 6236832 41% /
devtmpfs 922268 0 922268 0% /dev
tmpfs 942660 84 942576 1% /dev/shm
tmpfs 942660 17048 925612 2% /run
tmpfs 942660 0 942660 0% /sys/fs/cgroup
/dev/sr0 3654720 3654720 0 100% /run/media/root/RHEL-7.0 Server.x86_64
172.25.254.250:/nfsshare/nfs2 100221952 78413824 21808128 79% /westos/nfs2
Linux 2 unit7 挂载网络共享相关推荐
- Linux系统搭建NFS网络共享存储
Linux系统搭建NFS网络共享存储 一.NFS概述: NFS是一种基于TCP/IP传输的网络文件系统协议,最初由SUN公司开发.通过NFS协议,客户机可以像访问本地目录一样访问远程服务器中的共享资源 ...
- Windows Server 2008 使用“net use”挂载网络共享时“发生系统错误53”的解决方案
Windows Server 2008 通过net命令挂载网络共享,命令如下 net use z: \\10.9.13.33\nfsbackup /user:bak backup 抛出错误:发生系统错 ...
- Linux通过手机USB网络共享上网
Linux通过手机USB网络共享上网 因为各种各样的原因,Linux系统有时无法通过自身网卡接入互联网,而需要通过手机才能接入互联网. 设置方法如下: 1.连接好数据线并在手机设置中打开"U ...
- SD卡启动tiny4412标准版(1306)的linux系统并挂载网络根文件系统
uboot编译平台环境:64位win8.1的虚拟机vmware10下的ubuntu-12.04.5-64bit 交叉编译工具链为: arm-linux-gcc-4.5.1 uboot压缩包: ...
- linux启动自动挂载共享文件,linux中自动挂载windows 共享目录
使用smb协议挂载很难解决乱码问题,使用cifs则没乱码问题 linux访问Windows共享文件夹或者使用其它linux机器使用samba的共享目录 1.Windows共享一个文件夹share, 开 ...
- linux挂载windows共享目录报错,linux通过cifs挂载windows共享目录
1.在linux上执行以下命令: [root@localhost ~]# mount -t cifs -o username=shenhb,password=111111,iocharset=gb23 ...
- linux下挂载samba服务器,Linux使用mount挂载samba共享
mysql can't create threads in threadpool 最近,我们在券商端的mysql运行一段时间后,发生mysql can't create threads ...
- linux挂载cifs命令,如何使用 CIFS 在 Linux上挂载 Windows 共享
在Linux和UNIX操作系统上,可以使用mount命令的cifs选项将Windows共享安装在本地目录树中的特定安装点上. 通用Internet文件系统(CIFS)是一种网络文件共享协议.CIFS是 ...
- linux如何挂载nfs共享目录,在Linux中,如何挂载NFS共享
网络文件系统( NFS )是一种分布式文件系统协议,允许你通过网络共享远程目录,使用NFS,可以在系统上挂载远程目录,并像使用本地文件一样使用远程文件. 在Linux和UNIX操作系统上,可以使用mo ...
最新文章
- 《创业维艰分享之五》所有得,有所乐,日事日清,循序渐进。
- swift_028(Swift 的协议)
- Linux内核分析:完成一个简单的时间片轮转多道程序内核代码
- uboot添加自定义命令
- android gradle abi mips x86,NDK android Error:Expected caller to ensure valid ABI: MIPS
- PowerDNS管理工具开发中学习到的DNS知识
- Idea创建简单Java Web项目并部署Servlet
- 【知识整理】这可能是最好的RxJava 2.x 入门教程(四)
- Fastjson实用工具类,List转JSONString,List转JSONArray,JSONArray转List,JSONArray转ArrayList,JSONObject转HashMap
- css 清除表单样式,css form表单样式清除
- 模式识别和机器视觉智能方面的论文投稿---国际著名期刊杂志论文投稿
- Android Metro风格的Launcher开发系列第三篇
- GPL授权GPL到底是什么?为什么MySQL可以收费?
- MacOS开发-用命令行压缩文件
- 伦敦经济学院开设加密货币相关课程
- 使用lnmp安装zabbix3.4.4并设置163邮箱报警(超详细)
- 基于Hive的搜狗搜索日志与结果Python可视化设计
- CodeForces 3B-Lorry
- 如何看待PMP的2022年11月新考纲?
- 「Android渲染」图像是怎样显示到屏幕上的?