Allow "update" option to be used in the fstab(5). Document possible use case.

Approved by:	mckusick
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D18586
This commit is contained in:
Maxim Sobolev 2019-07-22 20:04:55 +00:00
parent 4f6d74c9c4
commit 634add3c8d
2 changed files with 27 additions and 0 deletions

View File

@ -361,6 +361,7 @@ main(int argc, char *argv[])
else
failok = 0;
if (!(init_flags & MNT_UPDATE) &&
!hasopt(fs->fs_mntops, "update") &&
ismounted(fs, mntbuf, mntsize))
continue;
options = update_options(options, fs->fs_mntops,

View File

@ -190,6 +190,32 @@ see the
.Xr mount 8
manual page.
.Pp
If the option
.Dq update
is specified, it indicates that the status of an already mounted file
system should be changed accordingly.
This allows, for example, file systems mounted read-only to be upgraded
read-write and vice-versa.
By default, an entry corresponding to a file systems that is already
mounted is going to be skipped over when processing
.Nm ,
unless it's a root file system, in which case logic similar to
.Dq update
is applied automatically.
.Pp
The
.Dq update
option is typically used in conjuction with two
.Nm
files.
The first
.Nm
file is used to set up the initial set of file systems.
The second
.Nm
file is then run to update the initial set of file systems and
to add additional file systems.
.Pp
The type of the mount is extracted from the
.Fa fs_mntops
field and stored separately in the