xref: /freebsd/share/man/man4/md.4 (revision 7bd6fde3)
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 24, 2006
11.Dt MD 4
12.Os
13.Sh NAME
14.Nm md
15.Nd memory disk
16.Sh SYNOPSIS
17.Cd device md
18.Sh DESCRIPTION
19The
20.Nm
21driver provides support for four kinds of memory backed virtual disks:
22.Bl -tag -width preload
23.It Cm malloc
24Backing store is allocated using
25.Xr malloc 9 .
26Only one malloc-bucket is used, which means that all
27.Nm
28devices with
29.Cm malloc
30backing must share the malloc-per-bucket-quota.
31The exact size of this quota varies, in particular with the amount
32of RAM in the
33system.
34The exact value can be determined with
35.Xr vmstat 8 .
36.It Cm preload
37A file loaded by
38.Xr loader 8
39with type
40.Sq md_image
41is used for backing store.
42For backwards compatibility the type
43.Sq mfs_root
44is also recognized.
45If the kernel is created with option
46.Dv MD_ROOT
47the first preloaded image found will become the root file system.
48.It Cm vnode
49A regular file is used as backing store.
50This allows for mounting ISO images without the tedious
51detour over actual physical media.
52.It Cm swap
53Backing store is allocated from swap space.
54.El
55.Pp
56For more information, please see
57.Xr mdconfig 8 .
58.Sh EXAMPLES
59To create a kernel with a ramdisk or MD file system, your kernel config
60needs the following options:
61.Bd -literal -ofset indent
62options 	MD_ROOT			#MD is a potential root device
63options		MD_ROOT_SIZE=8192	# 8MB ram disk
64makeoptions	MFS_IMAGE=/h/foo/ARM-MD
65options 	ROOTDEVNAME=\"ufs:md0\"
66.Ed
67The image in
68.Pa /h/foo/ARM-MD
69will be loaded as the initial image each boot.
70To create the image to use, please follow the steps to create a file-backed
71disk found in the
72.Xr mdconfig 8
73man page.
74Other tools will also create these images, such as NanoBSD.
75.Sh SEE ALSO
76.Xr disklabel 5 ,
77.Xr disklabel 8 ,
78.Xr fdisk 8 ,
79.Xr loader 8 ,
80.Xr mdconfig 8 ,
81.Xr mdmfs 8 ,
82.Xr newfs 8 ,
83.Xr vmstat 8
84.Sh HISTORY
85The
86.Nm
87driver first appeared in
88.Fx 4.0
89as a cleaner replacement
90for the MFS functionality previously used in
91.Tn PicoBSD
92and in the
93.Fx
94installation process.
95.Pp
96The
97.Nm
98driver did a hostile takeover of the
99.Xr vn 4
100driver in
101.Fx 5.0 .
102.Sh AUTHORS
103The
104.Nm
105driver was written by
106.An Poul-Henning Kamp
107.Aq phk@FreeBSD.org .
108