linux nfs实践
以下是nfs服务器(需要共享出目录来的那个机器)上的操作
修改/etc/exports,要将/home/work目录共享出来
[root@rhel4u6 work]# cat /etc/exports
/home/work 192.168.179.* (rw,sync,no_root_squash)
[root@rhel4u6 home]# /etc/rc.d/init.d/portmap start
Starting portmap: [ OK ]
[root@rhel4u6 home]# /etc/init.d/nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
[root@rhel4u6 work]# exportfs
exportfs: No host name given with /home/work
(rw,sync,wdelay,hide,nocrossmnt,secure,no_root_squash,no_all_squash,subtree_check,secure_locks,map
ping=identity,anonuid=-2,anongid=-2), suggest *
(rw,sync,wdelay,hide,nocrossmnt,secure,no_root_squash,no_all_squash,subtree_check,secure_locks,map
ping=identity,anonuid=-2,anongid=-2) to avoid warning
/home/work 192.168.179.*
/home/work
[root@rhel4u6 work]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 28G 15G 12G 56% /
none 232M 0 232M 0% /dev/shm
[root@rhel4u6 work]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:BC:EF:F1
inet addr:192.168.179.40 Bcast:192.168.179.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:febc:eff1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:839 errors:0 dropped:0 overruns:0 frame:0
TX packets:614 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:78907 (77.0 KiB) TX bytes:71583 (69.9 KiB)
Base address:0x2000 Memory:d8920000-d8940000
到一个linux客户端去mount:
[root@localhost ~]# mount -t nfs 192.168.179.40:/home/work /mnt/haha
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 13G 9.8G 2.2G 83% /
tmpfs 270M 154M 116M 58% /dev/shm
192.168.179.40:/home/work
28G 15G 12G 56% /mnt/haha
通过修改/etc/fstab文件可以实现开机自动挂载nfs目录
192.168.179.40:/home/work /mnt/haha nfs defaults 0 0
[@more@]来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/161195/viewspace-1055923/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/161195/viewspace-1055923/