aboutsummaryrefslogtreecommitdiff
path: root/sbin/mdmfs/mdmfs.8
diff options
context:
space:
mode:
authorIan Lepore <ian@FreeBSD.org>2017-09-29 22:13:26 +0000
committerIan Lepore <ian@FreeBSD.org>2017-09-29 22:13:26 +0000
commit50e3590c4486925a3694a113f59db7db69eb7679 (patch)
tree1cd63098a2b1297dcdb94b40ec504da3229219e9 /sbin/mdmfs/mdmfs.8
parent50cf4f8950c139296564dbba84f617250fb12b15 (diff)
downloadsrc-50e3590c4486925a3694a113f59db7db69eb7679.tar.gz
src-50e3590c4486925a3694a113f59db7db69eb7679.zip
Enhance mdmfs(8) to work with tmpfs(5).
Existing scripts and associated config such as rc.initdiskless, rc.d/var, and others, use mdmfs to create memory filesystems. That program accepts a size argument which allows SI suffixes and treats an unsuffixed number as a count of 512 byte sectors. That makes it difficult to convert existing scripts to use tmpfs instead of mdmfs, because tmpfs treats unsuffixed numbers as a count of bytes. The script logic to deal with existing user config that might include suffixed and unsuffixed numbers is... unpleasant. Also, there is no g'tee that tmpfs will be available. It is sometimes configured out of small-resource embedded systems to save memory and flash storage space. These changes enhance mdmfs(8) so that it accepts two new values for the 'md-device' arg: 'tmpfs' and 'auto'. With tmpfs, the program always uses tmpfs(5) (and fails if it's not available). With 'auto' the program prefers tmpfs, but falls back to using md(4) if tmpfs isn't available. It also handles the -s <size> argument so that the mdconfig interpetation of unsuffixed numbers applies when tmpfs is used as well, so that existing user config keeps working after a switch to tmpfs. A new rc setting, mfs_type, is added to etc/defaults/rc.conf to let users force the use of tmpfs or md; the default value is "auto". Differential Revision: https://reviews.freebsd.org/D12301
Notes
Notes: svn path=/head/; revision=324107
Diffstat (limited to 'sbin/mdmfs/mdmfs.8')
-rw-r--r--sbin/mdmfs/mdmfs.865
1 files changed, 53 insertions, 12 deletions
diff --git a/sbin/mdmfs/mdmfs.8 b/sbin/mdmfs/mdmfs.8
index 30a81fa49cf6..7505ff214ca8 100644
--- a/sbin/mdmfs/mdmfs.8
+++ b/sbin/mdmfs/mdmfs.8
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd September 9, 2016
+.Dd September 9, 2017
.Dt MDMFS 8
.Os
.Sh NAME
@@ -33,7 +33,9 @@
.Nm mount_mfs
.Nd configure and mount an in-memory file system using the
.Xr md 4
-driver
+driver or the
+.Xr tmpfs 5
+filesystem
.Sh SYNOPSIS
.Nm
.Op Fl DLlMNnPStTUX
@@ -63,9 +65,13 @@ utility is designed to be a work-alike and look-alike of the deprecated
.Xr mount_mfs 8 .
The end result is essentially the same,
but is accomplished in a completely different way.
-The
+Based on
+.Ar md-device ,
+the
.Nm
-utility configures an
+utility either creates a
+.Xr tmpfs 5
+filesystem, or it configures an
.Xr md 4
disk using
.Xr mdconfig 8 ,
@@ -81,6 +87,44 @@ compressed disk images, as long as the kernel supports this GEOM class.
All the command line options are passed to the appropriate program
at the appropriate stage in order to achieve the desired effect.
.Pp
+When
+.Ar md-device
+is `auto',
+.Nm
+uses
+.Xr tmpfs 5
+if it is present in the kernel or can be loaded as a module,
+otherwise it falls back to using
+.Xr md 4
+auto-unit as if `md' had been specified.
+.Pp
+When
+.Ar md-device
+is `tmpfs',
+.Nm
+mounts a
+.Xr tmpfs 5
+filesystem, translating the
+.Fl s
+size option, if present, into a `-o size=' mount option.
+Any
+.Fl o
+options on the command line are passed through to the
+.Xr tmpfs 5
+mount.
+Options specific to
+.Xr mdconfig 8
+or
+.Xr newfs 8
+are ignored.
+.Pp
+When
+.Ar md-device
+does not result in
+.Xr tmpfs 5
+being used, then an
+.Xr md 4
+device is configured instead.
By default,
.Nm
creates a swap-based
@@ -219,14 +263,10 @@ is
.Em not
specified.
That is,
-this will work for the default swap-backed
-.Pq Dv MD_SWAP
-disks,
-and the optional
-.Pq Fl M
-.Xr malloc 9
-backed disks
-.Pq Dv MD_MALLOC .
+this will work when the backing storage is some form of
+memory, as opposed to a fixed-size file.
+The size may include the usual SI suffixes (k, m, g, t, p).
+A number without a suffix is interpreted as a count of 512-byte sectors.
.It Fl t
Turn on the TRIM enable flag for
.Xr newfs 8 .
@@ -392,6 +432,7 @@ was given on the command line.
.Sh SEE ALSO
.Xr md 4 ,
.Xr fstab 5 ,
+.Xr tmpfs 5 ,
.Xr mdconfig 8 ,
.Xr mount 8 ,
.Xr newfs 8