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