nfs 笔记 2

时间:2023-03-09 15:32:41
nfs 笔记 2

http://woxihuanpes.blog.163.com/blog/static/12423219820097139145238/
http://blog.csdn.net/willvc123/article/details/6325615

[root@lk1 ~]# exportfs -au
[root@lk1 ~]# df
df: `/mnt': Stale file handle
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_lk1-lv_root
6795192 2285828 4157520 36% /
tmpfs 510120 0 510120 0% /dev/shm
/dev/sda1 487652 28371 433681 7% /boot
[root@lk1 ~]#
[root@lk1 ~]#
[root@lk1 ~]# exportfs -rv
exporting 192.168.4.0/24:/home/test
[root@lk1 ~]#
[root@lk1 ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_lk1-lv_root
6795192 2285828 4157520 36% /
tmpfs 510120 0 510120 0% /dev/shm
/dev/sda1 487652 28371 433681 7% /boot
192.168.4.51:/home/test
6795264 2285824 4157568 36% /mnt

使用 exportfs -rv 后, 就立即自动挂载好了!

+++++++++++++++

/tmp 192.168.4.50(rw,no_root_squash)
/home/public 192.168.4.0/24(rw)
/home/test lk0(rw)
/home/linux lk(rw,all_squash,anonuid=40,anongid=40) 主机名是不能包含

service nfs restart
Shutting down NFS daemon: [ OK ]
Shutting down NFS mountd: [ OK ]
Shutting down NFS quotas: [ OK ]
exportfs: No host name given with /home/test  lk1(rw) (ro,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534), suggest (ro,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534) to avoid warning
exportfs: No host name given with /tmp     192.168.4.50(rw,no_root_squash) (ro,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534), suggest
(ro,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534) to avoid warning
Shutting down NFS services: [ OK ]
Shutting down RPC idmapd: [ OK ]
Starting NFS services: exportfs: No options for /tmp     192.168.4.50(rw,no_root_squash) : suggest (sync) to avoid warning
exportfs: No options for /home/public 192.168.4.0/24(rw) : suggest (sync) to avoid warning
exportfs: No options for /home/test  lk0(rw) : suggest (sync) to avoid warning
exportfs: Failed to stat /home/linux : No such file or directory

exportfs: Failed to stat /home/test  lk0(rw): No such file or directory

exportfs: Failed to stat /home/public 192.168.4.0/24(rw): No such file or directory

exportfs: Failed to stat /tmp     192.168.4.50(rw,no_root_squash): No such file or directory

++++

[root@lk2 ~]# mount -t nfs 192.168.4.51:/home/public /mnt
mount.nfs: Stale file handle --------- 表示没有服务器那个目录或者没有权限

[root@lk0 ~]# mount -t nfs 192.168.4.51:/tmp /mnt
mount.nfs: /mnt is busy or already mounted
[root@lk0 ~]# mount -t nfs 192.168.4.51:/tmp /mnt2
mount.nfs: mount point /mnt2 does not exist
[root@lk0 ~]#
[root@lk0 ~]# mkdir mnt2
[root@lk0 ~]#
[root@lk0 ~]# mount -t nfs 192.168.4.51:/tmp /mnt2
mount.nfs: mount point /mnt2 does not exist
[root@lk0 ~]# mkdir /mnt2
[root@lk0 ~]#
[root@lk0 ~]# mount -t nfs 192.168.4.51:/tmp /mnt2
[root@lk0 ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/rhel_es-root 28784916 5585388 23199528 20% /
devtmpfs 926776 0 926776 0% /dev
tmpfs 942256 84 942172 1% /dev/shm
tmpfs 942256 9160 933096 1% /run
tmpfs 942256 0 942256 0% /sys/fs/cgroup
/dev/sda1 508588 160576 348012 32% /boot
tmpfs 188452 16 188436 1% /run/user/42
tmpfs 188452 0 188452 0% /run/user/0
192.168.4.51:/home/test 6795264 2285824 4157568 36% /mnt
192.168.4.51:/tmp 6795264 2285824 4157568 36% /mnt2