diff options
Diffstat (limited to 'static/freebsd/man4/md.4 3.html')
| -rw-r--r-- | static/freebsd/man4/md.4 3.html | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/static/freebsd/man4/md.4 3.html b/static/freebsd/man4/md.4 3.html new file mode 100644 index 00000000..bc3401aa --- /dev/null +++ b/static/freebsd/man4/md.4 3.html @@ -0,0 +1,143 @@ +<table class="head"> + <tr> + <td class="head-ltitle">MD(4)</td> + <td class="head-vol">Device Drivers Manual</td> + <td class="head-rtitle">MD(4)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<p class="Pp"><code class="Nm">md</code> — <span class="Nd">memory + disk</span></p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<p class="Pp">To compile this driver into the kernel, place the following lines + in your kernel configuration file:</p> +<div class="Bd Pp Bd-indent"><code class="Cd">device md</code></div> +<p class="Pp">Alternatively, to load the driver as a module at boot time, place + the following line in <a class="Xr">loader.conf(5)</a>:</p> +<div class="Bd Pp Bd-indent Li"> +<pre>geom_md_load="YES"</pre> +</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +<p class="Pp">The <code class="Nm">md</code> driver provides support for four + kinds of memory backed virtual disks:</p> +<dl class="Bl-tag"> + <dt id="malloc"><a class="permalink" href="#malloc"><code class="Cm">malloc</code></a></dt> + <dd>Backing store is allocated using <a class="Xr">malloc(9)</a>. Only one + malloc-bucket is used, which means that all <code class="Nm">md</code> + devices with <code class="Cm">malloc</code> backing must share the + malloc-per-bucket-quota. The exact size of this quota varies, in + particular with the amount of RAM in the system. The exact value can be + determined with <a class="Xr">vmstat(8)</a>.</dd> + <dt id="preload"><a class="permalink" href="#preload"><code class="Cm">preload</code></a></dt> + <dd>A module loaded by <a class="Xr">loader(8)</a> with type + ‘md_image’ is used for backing store. For backwards + compatibility the type ‘mfs_root’ is also recognized. See + the description of module loading directives in + <a class="Xr">loader.conf(5)</a> and note that the module name will either + be an absolute path to the image file or the name of a file in the + <var class="Va">module_path</var>. + <p class="Pp">If the kernel is created with option + <code class="Dv">MD_ROOT</code> the first preloaded image found will + become the root file system.</p> + </dd> + <dt id="vnode"><a class="permalink" href="#vnode"><code class="Cm">vnode</code></a></dt> + <dd>A regular file is used as backing store. This allows for mounting ISO + images without the tedious detour over actual physical media.</dd> + <dt id="swap"><a class="permalink" href="#swap"><code class="Cm">swap</code></a></dt> + <dd>Backing store is allocated from buffer memory. Pages get pushed out to the + swap when the system is under memory pressure, otherwise they stay in the + operating memory. Using <code class="Cm">swap</code> backing is generally + preferable over <code class="Cm">malloc</code> backing.</dd> +</dl> +<p class="Pp">For more information, please see + <a class="Xr">mdconfig(8)</a>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="EXAMPLES"><a class="permalink" href="#EXAMPLES">EXAMPLES</a></h1> +<p class="Pp">To create a kernel with a ramdisk or MD file system, your kernel + config needs the following options:</p> +<div class="Bd Pp Bd-indent Li"> +<pre>options MD_ROOT # MD is a potential root device +options MD_ROOT_READONLY # disallow mounting root writeable +options MD_ROOT_SIZE=8192 # 8MB ram disk +makeoptions MFS_IMAGE=/h/foo/ARM-MD +options ROOTDEVNAME=\"ufs:md0\"</pre> +</div> +<p class="Pp">The image in <span class="Pa">/h/foo/ARM-MD</span> will be loaded + as the initial image each boot. To create the image to use, please follow + the steps to create a file-backed disk found in the + <a class="Xr">mdconfig(8)</a> man page. Other tools will also create these + images, such as NanoBSD.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="ARM_KERNEL_OPTIONS"><a class="permalink" href="#ARM_KERNEL_OPTIONS">ARM + KERNEL OPTIONS</a></h1> +<p class="Pp">On the armv7 architecture, an MD_ROOT image larger than + approximately 55 MiB may require building a custom kernel using several + tuning options related to kernel memory usage.</p> +<dl class="Bl-tag"> + <dt><code class="Cd">options LOCORE_MAP_MB=<num></code></dt> + <dd>This configures how much memory is mapped for the kernel during the early + initialization stages. The value must be at least as large as the kernel + plus all preloaded modules, including the root image. There is no downside + to setting this value too large, as long as it does not exceed the amount + of physical memory. The default is 64 MiB.</dd> + <dt><code class="Cd">options NKPT2PG=<num></code></dt> + <dd>This configures the number of kernel L2 page table pages to preallocate + during kernel initialization. Each L2 page can map 4 MiB of kernel space. + The value must be large enough to map the kernel plus all preloaded + modules, including the root image. The default value is 32, which is + sufficient to map 128 MiB.</dd> + <dt><code class="Cd">options VM_KMEM_SIZE_SCALE=<num></code></dt> + <dd>This configures the amount of kernel virtual address (KVA) space to + dedicate to the kmem_arena map. The scale value is the ratio of physical + to virtual pages. The default value of 3 allocates a page of KVA for each + 3 pages of physical ram in the system. The kernel and modules, including + the root image, also consume KVA. The combination of a large root image + and the default scaling may preallocate so much KVA that there is not + enough remaining address space to allocate kernel stacks, IO buffers, and + other resources that are not part of kmem_arena. Overallocating kmem_arena + space is likely to manifest as failure to launch userland processes with + "cannot allocate kernel stack" messages. Setting the scale value + too high may result in kernel failure to allocate memory because + kmem_arena is too small, and the failure may require significant runtime + to manifest. Empirically, a value of 5 works well for a 200 MiB root image + on a system with 2 GiB of physical ram.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<p class="Pp"><a class="Xr">gpart(8)</a>, <a class="Xr">loader(8)</a>, + <a class="Xr">mdconfig(8)</a>, <a class="Xr">mdmfs(8)</a>, + <a class="Xr">newfs(8)</a>, <a class="Xr">vmstat(8)</a></p> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<p class="Pp">The <code class="Nm">md</code> driver first appeared in + <span class="Ux">FreeBSD 4.0</span> as a cleaner replacement for the MFS + functionality previously used in PicoBSD and in the + <span class="Ux">FreeBSD</span> installation process.</p> +<p class="Pp" id="vn">The <code class="Nm">md</code> driver did a hostile + takeover of the <a class="permalink" href="#vn"><b class="Sy">vn</b></a> + driver in <span class="Ux">FreeBSD 5.0</span>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<p class="Pp">The <code class="Nm">md</code> driver was written by + <span class="An">Poul-Henning Kamp</span> + <<a class="Mt" href="mailto:phk@FreeBSD.org">phk@FreeBSD.org</a>>.</p> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">July 16, 2025</td> + <td class="foot-os">FreeBSD 15.0</td> + </tr> +</table> |
