2000-07-07 11:52:03 +00:00
|
|
|
.\" ----------------------------------------------------------------------------
|
|
|
|
.\" "THE BEER-WARE LICENSE" (Revision 42):
|
2010-05-19 08:57:53 +00:00
|
|
|
.\" <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
|
2000-07-07 11:52:03 +00:00
|
|
|
.\" can do whatever you want with this stuff. If we meet some day, and you think
|
|
|
|
.\" this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
|
|
|
.\" ----------------------------------------------------------------------------
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2017-11-05 18:45:43 +00:00
|
|
|
.Dd November 5, 2017
|
2000-07-07 11:52:03 +00:00
|
|
|
.Dt MD 4
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm md
|
|
|
|
.Nd memory disk
|
|
|
|
.Sh SYNOPSIS
|
2017-11-05 18:45:43 +00:00
|
|
|
To compile this driver into the kernel,
|
|
|
|
place the following lines in your
|
|
|
|
kernel configuration file:
|
|
|
|
.Bd -ragged -offset indent
|
|
|
|
.Cd "device md"
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Alternatively, to load the driver as a
|
|
|
|
module at boot time, place the following line in
|
|
|
|
.Xr loader.conf 5 :
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
geom_md_load="YES"
|
|
|
|
.Ed
|
2000-07-07 11:52:03 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
2001-03-09 20:07:37 +00:00
|
|
|
driver provides support for four kinds of memory backed virtual disks:
|
|
|
|
.Bl -tag -width preload
|
|
|
|
.It Cm malloc
|
|
|
|
Backing store is allocated using
|
2000-07-07 11:52:03 +00:00
|
|
|
.Xr malloc 9 .
|
2001-03-09 20:07:37 +00:00
|
|
|
Only one malloc-bucket is used, which means that all
|
2000-07-07 11:52:03 +00:00
|
|
|
.Nm
|
2001-03-09 20:07:37 +00:00
|
|
|
devices with
|
|
|
|
.Cm malloc
|
|
|
|
backing must share the malloc-per-bucket-quota.
|
2001-06-17 02:24:04 +00:00
|
|
|
The exact size of this quota varies, in particular with the amount
|
2001-07-14 19:41:16 +00:00
|
|
|
of RAM in the
|
2001-03-12 09:14:22 +00:00
|
|
|
system.
|
|
|
|
The exact value can be determined with
|
2001-03-09 20:07:37 +00:00
|
|
|
.Xr vmstat 8 .
|
|
|
|
.It Cm preload
|
2001-07-14 19:41:16 +00:00
|
|
|
A file loaded by
|
2001-03-09 20:07:37 +00:00
|
|
|
.Xr loader 8
|
2001-07-14 19:41:16 +00:00
|
|
|
with type
|
2000-07-07 11:52:03 +00:00
|
|
|
.Sq md_image
|
2001-03-09 20:07:37 +00:00
|
|
|
is used for backing store.
|
|
|
|
For backwards compatibility the type
|
2000-07-07 11:52:03 +00:00
|
|
|
.Sq mfs_root
|
2001-03-09 20:07:37 +00:00
|
|
|
is also recognized.
|
|
|
|
If the kernel is created with option
|
2001-03-12 09:14:22 +00:00
|
|
|
.Dv MD_ROOT
|
2002-12-12 17:26:04 +00:00
|
|
|
the first preloaded image found will become the root file system.
|
2001-03-09 20:07:37 +00:00
|
|
|
.It Cm vnode
|
|
|
|
A regular file is used as backing store.
|
|
|
|
This allows for mounting ISO images without the tedious
|
|
|
|
detour over actual physical media.
|
|
|
|
.It Cm swap
|
2007-05-12 15:33:18 +00:00
|
|
|
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
|
|
|
|
.Cm swap
|
|
|
|
backing is generally preferable over
|
|
|
|
.Cm malloc
|
|
|
|
backing.
|
2001-03-09 20:07:37 +00:00
|
|
|
.El
|
2000-07-07 11:52:03 +00:00
|
|
|
.Pp
|
2001-03-09 20:07:37 +00:00
|
|
|
For more information, please see
|
2001-03-12 09:14:22 +00:00
|
|
|
.Xr mdconfig 8 .
|
2006-11-24 18:53:45 +00:00
|
|
|
.Sh EXAMPLES
|
|
|
|
To create a kernel with a ramdisk or MD file system, your kernel config
|
|
|
|
needs the following options:
|
2007-10-30 16:02:49 +00:00
|
|
|
.Bd -literal -offset indent
|
2009-05-17 12:21:11 +00:00
|
|
|
options MD_ROOT # MD is a potential root device
|
2006-11-24 18:53:45 +00:00
|
|
|
options MD_ROOT_SIZE=8192 # 8MB ram disk
|
|
|
|
makeoptions MFS_IMAGE=/h/foo/ARM-MD
|
2009-05-17 12:21:11 +00:00
|
|
|
options ROOTDEVNAME=\\"ufs:md0\\"
|
2006-11-24 18:53:45 +00:00
|
|
|
.Ed
|
2009-05-17 12:21:11 +00:00
|
|
|
.Pp
|
2006-11-24 18:53:45 +00:00
|
|
|
The image in
|
|
|
|
.Pa /h/foo/ARM-MD
|
|
|
|
will be loaded as the initial image each boot.
|
|
|
|
To create the image to use, please follow the steps to create a file-backed
|
2012-03-29 05:02:12 +00:00
|
|
|
disk found in the
|
2006-11-24 18:53:45 +00:00
|
|
|
.Xr mdconfig 8
|
|
|
|
man page.
|
|
|
|
Other tools will also create these images, such as NanoBSD.
|
2000-07-07 11:52:03 +00:00
|
|
|
.Sh SEE ALSO
|
2015-09-02 14:08:43 +00:00
|
|
|
.Xr gpart 8 ,
|
2000-07-07 11:52:03 +00:00
|
|
|
.Xr loader 8 ,
|
2001-03-12 09:14:22 +00:00
|
|
|
.Xr mdconfig 8 ,
|
2003-04-27 01:46:56 +00:00
|
|
|
.Xr mdmfs 8 ,
|
2000-07-07 11:52:03 +00:00
|
|
|
.Xr newfs 8 ,
|
|
|
|
.Xr vmstat 8
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
driver first appeared in
|
|
|
|
.Fx 4.0
|
|
|
|
as a cleaner replacement
|
2001-03-12 09:14:22 +00:00
|
|
|
for the MFS functionality previously used in
|
|
|
|
.Tn PicoBSD
|
2000-11-14 11:20:58 +00:00
|
|
|
and in the
|
|
|
|
.Fx
|
|
|
|
installation process.
|
2001-03-09 20:07:37 +00:00
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
driver did a hostile takeover of the
|
|
|
|
.Xr vn 4
|
|
|
|
driver in
|
|
|
|
.Fx 5.0 .
|
2000-07-07 11:52:03 +00:00
|
|
|
.Sh AUTHORS
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
driver was written by
|
2014-06-26 21:46:14 +00:00
|
|
|
.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org .
|