Linux挂载
设备:两台centos6OS安装的时候选择的是"BasicServer"软件配置包。
首先,让两台机器都安装NFS的软件包,如下显示的是服务器端:
[root@roothomes/home]$yum-yinstallnfs-utilsrpcbind
Loadedplugins:fastestmirror
Loadingmirrorspeedsfromcachedhostfile
*base:centos.ustc.edu.cn
*extras:centos.ustc.edu.cn
*updates:centos.ustc.edu.cn
SettingupInstallProcess
Packagerpcbind-0.2.0-8.el6.x86_64alreadyinstalledandlatestversion
ResolvingDependencies
-->Runningtransactioncheck
--->Packagenfs-utils.x86_641:1.2.3-15.el6settobeupdated
-->FinishedDependencyResolution
DependenciesResolved
================================================================================
PackageArchVersionRepositorySize
================================================================================
Updating:
nfs-utilsx86_641:1.2.3-15.el6base308k
TransactionSummary
================================================================================
Install0Package(s)
Upgrade1Package(s)
Totaldownloadsize:308k
Isthisok[y/N]:y
DownloadingPackages:
nfs-utils-1.2.3-15.el6.x86_64.rpm|308kB00:10
warning:rpmts_HdrFromFdno:HeaderV3RSA/SHA1Signature,keyIDc105b9de:NOKEY
base/gpgkey|3.3kB00:00...
ImportingGPGkey0xC105B9DE"CentOS-6Key(CentOS6OfficialSigningKey)"from/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Isthisok[y/N]:y
Runningrpm_check_debug
RunningTransactionTest
TransactionTestSucceeded
RunningTransaction
Updating:1:nfs-utils-1.2.3-15.el6.x86_641/2
Cleanup:1:nfs-utils-1.2.2-7.el6.x86_642/2
Updated:
nfs-utils.x86_641:1.2.3-15.el6
Complete!
[root@roothomes/home]$
服务器端:
###(建立挂载的目录,并且挂载目录。)
[root@roothomes/etc]$mkdir/opt/centos6
[root@roothomes/etc]$cd/opt/centos6/
[root@roothomes/opt/centos6]$mkdirthisISnfsFile
[root@roothomes/opt/centos6]$ls
thisISnfsFile
[root@roothomes/etc]$vi/etc/exports
[root@roothomes/opt/centos6]$cat/etc/exports
/opt/centos6192.168.1.0/24(ro,no_root_squash)
###备注:/opt/centos6表示nfs共享的目录192.168.1.0-192.168.1.254区间的IP可以访问,访问权限是自读,root用户
###(启动对应的服务)
[root@roothomes/opt/centos6]$chkconfignfson
[root@roothomes/opt/centos6]$/etc/init.d/rpcbindstart
[root@roothomes/opt/centos6]$/etc/init.d/nfsstart
StartingNFSservices:[OK]
StartingNFSquotas:[OK]
StartingNFSdaemon:[OK]
StartingNFSmountd:[OK]
[root@roothomes/opt/centos6]$serviceiptablesstop
iptables:Flushingfirewallrules:[OK]
iptables:SettingchainstopolicyACCEPT:filter[OK]
iptables:Unloadingmodules:[OK]
客户端:
[root@roothomes/home]$yum-yinstallnfs-utilsrpcbind
安装完毕!
[root@vmBS00~]#serviceiptablesstop
iptables:Flushingfirewallrules:[OK]
iptables:SettingchainstopolicyACCEPT:filter[OK]
iptables:Unloadingmodules:[OK]
###查看是否能访问nfs服务
[root@vmBS00~]#showmount-e192.168.1.75
Exportlistfor192.168.1.75:
/opt/centos6192.168.1.0/24
[root@vmBS00~]#mkdir/opt/centos6
[root@vmBS00~]#mount-tnfs192.168.1.75:/opt/centos6//opt/centos6/
[root@vmBS00~]#ls/opt/centos6/
thisISnfsFile
###配置开机自动挂载
[root@vmBS00~]#vi/etc/fstab
###添加#192.168.1.75:/opt/centos6//opt/centos6/nfsnodev,ro,rsize=32768,wsize=3276800
[root@vmBS00~]#init6
[root@vmBS00~]#
loginas:root
[email protected]'spassword:
Lastlogin:MonMar517:29:042012from192.168.1.23
[root@vmBS00~]#ls/opt/centos6/
thisISnfsFile
[root@vmBS00~]#