linux下nfs共享

mount /dev/cdrom  /mnt/cdrom

mount -t auto -o ro  /dev/cdrom  /mnt/cdrom   #-t auto类型自动, -o ro只读模式

umount  /mnt/cdrom   #删除挂载的光驱

eject /dev/cdrom         #弹出光驱

mount  -o loop  iso文件   /mnt/iso

Last login: Sun May 18 11:38:13 2014 from 192.168.129.1
[root@wls-128 cdrom]# mount /dev/cdrom /mnt/cdrom/
mount: block device /dev/cdrom is write-protected, mounting read-only
mount: /dev/cdrom already mounted or /mnt/cdrom/ busy
[root@wls-128 cdrom]# ls -l
总计 0
[root@wls-128 cdrom]# pwd
/mnt/cdrom
[root@wls-128 cdrom]# umount /mnt/cdrom/
[root@wls-128 cdrom]# cd /root
[root@wls-128 ~]# mount /dev/cdrom /mnt/cdrom/
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@wls-128 ~]# ls -l /mnt/cdrom/
总计 3624
dr-xr-xr-x 3 root root   8192 2010-03-22 Cluster
dr-xr-xr-x 3 root root 413696 2010-03-22 Server
-r--r--r-- 1 root root  19575 2010-03-22 TRANS.TBL
dr-xr-xr-x 3 root root   8192 2010-03-22 VT
[root@wls-128 ~]# cd /etc/yum.repos.d/
[root@wls-128 yum.repos.d]# ls -l
总计 8
-rw-r--r-- 1 root root 561 2010-03-10 rhel-debuginfo.repo
[root@wls-128 yum.repos.d]# cat rhel-debuginfo.repo
[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-debuginfo-beta]
name=Red Hat Enterprise Linux $releasever Beta - $basearch - Debug
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/$basearch/Debuginfo/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@wls-128 yum.repos.d]# vi dvd.repo

[disk]
name=disk
baseurl=file:///mnt/cdrom/Server
enable=1
gpgcheck=0
~
"dvd.repo" 5L, 71C written
[root@wls-128 yum.repos.d]# yum clean all
Loaded plugins: rhnplugin, security
Cleaning up Everything
[root@wls-128 yum.repos.d]# yum repolist
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
repolist: 0
[root@wls-128 yum.repos.d]# vi dvd.repo

