1.\" 2.\" Copyright (c) 2001 Dima Dorfman. 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24.\" SUCH DAMAGE. 25.\" 26.Dd October 31, 2019 27.Dt MDMFS 8 28.Os 29.Sh NAME 30.Nm mdmfs , 31.Nm mount_mfs 32.Nd configure and mount an in-memory file system using the 33.Xr md 4 34driver or the 35.Xr tmpfs 5 36filesystem 37.Sh SYNOPSIS 38.Nm 39.Op Fl DLlMNnPStTUX 40.Op Fl a Ar maxcontig 41.Op Fl b Ar block-size 42.Op Fl c Ar blocks-per-cylinder-group 43.Op Fl d Ar max-extent-size 44.Op Fl E Ar path-mdconfig 45.Op Fl e Ar maxbpg 46.Op Fl F Ar file 47.Op Fl f Ar frag-size 48.Op Fl i Ar bytes 49.Op Fl k Ar skel 50.Op Fl m Ar percent-free 51.Op Fl O Ar optimization 52.Op Fl o Ar mount-options 53.Op Fl p Ar permissions 54.Op Fl s Ar size 55.Op Fl T Ar fstype 56.Op Fl v Ar version 57.Op Fl w Ar user : Ns Ar group 58.Ar md-device 59.Ar mount-point 60.Sh DESCRIPTION 61The 62.Nm 63utility is designed to be a work-alike and look-alike of the deprecated 64.Nm mount_mfs . 65The end result is essentially the same, 66but is accomplished in a completely different way. 67Based on 68.Ar md-device , 69the 70.Nm 71utility either creates a 72.Xr tmpfs 5 73filesystem, or it configures an 74.Xr md 4 75disk using 76.Xr mdconfig 8 , 77puts a UFS file system on it (unless 78.Fl P 79was specified) using 80.Xr newfs 8 , 81and mounts it using 82.Xr mount 8 . 83It can handle 84.Xr geom_uzip 4 85compressed disk images, as long as the kernel supports this GEOM class. 86All the command line options are passed to the appropriate program 87at the appropriate stage in order to achieve the desired effect. 88.Pp 89When 90.Ar md-device 91is `auto', 92.Nm 93uses 94.Xr tmpfs 5 95if it is present in the kernel or can be loaded as a module, 96otherwise it falls back to using 97.Xr md 4 98auto-unit as if `md' had been specified. 99.Pp 100When 101.Ar md-device 102is `tmpfs', 103.Nm 104mounts a 105.Xr tmpfs 5 106filesystem, translating the 107.Fl s 108size option, if present, into a `-o size=' mount option. 109Any 110.Fl o 111options on the command line are passed through to the 112.Xr tmpfs 5 113mount. 114Options specific to 115.Xr mdconfig 8 116or 117.Xr newfs 8 118are ignored. 119.Pp 120When 121.Ar md-device 122does not result in 123.Xr tmpfs 5 124being used, then an 125.Xr md 4 126device is configured instead. 127By default, 128.Nm 129creates a swap-based 130.Pq Dv MD_SWAP 131disk with soft-updates enabled 132and mounts it on 133.Ar mount-point . 134It uses the 135.Xr md 4 136device specified by 137.Ar md-device . 138If 139.Ar md-device 140is 141.Ql md 142(no unit number), 143it will use 144.Xr md 4 Ns 's 145auto-unit feature to automatically select an unused device. 146Unless otherwise specified with one of the options below, 147it uses the default arguments to all the helper programs. 148.Pp 149The following options are available. 150Where possible, 151the option letter matches the one used by 152.Nm mount_mfs 153for the same thing. 154.Bl -tag -width indent 155.It Fl a Ar maxcontig 156Specify the maximum number of contiguous blocks that will be laid 157out before forcing a rotational delay 158(see the 159.Fl d 160option). 161.It Fl b Ar block-size 162The block size of the file system, in bytes. 163.It Fl c Ar blocks-per-cylinder-group 164The number of blocks per cylinder group in the file system. 165.It Fl D 166If not using auto-unit, 167do not run 168.Xr mdconfig 8 169to try to detach the unit before attaching it. 170.It Fl d Ar max-extent-size 171The file system may choose to store large files using extents. 172This parameter specifies the largest extent size that may be 173used. 174It is presently limited to its default value which is 16 175times the file system blocksize. 176.It Fl E Ar path-mdconfig 177Use 178.Ar path-mdconfig 179as a location of the 180.Xr mdconfig 8 181utility. 182.It Fl e Ar maxbpg 183Indicate the maximum number of blocks any single file can allocate 184out of a cylinder group before it is forced to begin allocating 185blocks from another cylinder group. 186.It Fl F Ar file 187Create a vnode-backed 188.Pq Dv MD_VNODE 189memory disk backed by 190.Ar file . 191.It Fl f Ar frag-size 192The fragment size of the file system in bytes. 193.It Fl i Ar bytes 194Number of bytes per inode. 195.It Fl k Ar skel 196Copy the content of directory 197.Ar skel 198into 199.Ar mount-point . 200.It Fl l 201Enable multilabel MAC on the new file system. 202.It Fl L 203Show the output of the helper programs. 204By default, 205it is sent to 206.Pa /dev/null . 207.It Fl M 208Create a 209.Xr malloc 9 210backed disk 211.Pq Dv MD_MALLOC 212instead of a swap-backed disk. 213.It Fl m Ar percent-free 214The percentage of space reserved for the superuser. 215.It Fl N 216Do not actually run the helper programs. 217This is most useful in conjunction with 218.Fl X . 219.It Fl n 220Do not create a 221.Pa .snap 222directory on the new file system. 223.It Fl O Ar optimization 224Select the optimization preference; 225valid choices are 226.Cm space 227and 228.Cm time , 229which will optimize for minimum space fragmentation and 230minimum time spent allocating blocks, 231respectively. 232.It Fl o Ar mount-options 233Specify the mount options with which to mount the file system. 234See 235.Xr mount 8 236for more information. 237.It Fl P 238Preserve the existing file system; 239do not run 240.Xr newfs 8 . 241This only makes sense if 242.Fl F 243is specified to create a vnode-backed disk. 244.It Fl p Ar permissions 245Set the file (directory) permissions of the mount point 246.Ar mount-point 247to 248.Ar permissions . 249The 250.Ar permissions 251argument can be in any of the mode formats recognized by 252.Xr chmod 1 . 253If symbolic permissions are specified, 254the operation characters 255.Dq + 256and 257.Dq - 258are interpreted relative to the initial permissions of 259.Dq a=rwx . 260.It Fl S 261Do not enable soft-updates on the file system. 262.It Fl s Ar size 263Specify the size of the disk to create. 264This only makes sense if 265.Fl F 266is 267.Em not 268specified. 269That is, 270this will work when the backing storage is some form of 271memory, as opposed to a fixed-size file. 272The size may include the usual SI suffixes (k, m, g, t, p). 273A number without a suffix is interpreted as a count of 512-byte sectors. 274.It Fl t 275Turn on the TRIM enable flag for 276.Xr newfs 8 . 277When used with a file system that issue BIO_DELETE bio requests, 278.Xr md 4 279returns deleted blocks to the system memory pool. 280.It Fl T Ar fstype 281Specify a file system type for a vnode-backed memory disk. 282Any file system supported by 283.Xr mount 8 284command can be specified. 285This option only makes sense when 286.Fl F 287and 288.Fl P 289are used. 290.It Fl U 291Enable soft-updates on the file system. 292This is the default, and is accepted only 293for compatibility. 294It is only really useful to negate the 295.Fl S 296flag, should such a need occur. 297.It Fl v Ar version 298Specify the UFS version number for use on the file system; it may be 299either 300.Dv 1 301or 302.Dv 2 . 303The default is derived from the default of the 304.Xr newfs 8 305command. 306.It Fl w Ar user : Ns Ar group 307Set the owner and group to 308.Ar user 309and 310.Ar group , 311respectively. 312The arguments have the same semantics as with 313.Xr chown 8 , 314but specifying just a 315.Ar user 316or just a 317.Ar group 318is not supported. 319.It Fl X 320Print what command will be run before running it, and 321other assorted debugging information. 322.El 323.Pp 324The 325.Fl F 326and 327.Fl s 328options are passed to 329.Xr mdconfig 8 330as 331.Fl f 332and 333.Fl s , 334respectively. 335The 336.Fl a , b , c , d , e , f , i , m 337and 338.Fl n 339options are passed to 340.Xr newfs 8 341with the same letter. 342The 343.Fl O 344option is passed to 345.Xr newfs 8 346as 347.Fl o . 348The 349.Fl o 350option is passed to 351.Xr mount 8 352with the same letter. 353The 354.Fl T 355option is passed to 356.Xr mount 8 357as 358.Fl t . 359For information on semantics, refer to the documentation of the programs 360that the options are passed to. 361.Sh EXAMPLES 362Create and mount a 32 megabyte swap-backed file system on 363.Pa /tmp : 364.Pp 365.Dl "mdmfs -s 32m md /tmp" 366.Pp 367The same file system created as an entry in 368.Pa /etc/fstab : 369.Pp 370.Dl "md /tmp mfs rw,-s32m 2 0" 371.Pp 372Create and mount a 16 megabyte malloc-backed file system on 373.Pa /tmp 374using the 375.Pa /dev/md1 376device; 377furthermore, 378do not use soft-updates on it and mount it 379.Cm async : 380.Pp 381.Dl "mdmfs -M -S -o async -s 16m md1 /tmp" 382.Pp 383Create and mount a 384.Xr geom_uzip 4 385based compressed disk image: 386.Pp 387.Dl "mdmfs -P -F foo.uzip -oro md.uzip /tmp/" 388.Pp 389Mount the same image, specifying the 390.Pa /dev/md1 391device: 392.Pp 393.Dl "mdmfs -P -F foo.uzip -oro md1.uzip /tmp/" 394.Pp 395Configure a vnode-backed file system and mount its first partition, 396using automatic device numbering: 397.Pp 398.Dl "mdmfs -P -F foo.img mds1a /tmp/" 399.Pp 400Mount a vnode-backed cd9660 file system using automatic device numbering: 401.Pp 402.Dl "mdmfs -T cd9660 -P -F foo.iso md /tmp" 403.Sh COMPATIBILITY 404The 405.Nm 406utility, while designed to be compatible with 407.Nm mount_mfs , 408can be useful by itself. 409Since 410.Nm mount_mfs 411had some silly defaults, a 412.Dq compatibility 413mode is provided for the case where bug-to-bug compatibility is desired. 414.Pp 415Compatibility is enabled by starting 416.Nm 417with the name 418.Li mount_mfs 419or 420.Li mfs 421(as returned by 422.Xr getprogname 3 ) . 423In this mode, the following behavior, as done by 424.Nm mount_mfs , 425is duplicated: 426.Bl -bullet -offset indent 427.It 428The file mode of 429.Ar mount-point 430is set by default to 431.Li 01777 432as if 433.Fl p Ar 1777 434was given on the command line. 435.El 436.Sh SEE ALSO 437.Xr md 4 , 438.Xr fstab 5 , 439.Xr tmpfs 5 , 440.Xr mdconfig 8 , 441.Xr mount 8 , 442.Xr newfs 8 443.Sh HISTORY 444The 445.Nm 446utility appeared in 447.Fx 5.0 . 448.Sh AUTHORS 449.An Dima Dorfman 450