Previous Table of Contents Next


Sharing Files from a Server

NFS is a distributed file system that can be used to tie together computers that are running different operating systems. For example, systems running DOS can share files with systems running UNIX.

NFS makes the actual physical location of the file system irrelevant to the user. You can use NFS to allow users to see all the relevant files, regardless of location. Instead of placing copies of commonly used files on every system, NFS allows you to place one copy on one system's disk and let all other systems access it across the network. Under NFS, remote file systems are virtually indistinguishable from local ones.

A system becomes an NFS server if it has file systems to share or export over the network. A server keeps a list of currently exported file systems and their access restrictions (such as read /write or read-only).

You may want to share resources, such as files, directories, or devices from one system on the network (typically, a server) with other systems. For example, you might want to share third-party applications or source files with users on other systems.

When you share a resource, you make it available for mounting by remote systems. You can share a resource in these ways:

  Using the share or shareall command
  Adding an entry to the /etc /dfs /dfstab (distributed file system table) file

The default /etc/dfs/dfstab file shows the syntax and an example of entries:

cinderella% more /etc/dfs/dfstab

#  place share(1M) commands here for automatic execution
#  on entering init state 3.
#
#  share [-F fstype] [ -o options] [-d "<text>"] <pathname> [resource]
#  .e.g,
#  share  -F nfs  -o rw=engineering  -d "home dirs"  /export/home2
share -F nfs /var/mail

cinderella%

Checking the Data Consistency of a File System (fsck)

The UFS file system relies on an internal set of tables to keep track of inodes and used and available blocks. When these internal tables are not properly synchronized with data on a disk, inconsistencies result and file systems need to be repaired.

File systems can be damaged or become inconsistent because of abrupt termination of the operating system in these ways:

  Power failure
  Accidental unplugging of the system
  Turning off the system without proper shutdown procedure
  A software error in the kernel

File system corruption, though serious, is not common. When a system is booted, a file system consistency check is done automatically. Most of the time, this file system check repairs problems it encounters.

File systems are checked with the fsck (file system check) program. The fsck command puts files and directories that are allocated but unreferenced in the lost+found directory in that file system. The inode number of each file is assigned as the name. If the lost+found directory does not exist, fsck creates it. If there is not enough space in the lost+found directory, fsck increases its size.

You may need to interactively check file systems when:

  They cannot be mounted
  They develop problems while in use


NOTE:  When an in-use file system develops inconsistencies, strange error messages may be displayed in the console window, or the system may crash. Before using fsck, you may want to refer to the fsck(1M) manual page for more information.

Finding Out Whether a File System Needs Checking

Follow these steps to determine whether a file system needs to be checked:

1.  Become superuser.
2.  Type fsck -m /dev/rdsk/cntn dnsn and press Return.

The state flag in the superblock of the file system you specify is checked to determine whether the file system is clean or requires checking.

If you omit the device argument, all the UFS file systems listed in /etc /vfstab with a fsck pass value greater than 0 are checked. In this example, the first file system needs to be checked; the second file system does not:

# fsck -m /dev/rdsk/cØtØdØs6
** /dev/rdsk/cØtØdØs6
ufs fsck: sanity check: /dev/rdsk/cØtØdØs6 needs checking
# fsck -m /dev/rdsk/cØtØdØs7
** /dev/rdsk/cØtØdØs7
ufs fsck: sanity check: /dev/rdsk/cØtØdØs7 okay
#

Checking File Systems Interactively

Follow these steps to check all file systems interactively:

1.  Become superuser.
2.  Unmount the file system.
3.  Typefsck and press Return.

All file systems in the /etc/vfstab file with entries in the fsck pass field greater than zero are checked. You can also specify the mount point directory or /dev/rdsk /cntndnsn as arguments to fsck. Any inconsistency messages are displayed.

In this example, /dev/rdsk/c0t0d0s6 is checked and the incorrect block count is corrected:

# fsck /dev/rdsk/cØtØdØs6
checkfilesys: /dev/rdsk/cØtØdØs6
** Phase 1 - Check Block and Sizes
INCORRECT BLOCK COUNT I=2529 (6 should be 2)
CORRECT? y

** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Cylinder Groups
Dynamic 4.3 FFFS
929 files, 8928 used, 2851 free (75 frags, 347 blocks, Ø.6%
fragmentation)
/dev/rdsk/cØtØdØs6 FILE SYSTEM STATE SET TO OKAY
***** FILE SYSTEM WAS MODIFIED *****


Previous Table of Contents Next