[disk]
name=disk
baseurl=file:///mnt/disk/Server
enable=1
gpgcheck=0
~
"dvd.repo" 5L, 69C written
[root@wls-128 yum.repos.d]# yum clean all
Loaded plugins: rhnplugin, security
Cleaning up Everything
[root@wls-128 yum.repos.d]# yum repolist
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
disk                                                     | 1.3 kB     00:00    
disk/primary                                             | 753 kB     00:00    
disk                                                                  2348/2348
repo id                           repo name                       status
disk                              disk                            enabled: 2,348
repolist: 2,348
[root@wls-128 yum.repos.d]# cd /mnt/disk/
[root@wls-128 disk]# ls -l
总计 3624
dr-xr-xr-x 3 root root   8192 2010-03-22 Cluster
dr-xr-xr-x 3 root root   8192 2010-03-22 ClusterStorage
-r--r--r-- 7 root root   8445 2008-09-03 EULA
-r--r--r-- 3 root root   8445 2010-03-10 eula.en_US
-r--r--r-- 7 root root  18416 2006-12-01 GPL
dr-xr-xr-x 4 root root   2048 2010-03-22 images
dr-xr-xr-x 2 root root   2048 2010-03-22 isolinux
-r--r--r-- 7 root root   1706 2010-03-10 RPM-GPG-KEY-redhat-beta
-r--r--r-- 7 root root   1164 2010-03-10 RPM-GPG-KEY-redhat-release
dr-xr-xr-x 3 root root 413696 2010-03-22 Server
-r--r--r-- 1 root root  19575 2010-03-22 TRANS.TBL
dr-xr-xr-x 3 root root   8192 2010-03-22 VT
[root@wls-128 disk]# cd Server/
[root@wls-128 Server]# ll | grep nfs
-r--r--r-- 368 root root    45067 2009-07-22 nfs4-acl-tools-0.3.3-1.el5.i386.rpm
-r--r--r-- 148 root root   390331 2010-03-10 nfs-utils-1.0.9-44.el5.i386.rpm
-r--r--r-- 350 root root    56265 2009-07-27 nfs-utils-lib-1.0.8-7.6.el5.i386.rpm
-r--r--r-- 350 root root    58773 2009-07-27 nfs-utils-lib-devel-1.0.8-7.6.el5.i386.rpm
-r--r--r-- 176 root root    63281 2010-03-01 sblim-cmpi-nfsv3-1.1.0-40.el5.i386.rpm
-r--r--r-- 176 root root    13580 2010-03-01 sblim-cmpi-nfsv3-test-1.1.0-40.el5.i386.rpm
-r--r--r-- 176 root root    60364 2010-03-01 sblim-cmpi-nfsv4-1.1.0-40.el5.i386.rpm
-r--r--r-- 176 root root    13509 2010-03-01 sblim-cmpi-nfsv4-test-1.1.0-40.el5.i386.rpm
-r--r--r-- 616 root root   189188 2007-01-18 system-config-nfs-1.3.23-1.el5.noarch.rpm
[root@wls-128 Server]# rpm -ivh nfs4-acl-tools-0.3.3-1.el5.i386.rpm
warning: nfs4-acl-tools-0.3.3-1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:nfs4-acl-tools         ########################################### [100%]
[root@wls-128 Server]# cd ..
[root@wls-128 disk]# ll | grep nf
You have new mail in /var/spool/mail/root
[root@wls-128 disk]# pwd
/mnt/disk
[root@wls-128 disk]# cd Server/
[root@wls-128 Server]# ll | grep nf
-r--r--r-- 368 root root    45067 2009-07-22 nfs4-acl-tools-0.3.3-1.el5.i386.rpm
-r--r--r-- 148 root root   390331 2010-03-10 nfs-utils-1.0.9-44.el5.i386.rpm
-r--r--r-- 350 root root    56265 2009-07-27 nfs-utils-lib-1.0.8-7.6.el5.i386.rpm
-r--r--r-- 350 root root    58773 2009-07-27 nfs-utils-lib-devel-1.0.8-7.6.el5.i386.rpm
[root@wls-128 Server]# ls -l nfs*
-r--r--r-- 368 root root  45067 2009-07-22 nfs4-acl-tools-0.3.3-1.el5.i386.rpm
-r--r--r-- 148 root root 390331 2010-03-10 nfs-utils-1.0.9-44.el5.i386.rpm
-r--r--r-- 350 root root  56265 2009-07-27 nfs-utils-lib-1.0.8-7.6.el5.i386.rpm
-r--r--r-- 350 root root  58773 2009-07-27 nfs-utils-lib-devel-1.0.8-7.6.el5.i386.rpm
[root@wls-128 Server]# scp ./nfs* [email protected]:/root
The authenticity of host '192.168.129.133 (192.168.129.133)' can't be established.
RSA key fingerprint is 97:21:8e:1b:40:b4:1c:fc:18:6f:8e:3a:52:b5:33:7a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.129.133' (RSA) to the list of known hosts.
Address 192.168.129.133 maps to localhost, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
[email protected]'s password:
Permission denied, please try again.
[email protected]'s password:
nfs4-acl-tools-0.3.3-1.el5.i386.rpm           100%   44KB  44.0KB/s   00:00   
nfs-utils-1.0.9-44.el5.i386.rpm               100%  381KB 381.2KB/s   00:00   
nfs-utils-lib-1.0.8-7.6.el5.i386.rpm          100%   55KB  55.0KB/s   00:00   
nfs-utils-lib-devel-1.0.8-7.6.el5.i386.rpm    100%   57KB  57.4KB/s   00:00   
[root@wls-128 /]# mkdir deploy
[root@wls-128 /]# chmod 776 deploy/
[root@wls-128 /]# cd etc/
[root@wls-128 etc]# touch exports
[root@wls-128 etc]# vi exports

/deploy   192.168.129.132(rw,sync,no_root_squash,fsid=0)
/deploy   192.168.129.133(rw,sync,no_root_squash,fsid=0)
~
"exports" 4L, 240C written
You have new mail in /var/spool/mail/root
[root@wls-128 etc]# exportfs -rv
exporting 192.168.129.132:/deploy
exporting 192.168.129.133:/deploy
[root@wls-128 etc]# service rpcbind restart
rpcbind: 未被识别的服务
[root@wls-128 etc]# service nfs restart
关闭 NFS mountd:[失败]
关闭 NFS 守护进程:[失败]
关闭 NFS quotas:[失败]
关闭 NFS 服务: [确定]
启动 NFS 服务: [确定]
关掉 NFS 配额:[确定]
启动 NFS 守护进程:[确定]
启动 NFS mountd:[确定]
[root@wls-128 etc]# service portmap status
portmap (pid 2722) 正在运行...
[root@wls-128 etc]# service portmap restart
停止 portmap:[确定]
启动 portmap:[确定]
[root@wls-128 etc]# exportfs -rv
exporting 192.168.129.132:/deploy
exporting 192.168.129.133:/deploy
[root@wls-128 etc]# cd /deploy/
[root@wls-128 deploy]# vi test.txt

扫描二维码关注公众号,回复: 1145708 查看本文章

this test nfs4
~
"test.txt" [New] 1L, 15C written
[root@wls-128 deploy]# service iptables stop
清除防火墙规则:[确定]
把 chains 设置为 ACCEPT 策略:filter [确定]
正在卸载 Iiptables 模块:[确定]
[root@wls-128 deploy]#

