Sharing file systems with nfs server and mounting file systems with nfs client

From DISI
Revision as of 17:08, 21 July 2020 by Khtang (talk | contribs) (→‎Sharing file systems with nfs server)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Sharing file systems with nfs server

/nfs/home lives on the machine dalet.

Login using an s_ account to dalet

  ssh s_jyoung@dalet

The /etc/exports says which file systems will be exported to which networks. Note: fsid must be unique.

   less /etc/exports

Example row:

   /export/home    10.20.0.0/16(rw,async,fsid=221) \
                   169.230.26.0/24(rw,async,fsid=221) \

rw means read/write

async means that writes to the file are not transmitted to the server immediately, usually only when the file is closed.

The alternative is sync which makes all writes to the file be committed to the server. Sync is slower.

Before running mounting, there are 2 things you need to check:

  1.   /sbin/service nfs status

Shows all the places where nfs is running

   2.  /sbin/service rpcbind status

Shows whether rpcbind is running. Rpcbind needs to be running for nfs to work correctly.

   /sbin/chkconfig | grep nfs

chkconfig controls whether a program automatically starts itself in the background at boot time

Need to run as root

   exportfs

Shows all the subnets where nfs is exported

   showmount -e localhost

Shows what is mounted on localhost

Showmount.png

Mounting file systems with nfs client

   mount | grep nfs

Shows what is mounted

Mounted.png

   /etc/fstab

Shows the file system table. This is not edited manually and is controlled by puppet. If any changes are made, every 30 minutes the puppet master will check for changes and change the file to match the puppet master. Columns explanation: 1. Disk partition 2. Mount point 3. Type of file system 4. Important to have netdev on mounts that require network. This way, you will not try to mount these unless you have a network connection.

   service puppet status

Tells you whether puppet is running and what the process ID is.

   puppet agent --test

Puppet can tell if client machine is missing required mounts. Blue means puppet is working correctly.

Puppet status.png

   mount -a

If someone says things are not properly mounted on their machine, login as root on their machine and run this command.