diff --git a/sbin/mount/mount.8 b/sbin/mount/mount.8 index b1ae8416eb4..741904bdd4a 100644 --- a/sbin/mount/mount.8 +++ b/sbin/mount/mount.8 @@ -41,6 +41,7 @@ .Sh SYNOPSIS .Nm .Op Fl adfpruvw +.Op Fl F Ar fstab .Op Fl t Ar ufs | external_type .Nm .Op Fl dfpruvw @@ -93,6 +94,10 @@ flag to determine what the .Nm command is trying to do. +.It Fl F Ar fstab +Specify the +.Pa fstab +file to use. .It Fl f Forces the revocation of write access when trying to downgrade a file system mount status from read-write to read-only. @@ -406,6 +411,13 @@ Note that support for a particular file system might be provided either on a static (kernel compile-time), or dynamic basis (loaded as a kernel module by .Xr kldload 8 ) . +.Sh ENVIRONMENT +.Bl -tag -width PATH_FSTAB +.It Pa PATH_FSTAB +If the environment variable +.Pa PATH_FSTAB +is set all operations are performed against the specified file. +.El .Sh FILES .Bl -tag -width /etc/fstab -compact .It Pa /etc/fstab diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index f0daa5562e4..4fccd91aa3d 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -140,7 +140,7 @@ main(argc, argv) options = NULL; vfslist = NULL; vfstype = "ufs"; - while ((ch = getopt(argc, argv, "adfo:prwt:uv")) != -1) + while ((ch = getopt(argc, argv, "adF:fo:prwt:uv")) != -1) switch (ch) { case 'a': all = 1; @@ -148,6 +148,9 @@ main(argc, argv) case 'd': debug = 1; break; + case 'F': + setfstab(optarg); + break; case 'f': init_flags |= MNT_FORCE; break; @@ -712,7 +715,7 @@ usage() (void)fprintf(stderr, "%s\n%s\n%s\n", "usage: mount [-dfpruvw] [-o options] [-t ufs | external_type] special node", -" mount [-adfpruvw] [-t ufs | external_type]", +" mount [-adfpruvw] [ -F fstab] [-t ufs | external_type]", " mount [-dfpruvw] special | node"); exit(1); } diff --git a/sbin/umount/umount.8 b/sbin/umount/umount.8 index 8d75508ad52..bdaa34b5638 100644 --- a/sbin/umount/umount.8 +++ b/sbin/umount/umount.8 @@ -44,6 +44,7 @@ .Ar special \&| node .Nm .Fl a | A +.Op Fl F Ar fstab .Op Fl fv .Op Fl h Ar host .Op Fl t Ar type @@ -73,6 +74,10 @@ are unmounted. .It Fl A All the currently mounted file systems except the root are unmounted. +.It Fl F Ar fstab +Specify the +.Pa fstab +file to use. .It Fl f The file system is forcibly unmounted. Active special devices continue to work, @@ -115,6 +120,13 @@ file. Verbose, additional information is printed out as each file system is unmounted. .El +.Sh ENVIRONMENT +.Bl -tag -width PATH_FSTAB +.It Pa PATH_FSTAB +If the environment variable +.Pa PATH_FSTAB +is set all operations are performed against the specified file. +.El .Sh FILES .Bl -tag -width /etc/fstab -compact .It Pa /etc/fstab diff --git a/sbin/umount/umount.c b/sbin/umount/umount.c index 39698603644..8ffdbce5531 100644 --- a/sbin/umount/umount.c +++ b/sbin/umount/umount.c @@ -100,7 +100,7 @@ main(int argc, char *argv[]) sync(); all = errs = 0; - while ((ch = getopt(argc, argv, "Aafh:t:v")) != -1) + while ((ch = getopt(argc, argv, "AaF:fh:t:v")) != -1) switch (ch) { case 'A': all = 2; @@ -108,6 +108,9 @@ main(int argc, char *argv[]) case 'a': all = 1; break; + case 'F': + setfstab(optarg); + break; case 'f': fflag = MNT_FORCE; break; @@ -184,7 +187,7 @@ main(int argc, char *argv[]) break; case 1: if (setfsent() == 0) - err(1, "%s", _PATH_FSTAB); + err(1, "%s", getfstab()); errs = umountall(typelist); break; case 0: @@ -751,6 +754,6 @@ usage() (void)fprintf(stderr, "%s\n%s\n", "usage: umount [-fv] special | node", - " umount -a | -A [-fv] [-h host] [-t type]"); + " umount -a | -A [ -F fstab] [-fv] [-h host] [-t type]"); exit(1); }