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.\" $FreeBSD$ 27.\" 28.Dd March 9, 2016 29.Dt MDMFS 8 30.Os 31.Sh NAME 32.Nm mdmfs , 33.Nm mount_mfs 34.Nd configure and mount an in-memory file system using the 35.Xr md 4 36driver 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 m Ar percent-free 50.Op Fl O Ar optimization 51.Op Fl o Ar mount-options 52.Op Fl p Ar permissions 53.Op Fl s Ar size 54.Op Fl T Ar fstype 55.Op Fl v Ar version 56.Op Fl w Ar user : Ns Ar group 57.Ar md-device 58.Ar mount-point 59.Sh DESCRIPTION 60The 61.Nm 62utility is designed to be a work-alike and look-alike of the deprecated 63.Xr mount_mfs 8 . 64The end result is essentially the same, 65but is accomplished in a completely different way. 66The 67.Nm 68utility configures an 69.Xr md 4 70disk using 71.Xr mdconfig 8 , 72puts a UFS file system on it (unless 73.Fl P 74was specified) using 75.Xr newfs 8 , 76and mounts it using 77.Xr mount 8 . 78It can handle 79.Xr geom_uzip 4 80compressed disk images, as long as the kernel supports this GEOM class. 81All the command line options are passed to the appropriate program 82at the appropriate stage in order to achieve the desired effect. 83.Pp 84By default, 85.Nm 86creates a swap-based 87.Pq Dv MD_SWAP 88disk with soft-updates enabled 89and mounts it on 90.Ar mount-point . 91It uses the 92.Xr md 4 93device specified by 94.Ar md-device . 95If 96.Ar md-device 97is 98.Ql md 99(no unit number), 100it will use 101.Xr md 4 Ns 's 102auto-unit feature to automatically select an unused device. 103Unless otherwise specified with one of the options below, 104it uses the default arguments to all the helper programs. 105.Pp 106The following options are available. 107Where possible, 108the option letter matches the one used by 109.Xr mount_mfs 8 110for the same thing. 111.Bl -tag -width indent 112.It Fl a Ar maxcontig 113Specify the maximum number of contiguous blocks that will be laid 114out before forcing a rotational delay 115(see the 116.Fl d 117option). 118.It Fl b Ar block-size 119The block size of the file system, in bytes. 120.It Fl c Ar blocks-per-cylinder-group 121The number of blocks per cylinder group in the file system. 122.It Fl D 123If not using auto-unit, 124do not run 125.Xr mdconfig 8 126to try to detach the unit before attaching it. 127.It Fl d Ar max-extent-size 128The file system may choose to store large files using extents. 129This parameter specifies the largest extent size that may be 130used. It is presently limited to its default value which is 16 131times the file system blocksize. 132.It Fl E Ar path-mdconfig 133Use 134.Ar path-mdconfig 135as a location of the 136.Xr mdconfig 8 137utility. 138.It Fl e Ar maxbpg 139Indicate the maximum number of blocks any single file can allocate 140out of a cylinder group before it is forced to begin allocating 141blocks from another cylinder group. 142.It Fl F Ar file 143Create a vnode-backed 144.Pq Dv MD_VNODE 145memory disk backed by 146.Ar file . 147.It Fl f Ar frag-size 148The fragment size of the file system in bytes. 149.It Fl i Ar bytes 150Number of bytes per inode. 151.It Fl l 152Enable multilabel MAC on the new file system. 153.It Fl L 154Show the output of the helper programs. 155By default, 156it is sent to 157.Pa /dev/null . 158.It Fl M 159Create a 160.Xr malloc 9 161backed disk 162.Pq Dv MD_MALLOC 163instead of a swap-backed disk. 164.It Fl m Ar percent-free 165The percentage of space reserved for the superuser. 166.It Fl N 167Do not actually run the helper programs. 168This is most useful in conjunction with 169.Fl X . 170.It Fl n 171Do not create a 172.Pa .snap 173directory on the new file system. 174.It Fl O Ar optimization 175Select the optimization preference; 176valid choices are 177.Cm space 178and 179.Cm time , 180which will optimize for minimum space fragmentation and 181minimum time spent allocating blocks, 182respectively. 183.It Fl o Ar mount-options 184Specify the mount options with which to mount the file system. 185See 186.Xr mount 8 187for more information. 188.It Fl P 189Preserve the existing file system; 190do not run 191.Xr newfs 8 . 192This only makes sense if 193.Fl F 194is specified to create a vnode-backed disk. 195.It Fl p Ar permissions 196Set the file (directory) permissions of the mount point 197.Ar mount-point 198to 199.Ar permissions . 200The 201.Ar permissions 202argument can be in any of the mode formats recognized by 203.Xr chmod 1 . 204If symbolic permissions are specified, 205the operation characters 206.Dq + 207and 208.Dq - 209are interpreted relative to the initial permissions of 210.Dq a=rwx . 211.It Fl S 212Do not enable soft-updates on the file system. 213.It Fl s Ar size 214Specify the size of the disk to create. 215This only makes sense if 216.Fl F 217is 218.Em not 219specified. 220That is, 221this will work for the default swap-backed 222.Pq Dv MD_SWAP 223disks, 224and the optional 225.Pq Fl M 226.Xr malloc 9 227backed disks 228.Pq Dv MD_MALLOC . 229.It Fl t 230Turn on the TRIM enable flag for 231.Xr newfs 8 . 232When used with a file system that issue BIO_DELETE bio requests, 233.Xr md 4 234returns deleted blocks to the system memory pool. 235.It Fl T Ar fstype 236Specify a file system type for a vnode-backed memory disk. 237Any file system supported by 238.Xr mount 8 239command can be specified. 240This option only makes sense when 241.Fl F 242and 243.Fl P 244are used. 245.It Fl U 246Enable soft-updates on the file system. 247This is the default, and is accepted only 248for compatibility. 249It is only really useful to negate the 250.Fl S 251flag, should such a need occur. 252.It Fl v Ar version 253Specify the UFS version number for use on the file system; it may be 254either 255.Dv 1 256or 257.Dv 2 . 258The default is derived from the default of the 259.Xr newfs 8 260command. 261.It Fl w Ar user : Ns Ar group 262Set the owner and group to 263.Ar user 264and 265.Ar group , 266respectively. 267The arguments have the same semantics as with 268.Xr chown 8 , 269but specifying just a 270.Ar user 271or just a 272.Ar group 273is not supported. 274.It Fl X 275Print what command will be run before running it, and 276other assorted debugging information. 277.El 278.Pp 279The 280.Fl F 281and 282.Fl s 283options are passed to 284.Xr mdconfig 8 285as 286.Fl f 287and 288.Fl s , 289respectively. 290The 291.Fl a , b , c , d , e , f , i , m 292and 293.Fl n 294options are passed to 295.Xr newfs 8 296with the same letter. 297The 298.Fl O 299option is passed to 300.Xr newfs 8 301as 302.Fl o . 303The 304.Fl o 305option is passed to 306.Xr mount 8 307with the same letter. 308The 309.Fl T 310option is passed to 311.Xr mount 8 312as 313.Fl t . 314See the programs that the options are passed to for more information 315on their semantics. 316.Sh EXAMPLES 317Create and mount a 32 megabyte swap-backed file system on 318.Pa /tmp : 319.Pp 320.Dl "mdmfs -s 32m md /tmp" 321.Pp 322The same file system created as an entry in 323.Pa /etc/fstab : 324.Pp 325.Dl "md /tmp mfs rw,-s32m 2 0" 326.Pp 327Create and mount a 16 megabyte malloc-backed file system on 328.Pa /tmp 329using the 330.Pa /dev/md1 331device; 332furthermore, 333do not use soft-updates on it and mount it 334.Cm async : 335.Pp 336.Dl "mdmfs -M -S -o async -s 16m md1 /tmp" 337.Pp 338Create and mount a 339.Xr geom_uzip 4 340based compressed disk image: 341.Pp 342.Dl "mdmfs -P -F foo.uzip -oro md.uzip /tmp/" 343.Pp 344Mount the same image, specifying the 345.Pa /dev/md1 346device: 347.Pp 348.Dl "mdmfs -P -F foo.uzip -oro md1.uzip /tmp/" 349.Pp 350Configure a vnode-backed file system and mount its first partition, 351using automatic device numbering: 352.Pp 353.Dl "mdmfs -P -F foo.img mds1a /tmp/" 354.Pp 355Mount a vnode-backed cd9660 file system using automatic device numbering: 356.Pp 357.Dl "mdmfs -T cd9660 -P -F foo.iso md /tmp" 358.Sh COMPATIBILITY 359The 360.Nm 361utility, while designed to be compatible with 362.Xr mount_mfs 8 , 363can be useful by itself. 364Since 365.Xr mount_mfs 8 366had some silly defaults, a 367.Dq compatibility 368mode is provided for the case where bug-to-bug compatibility is desired. 369.Pp 370Compatibility is enabled by starting 371.Nm 372with the name 373.Li mount_mfs 374or 375.Li mfs 376(as returned by 377.Xr getprogname 3 ) . 378In this mode, the following behavior, as done by 379.Xr mount_mfs 8 , 380is duplicated: 381.Bl -bullet -offset indent 382.It 383The file mode of 384.Ar mount-point 385is set by default to 386.Li 01777 387as if 388.Fl p Ar 1777 389was given on the command line. 390.El 391.Sh SEE ALSO 392.Xr md 4 , 393.Xr fstab 5 , 394.Xr mdconfig 8 , 395.Xr mount 8 , 396.Xr newfs 8 397.Sh AUTHORS 398.An Dima Dorfman 399