Last login: Sun May 18 10:59:02 2014

[root@wls-133 ~]# cd /root/
You have new mail in /var/spool/mail/root
[root@wls-133 ~]# ls -l
总计 944848
-rw------- 1 root root      1235 2012-05-19 anaconda-ks.cfg
drwxr-xr-x 2 root root      4096 05-17 23:44 bea
-rw-r--r-- 1 root root     26153 2012-05-19 install.log
-rw-r--r-- 1 root root      3671 2012-05-19 install.log.syslog
-r--r--r-- 1 root root     45067 05-18 15:27 nfs4-acl-tools-0.3.3-1.el5.i386.rpm
-r--r--r-- 1 root root    390331 05-18 15:27 nfs-utils-1.0.9-44.el5.i386.rpm
-r--r--r-- 1 root root     56265 05-18 15:27 nfs-utils-lib-1.0.8-7.6.el5.i386.rpm
-r--r--r-- 1 root root     58773 05-18 15:27 nfs-utils-lib-devel-1.0.8-7.6.el5.i386.rpm
[root@wls-133 ~]# rpm -ivh nfs4-acl-tools-0.3.3-6.el6.x86_64.rpm
error: open of nfs4-acl-tools-0.3.3-6.el6.x86_64.rpm failed: 没有那个文件或目录
[root@wls-133 ~]# rpm -ivh nfs4-acl-tools-0.3.3-1.el5.i386.rpm
warning: nfs4-acl-tools-0.3.3-1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:nfs4-acl-tools         ########################################### [100%]
[root@wls-133 ~]# cd /
[root@wls-133 /]# mkdir deploy
[root@wls-133 /]# chmod 776 deploy/
[root@wls-133 /]# service nfs restart
关闭 NFS mountd:[失败]
关闭 NFS 守护进程:[失败]
关闭 NFS quotas:[失败]
关闭 NFS 服务: [失败]
启动 NFS 服务: [确定]
关掉 NFS 配额:[确定]
启动 NFS 守护进程:[确定]
启动 NFS mountd:[确定]
[root@wls-133 /]# showmount -e 192.168.129.128
mount clntudp_create: RPC: Port mapper failure - RPC: Unable to receive
[root@wls-133 /]# showmount -e 192.168.129.128
mount clntudp_create: RPC: Port mapper failure - RPC: Unable to receive
[root@wls-133 /]# vi /etc/exports
~
"/etc/exports" 0L, 0C written
[root@wls-133 /]# service nfs restart
关闭 NFS mountd:[确定]
关闭 NFS 守护进程:[确定]
关闭 NFS quotas:[确定]
关闭 NFS 服务: [失败]
启动 NFS 服务: [确定]
关掉 NFS 配额:[确定]
启动 NFS 守护进程:[确定]
启动 NFS mountd:[确定]
[root@wls-133 /]# showmount -e 192.168.129.128
mount clntudp_create: RPC: Port mapper failure - RPC: Unable to receive
[root@wls-133 /]# ls -l /deploy/
总计 0
[root@wls-133 /]# mount -t nfs4 -vvvv 192.168.129.128:/ /deploy
mount: pinging: prog 100003 vers 4 prot tcp port 2049
mount: Unable to connect to 192.168.129.128:2049, errno 113 (No route to host)
mount: mount to NFS server '192.168.129.128' failed: System Error: No route to host.
[root@wls-133 /]# mount -t nfs4 -vvvv 192.168.129.128:/ /deploy
mount: pinging: prog 100003 vers 4 prot tcp port 2049
[root@wls-133 /]# ls -l /deploy/
总计 8
-rw-r--r-- 1 root root 15 05-18 15:39 test.txt

查看linux版本信息:

[root@wls-133 ~]# uname -a
Linux wls-133 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:43 EDT 2010 i686 i686 i386 GNU/Linux
[root@wls-133 ~]# cat /proc/version
Linux version 2.6.18-194.el5 ([email protected]) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Tue Mar 16 21:52:43 EDT 2010
[root@wls-133 ~]# cat /etc/issue
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Kernel \r on an \m

[root@wls-133 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
[root@wls-133 ~]# cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 42
model name      : Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz
stepping        : 7
cpu MHz         : 2494.420
cache size      : 3072 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss nx rdtscp constant_tsc up ida nonstop_tsc arat pni ssse3 sse4_1 sse4_2 popcnt [8]
bogomips        : 4988.84

[root@wls-133 ~]# getconf LONG_BIT
32
[root@wls-133 ~]# lsb_release -a
LSB Version:    :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: RedHatEnterpriseServer
Description:    Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Release:        5.5
Codename:       Tikanga

猜你喜欢

转载自zhang964761032.iteye.com/blog/2067906