VIFSTAB(8) COMMAND REFERENCE VIFSTAB(8) NAME vifstab - edits and/or checks the /etc/fstab file SYNOPSIS vifstab [ -c [ filename ... ] ] DESCRIPTION As an aid to the NFS system administrator, vifstab allows editing of the /etc/fstab file and performs simple validity checking of the fields in the /etc/fstab file, warns users of any problems detected, and offers users the choice of reediting the file, updating the file, or exiting the file without updating. The user interface is a modified version of a standard Berkeley UNIX(Reg.) system administration tool for the /etc/passwd file, similar to the vipw(8) command. However, vifstab is an editor only; it does not change the current state of the operating system or servers. The vifstab program parses command line arguments and checks to see whether the user wishes to check the validity of the file or files named in the command line (default is /etc/fstab) or to both edit and validity check the /etc/fstab file. File Checking When you invoke vifstab several verifications are made: if you want to edit and check the /etc/fstab file vifstab checks to see if standard input is from a terminal, if not, it exits with an error message; vifstab checks to see if you have read and write access to /etc/fstab, if not, it exits with an error message; vifstab checks to see if the /etc/fstab.lock file exists; if the file exists, vifstab exits with an error message, and opens the /etc/fstab.lock file, creating it in the process; vifstab copies the /etc/fstab file to the /etc/fstab.lock file then invokes your editor of choice on the fstab.lock file (env EDIT) and waits for your editor to exit; vifstab asks you if you want to check the hostnames field. then, vifstab runs a validity check on the /etc/fstab.lock file and informs you of problems as Printed 4/6/89 1
VIFSTAB(8) COMMAND REFERENCE VIFSTAB(8) they are encountered. If fatal error conditions were found when running the validity check, the program asks whether you want to either reedit the file or exit the file without updating. If warning conditions were found, vifstab asks whether you want to either reedit the file, ignore the warnings and update the file, or exit the file without updating. If warning conditions were found and you wish to update the file, or if no errors were found, vifstab replaces the original /etc/fstab file with the /etc/fstab.lock file. If you have chosen to exit the file without updating it, vifstab, upon exiting, removes the fstab.lock file and keeps the original file. If you wish only to check the file(s) vifstab performs these verifications before invoking the command: vifstab checks to see if you have read access to the file you want to check, if not, the program exits with an error message; vifstab runs validity checks on the file(s) defined in the command line (default /etc/fstab), and informs you of any problems as they are encountered. Format of a Line in /etc/fstab Each line in the /etc/fstab file is considered a new entry. A carriage return denotes the end of the line and thus the end of the entry, therefore an entry cannot continue over several lines. Fields are separated by white space (a combination of one or more spaces and tabs); trailing white space is allowed, but has no meaning. A '#' as the first character in a line indicates a comment; the library function getmntent() ignores lines that begin with a '#'. An individual line may be one of the following: an entry containing exactly six fields to be validated; an entry containing only a left-justified # followed by a comment, and therefore valid but without meaning to the parser; an entry containing leading white space followed by six fields (leading white space is ignored). An individual line may NOT be any of the following: Printed 4/6/89 2
VIFSTAB(8) COMMAND REFERENCE VIFSTAB(8) an entry of zero length, and therefore invalid (note: this is how the standard mount works); an entry containing only white space, and therefore invalid; an entry containing less than six fields to be validated, and therefore invalid (note: a line with less than six fields causes all following lines to be ignored by mount); an entry containing an old (pre-NFS) /etc/fstab format, and therefore invalid; an entry containing white space before a commented line (i.e. the # is not left-justified and is therefore invalid). See fstab(5). File System Name Field This is the first field of an fstab entry. If the file system type in field three is 4.2 or type swap, the file system name field must contain the name of a local block special device or block special device swap partition, respectively. In either case, the entry must begin with a /. If the file system type is nfs then the file system name must be of the format: <server's hostname>:<the server pathname> The file system name for nfs must contain a colon with a host name preceding the colon; after the colon there must be a server path name, which must begin with a /. Prior to checking the validity of the file, the user is asked if he/she wants to check host names. If the user wants to check host names, vifstab checks the server's host name (the string in front of the colon) using the library subroutine gethostbyname(). File system Path Field This is the second field of an fstab entry and is a directory that is the file system mount point. File System Type Field Printed 4/6/89 3
VIFSTAB(8) COMMAND REFERENCE VIFSTAB(8) This is the third field of an fstab entry. The file system type field can be one of five types: nfs, 4.2, swap, pc, or ignore. If the type is anything other than these five types, the type is invalid. Note that the pc field is intended for future use; it is not documented or used in fstab(5). Options Field This is the fourth field of an fstab entry; there are several options allowed in this field and vifstab checks the options field for NFS-specific options and options for all file systems using the library subroutine hasmntent(); this subroutine checks the fstab file for a certain option named in the function call. Some of the options are mutually exclusive. If mutually exclusive options are included in the same entry of the fstab file, the results can only be predicted if you know the library function internals. Even though the options are mutually exclusive, they will not cause run time failures of programs using the /etc/fstab file. The following mutually exclusive options will result in a WARNING message when both are found in the option field of an fstab file entry: rw/ro mount will use ro; (default is rw) suid/nosuid mount will use nosuid; (default is suid) fg/bg mount will use bg; (default is fg) hard/soft mount will use soft; (default is hard) When a hard mount is assumed, the option intr should be included in the options field of the fstab file to avoid rebooting on a failed hard mount (this is a good guideline unless the mount client is a diskless node). No intr entry in the options field when soft isn't set results in a WARNING message. Some of the NFS-specific options are of the form: <option>=<digit> Those options are retry, rsize, wsize, timeo, retrans, and port. For each of these options found in the options field, vifstab checks for digit values after the equal sign, using the isdigit library function. If the value is not numerical, vifstab should display an ERROR message. Dump Frequency and Pass Number Fields Printed 4/6/89 4
VIFSTAB(8) COMMAND REFERENCE VIFSTAB(8) The dump frequency (field five) and pass number (field six) require numerical values. Even for NFS-mounted file systems these fields are required, therefore values are checked even though they have not changed for NFS; vifstab checks for the correct values using the isdigit library function; non- numerical values default to a frequency and pass numbers of zero. The vifstab program should give a WARNING message for non-numerical values in the dump frequency and pass number fields. Check Validity of Fields Validity of the fields are checked by parsing the /etc/fstab file using a modified version of the NFS library subroutine getmntent() along with the library functions setmntent() and endmntent(). (A version of getmntent() is modified to return the number of fields found in each entry as well as a pointer to a structure that holds the values of each field, even if the entry contains less than six fields. The reason for this modification is that the standard version only returns valid data, it does not return information to the caller referencing the bad fields or lines.) The vifstab program uses setmntent() to access the current /etc/fstab file, uses the modified getmntent() to parse each line of the file, and uses endmntent() to close the /etc/fstab file without making any changes to it. OPTIONS -c vifstab validity checks the /etc/fstab file, but does not edit the file; /etc/fstab must already exist -c filename for each file specified, vifstab validity checks that file EXAMPLES The command alone edits and validity checks /etc/fstab. If /etc/fstab does not exist, it is created. vifstab DIAGNOSTICS Fatal Program Errors These are errors that cause a halt in execution of vifstab; a list of conditions with the user messages are given. The msghlp command will produce a more informative explanation of the errors than the messages given here. When the fstab file is busy (a /etc/fstab.lock file exists): Printed 4/6/89 5
VIFSTAB(8) COMMAND REFERENCE VIFSTAB(8) vifstab: Fstab file busy. Try again. If UTek does not permit this user to have read access to the file: vifstab: Read access permission denied for <filename>. If UTek does not permit this user to have write access to the file: vifstab: Write access permission denied for <filename>. Input not from a terminal (Note: certain screen editors like EMACS don't work well if input is not from a terminal): vifstab: Standard input not a terminal. Bad format in command line: vifstab: USAGE: vifstab [ -c [ filename ] ] File specified with -c option does not exist: vifstab: <filename> : No such file or directory Validity Checking Warning and Fatal Error Conditions These are errors that indicate problems with the edited fstab file; these errors do not cause the vifstab program to halt. Warning Conditions: problems in the /etc/fstab file are considered warning conditions if the errors can be corrected by changes in files other than /etc/fstab or the errors aren't severe enough to cause problems in the mounting of file systems. If any of these warning conditions occur, and the -c option was not given, vifstab asks the user whether he/she wants to update the file, reedit it, or exit. The following are warning conditions and appropriate warning messages: Server host name in file system field was not found in /etc/hosts and not found on the net: WARNING: line ###: <string> - unknown server host name in filesystem field Both the rw and ro options were found in the options field of an fstab entry. WARNING: line ###: both rw and ro options found, ro is Printed 4/6/89 6
VIFSTAB(8) COMMAND REFERENCE VIFSTAB(8) assumed Both the suid and nosuid options were found in the options field of an fstab entry: WARNING: line ###: both suid and nosuid options found, nosuid is assumed Both the fg and bg options were found in the options field of an fstab entry: WARNING: line ###: both fg and bg options found, bg is assumed Both the hard and soft options were found in the options field of an fstab entry: WARNING: line ###: both hard and soft options found, soft is assumed A non-numerical dump frequency was found: WARNING: line ###: dump frequency <value> is non- numerical, a 0 value is assumed A non-numerical pass number was found: WARNING: line ###: pass number <value> is non- numerical, a 0 value is assumed Fatal Error Conditions Problems that will not allow the file system to be mounted are considered fatal error conditions. If any of these fatal error conditions occur, the user is asked whether he/she wants to reedit the file or exit. The following are fatal error conditions and appropriate error messages: Fstab entry is in old (pre-NFS) format: ERROR: line ###: Not NFS fstab format, see fstab(5) man page Fstab entry is a blank line: ERROR: line ###: Blank lines are invalid and will stop file scanning Fstab entry has leading white space on a commented line: ERROR: line ###: leading white space on commented lines is invalid and will stop file scanning Printed 4/6/89 7
VIFSTAB(8) COMMAND REFERENCE VIFSTAB(8) Less than 6 fields were completed in an fstab entry: ERROR: line ###: All 6 fields are required, you only have <number of fields> fields File system field does not begin with a / and the file system type is either 4.2 or swap: ERROR: line ###: Invalid file system for type <type>. <string> does not begin with '/' File system field does not contain a colon and the file system type is nfs: ERROR: line ###: Invalid filesystem for type "nfs". <string> must be of the form hostname:dir_path File system is not nfs, 4.2, swap, or ignore: ERROR: line ###: Filesystem type <string> is not "nfs", "4.2", "swap", or "ignore". The retry option is set to a non-numerical value: ERROR: line ###: retry value <value> is non-numerical. The rsize option is set to a non-numerical value: ERROR: line ###: rsize value <value> is non-numerical. The wsize option is set to a non-numerical value: ERROR: line ###: wsize value <value> is non-numerical. The timeo option is set to a non-numerical value: ERROR: line ###: timeo value <value> is non-numerical. The retrans option is set to a non-numerical value: ERROR: line ###: retrans value <value> is non- numerical. The port option is set to a non-numerical value: ERROR: line ###: port value <value> is non-numerical. FILES /etc/fstab /etc/hosts /etc/passwd Printed 4/6/89 8
VIFSTAB(8) COMMAND REFERENCE VIFSTAB(8) SEE ALSO getnetgrent(3n), fstab(5), vipw(8). Printed 4/6/89 9
%%index%% na:312,101; sy:413,233; de:646,3207;4237,2959;7580,2571;10535,4013;14932,2044; op:16976,570; ex:17546,252; fi:25912,156; di:17798,743;18925,2536;21845,2081;24310,1602; se:26452,218; %%index%%000000000215