]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man4/md.4
Import lua 5.3.4 to contrib
[FreeBSD/FreeBSD.git] / share / man / man4 / md.4
1 .\" ----------------------------------------------------------------------------
2 .\" "THE BEER-WARE LICENSE" (Revision 42):
3 .\" <phk@FreeBSD.org> wrote this file.  As long as you retain this notice you
4 .\" can do whatever you want with this stuff. If we meet some day, and you think
5 .\" this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
6 .\" ----------------------------------------------------------------------------
7 .\"
8 .\" $FreeBSD$
9 .\"
10 .Dd November 5, 2017
11 .Dt MD 4
12 .Os
13 .Sh NAME
14 .Nm md
15 .Nd memory disk
16 .Sh SYNOPSIS
17 To compile this driver into the kernel,
18 place the following lines in your
19 kernel configuration file:
20 .Bd -ragged -offset indent
21 .Cd "device md"
22 .Ed
23 .Pp
24 Alternatively, to load the driver as a
25 module at boot time, place the following line in
26 .Xr loader.conf 5 :
27 .Bd -literal -offset indent
28 geom_md_load="YES"
29 .Ed
30 .Sh DESCRIPTION
31 The
32 .Nm
33 driver provides support for four kinds of memory backed virtual disks:
34 .Bl -tag -width preload
35 .It Cm malloc
36 Backing store is allocated using
37 .Xr malloc 9 .
38 Only one malloc-bucket is used, which means that all
39 .Nm
40 devices with
41 .Cm malloc
42 backing must share the malloc-per-bucket-quota.
43 The exact size of this quota varies, in particular with the amount
44 of RAM in the
45 system.
46 The exact value can be determined with
47 .Xr vmstat 8 .
48 .It Cm preload
49 A file loaded by
50 .Xr loader 8
51 with type
52 .Sq md_image
53 is used for backing store.
54 For backwards compatibility the type
55 .Sq mfs_root
56 is also recognized.
57 If the kernel is created with option
58 .Dv MD_ROOT
59 the first preloaded image found will become the root file system.
60 .It Cm vnode
61 A regular file is used as backing store.
62 This allows for mounting ISO images without the tedious
63 detour over actual physical media.
64 .It Cm swap
65 Backing store is allocated from buffer memory.
66 Pages get pushed out to the swap when the system is under memory
67 pressure, otherwise they stay in the operating memory.
68 Using
69 .Cm swap
70 backing is generally preferable over
71 .Cm malloc
72 backing.
73 .El
74 .Pp
75 For more information, please see
76 .Xr mdconfig 8 .
77 .Sh EXAMPLES
78 To create a kernel with a ramdisk or MD file system, your kernel config
79 needs the following options:
80 .Bd -literal -offset indent
81 options         MD_ROOT                 # MD is a potential root device
82 options         MD_ROOT_SIZE=8192       # 8MB ram disk
83 makeoptions     MFS_IMAGE=/h/foo/ARM-MD
84 options         ROOTDEVNAME=\\"ufs:md0\\"
85 .Ed
86 .Pp
87 The image in
88 .Pa /h/foo/ARM-MD
89 will be loaded as the initial image each boot.
90 To create the image to use, please follow the steps to create a file-backed
91 disk found in the
92 .Xr mdconfig 8
93 man page.
94 Other tools will also create these images, such as NanoBSD.
95 .Sh SEE ALSO
96 .Xr gpart 8 ,
97 .Xr loader 8 ,
98 .Xr mdconfig 8 ,
99 .Xr mdmfs 8 ,
100 .Xr newfs 8 ,
101 .Xr vmstat 8
102 .Sh HISTORY
103 The
104 .Nm
105 driver first appeared in
106 .Fx 4.0
107 as a cleaner replacement
108 for the MFS functionality previously used in
109 .Tn PicoBSD
110 and in the
111 .Fx
112 installation process.
113 .Pp
114 The
115 .Nm
116 driver did a hostile takeover of the
117 .Xr vn 4
118 driver in
119 .Fx 5.0 .
120 .Sh AUTHORS
121 The
122 .Nm
123 driver was written by
124 .An Poul-Henning Kamp Aq Mt phk@FreeBSD.org .