Previous |
Home | Next |
Version: | - nfs-utils-1.0.8 |
Man
Pages: |
|
nfs |
mount |
fstab |
mountd |
exports |
rpcinfo |
exportfs |
rpc.nfsd |
portmap | rpc.mountd |
[bash]# vi /etc/exports | |
1. 2. 3. 4. 5. |
/home
linuxwkstn*(rw,sync) /tmp/fileswap *(rw,no_root_squash,async) /filestore 192.168.1.0/24(rw,no_root_squash,sync) /var/ftp 192.168.1.0/24(ro,all_squash,async) /home/alice admin(rw,all_squash,sync,anonuid=567,anongid=567) |
Options: |
Description: |
rw |
Allows read and write access to the share |
ro |
Only allows read access, writing is blocked |
all_squash |
Forces all connecting users to "nobody" account and
permissions |
no_root_squash |
Allows root account on client to access export share on
server as the root account |
anonuid |
Forces all anonymous connections to predefined UID on server |
anongid |
Forces all anonymous connections to predefined GID on server |
[bash]# exportfs -rv | |
1. 2. 3. 4. 5. |
exporting linuxwkstn*:/home exporting *:/tmp/fileswap exporting 192.168.1.0/24:/filestore exporting 192.168.1.0/24:/var/ftp exporting admin.example.com:/home/alice |
Both the nfs and portmap services need to be restarted for
new exports to be available to the client. |
[bash]# chkconfig --level 345 nfs on [bash]# chkconfig --level 345 portmap on |
[bash]# chkconfig --list nfs [bash]# chkconfig --list portmap |
[bash]# /etc/init.d/nfs restart [bash]# /etc/init.d/portmap restart |
[bash]# showmount -e galaxy | |
1. 2. 3. 4. 5. |
Export list for galaxy: /home linuxwkstn* /tmp/fileswap * /filestore 192.168.1.0/24 /var/ftp 192.168.1.0/24 /home/alice admin.example.com |
[bash]# tail -n 50 /var/log/messages |
[bash]# rpcinfo -p galaxy | |
program vers proto port 100003 2 udp 2049 nfs 100003 3 udp 2049 nfs 100003 4 udp 2049 nfs 100003 2 tcp 2049 nfs 100003 3 tcp 2049 nfs 100003 4 tcp 2049 nfs . . ### EXCESS REMOVED ### . 100005 1 udp 997 mountd 100005 1 tcp 1000 mountd 100005 2 udp 997 mountd 100005 2 tcp 1000 mountd 100005 3 udp 997 mountd 100005 3 tcp 1000 mountd |
[bash]# vi
/etc/sysconfig/nfs |
|
RPCMOUNTDOPTS="-N
1
-N 2" |
When you disable mountd versions 1 and 2, then the "showmount -e galaxy" command will fail with an error similar to: "rpc mount export: RPC: Program/version mismatch; low version = 3, high version = 3". This can be alleviated by leaving all NFS versions running on the server and then forcing "nfsvers=3" in your "/etc/fstab" file on the remote client. |
[bash]# rpcinfo -p galaxy | |
program vers proto port . . ### EXCESS REMOVED ### . 100005 3 udp 997 mountd 100005 3 tcp 1000 mountd |
If you intend running NFSv4, then mountd must at least handle
support for version 3; you can not disable all versions. |
[bash]# rpcinfo -p linuxwkstn01 | |
program vers proto port 100000 2 tcp 111 portmapper 100000 2 udp 111 portmapper |
[bash]# showmount -e galaxy |
[bash]# mkdir /shared [bash]# mkdir /workfiles [bash]# mkdir /media/ftp [bash]# mkdir /media/alice |
[bash]# cp
/etc/fstab /etc/fstab.original [bash]# vi /etc/fstab |
|
1. 2. 3. 4. 5. |
galaxy:/home
/home
nfs defaults 0 0 galaxy:/tmp/fileswap /shared nfs defaults,nfsvers=3,tcp 0 0 galaxy:/filestore /workfiles nfs defaults,rsize=8192,wsize=8192 0 0 galaxy:/var/ftp /media/ftp nfs sync,auto,ro,noexec,hard,intr 0 0 galaxy:/home/alice /media/alice nfs defaults,nfsvers=3,tcp,retry=30,rsize=8192,wsize=8192 0 0 |
[bash]# mount /workfiles |
[bash]# mount -a -t nfs |
[bash]# ls -l /workfiles |
drwxrwx--- 4 root financial 4096 Jan 1
06:07 financial drwxrwx--- 3 root adminstaff 4096 Jan 1 06:07 adminstaff drwxrwxrwx 4 root root 4096 Jan 1 06:07 shared |
[bash]# mount -t nfs galaxy:/var/ftp /tmp/ftp -o
ro,sync,auto,hard,intr |
[bash]# mount -l |
[bash]# umount /media/ftp [bash]# umount /workfiles |
[bash]# /etc/init.d/portmap restart |
Version: | - kernel 2.6 |
[bash]# rpcinfo -p galaxy | |
program vers proto port 100003 4 udp 2049 nfs 100003 4 tcp 2049 nfs . . ### EXCESS REMOVED ### |
###
ON THE SERVER ### [bash]# mount -l |
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) nfsd on /proc/fs/nfsd type nfsd (rw) |
###
ON THE CLIENT ### [bash]# mount -l |
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) |
[bash]# grep nfs /etc/passwd |
nfsnobody:x:65534:65534:Anonymous NFS
User:/var/lib/nfs:/sbin/nologin |
[bash]# vi /etc/idmapd.conf |
[General] Verbosity = 0 Pipefs-Directory = /var/lib/nfs/rpc_pipefs Domain = example.com [Mapping] Nobody-User = nfsnobody Nobody-Group = nfsnobody [Translation] Method = nsswitch |
[bash]# mkdir /NFS4exports |
[bash]# mkdir /NFS4exports/ftp [bash]# mkdir /NFS4exports/home [bash]# mkdir /NFS4exports/filestore |
[bash]# vi /etc/fstab |
## BIND Mounting The Filesystem ## /var/ftp /NFS4exports/ftp none bind 0 0 /home /NFS4exports/home none bind 0 0 /filestore /NFS4exports/filestore none bind 0 0 |
[bash]# mount -a -t none |
[bash]# mount -l | grep bind |
/var/ftp on /NFS4exports/ftp type none (rw,bind) /home on /NFS4exports/home type none (rw,bind) /filestore on /NFS4exports/filestore type none (rw,bind) |
[bash]# ls -l /NFS4exports/ftp |
drwxr-xr-x 3 root root 4096 Dec 9 15:49 pub |
[bash]# vi /etc/exports |
/NFS4exports
192.168.1.0/24(rw,insecure,sync,wdelay,no_subtree_check,no_root_squash,fsid=0) /NFS4exports/ftp 192.168.1.0/24(ro,insecure,sync,wdelay,no_subtree_check,nohide,all_squash,anonuid=65534,anongid=65534) /NFS4exports/filestore 192.168.1.0/24(rw,insecure,sync,wdelay,no_subtree_check,nohide,no_root_squash) /NFS4exports/home 192.168.1.0/24(rw,insecure,sync,wdelay,no_subtree_check,nohide,no_root_squash) |
[bash]# chkconfig --level 345 nfs on [bash]# chkconfig --level 345 portmap on |
[bash]# chkconfig --list nfs [bash]# chkconfig --list portmap |
[bash]# /etc/init.d/nfs restart [bash]# /etc/init.d/portmap restart |
[bash]# exportfs -v [bash]# showmount -e localhost |
[bash]# showmount -e galaxy |
Export list for galaxy: /NFS4exports 192.168.1.0/24 /NFS4exports/ftp 192.168.1.0/24 /NFS4exports/home 192.168.1.0/24 /NFS4exports/filestore 192.168.1.0/24 |
[bash]# vi /etc/idmapd.conf |
[General] Verbosity = 0 Pipefs-Directory = /var/lib/nfs/rpc_pipefs Domain = example.com [Mapping] Nobody-User = nfsnobody Nobody-Group = nfsnobody [Translation] Method = nsswitch |
[bash]# mkdir /media/galaxy |
[bash]# vi /etc/fstab |
galaxy:/ /media/galaxy nfs4 auto,rw,nodev,sync,_netdev,proto=tcp,retry=10,rsize=32768,wsize=32768,hard,intr 0 0 |
The mounting options for NFSv4 are different to earlier
versions, type "man nfs"
at the command prompt to see the options available for all versions. |
[bash]# mount /media/galaxy |
[bash]# mount -t nfs4 192.168.1.11:/ /mnt/testing \ -o async,auto,exec,_netdev,nodev,rw,retry=5,rsize=32768,wsize=32768,proto=tcp,hard,intr |
[bash]# mount -l |
galaxy:/ on
/mnt/galaxy type nfs4
(rw,addr=galaxy) |
[bash]# ls -l /media/galaxy |
drwxr-xr-x 4 root root 4096 Jan 1 06:07 filestore drwxr-xr-x 3 root root 4096 Jan 1 06:07 ftp drwxr-xr-x 4 root root 4096 Jan 1 06:07 home |
Previous |
Home | Next |