MD(4) BSD Kernel Interfaces Manual MD(4)NAME
md -- memory disk
SYNOPSIS
device md
DESCRIPTION
The md driver provides support for four kinds of memory backed virtual disks:
malloc Backing store is allocated using malloc(9). Only one malloc-bucket is used, which means that all md devices with malloc 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 vmstat(8).
preload A file loaded by loader(8) with type 'md_image' is used for backing store. For backwards compatibility the type 'mfs_root' is also
recognized. If the kernel is created with option MD_ROOT the first preloaded image found will become the root file system.
vnode A regular file is used as backing store. This allows for mounting ISO images without the tedious detour over actual physical media.
swap 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 swap backing is generally preferable over malloc backing.
For more information, please see mdconfig(8).
EXAMPLES
To create a kernel with a ramdisk or MD file system, your kernel config needs the following options:
options MD_ROOT # MD is a potential root device
options MD_ROOT_SIZE=8192 # 8MB ram disk
makeoptions MFS_IMAGE=/h/foo/ARM-MD
options ROOTDEVNAME="ufs:md0"
The image in /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 disk found in the mdconfig(8) man page. Other tools will also create these images, such as NanoBSD.
SEE ALSO disklabel(5), disklabel(8), fdisk(8), loader(8), mdconfig(8), mdmfs(8), newfs(8), vmstat(8)HISTORY
The md driver first appeared in FreeBSD 4.0 as a cleaner replacement for the MFS functionality previously used in PicoBSD and in the FreeBSD
installation process.
The md driver did a hostile takeover of the vn(4) driver in FreeBSD 5.0.
AUTHORS
The md driver was written by Poul-Henning Kamp <phk@FreeBSD.org>.
BSD October 30, 2007 BSD
Check Out this Related Man Page
MOUNT.CONF(8) BSD System Manager's Manual MOUNT.CONF(8)NAME
mount.conf -- root file system mount configuration file
SYNOPSIS
/.mount.conf
DESCRIPTION
During the bootup process, the FreeBSD kernel will try to mount the root file system using the logic in the vfs_mountroot() function in
src/sys/kern/vfs_mountroot.c. The root mount logic can be described as follows:
1. The kernel will synthesize in memory a config file with default directives for mounting the root file system. The logic for this is in
vfs_mountroot_conf0().
2. The kernel will first mount devfs(8) as the root file system.
3. Next, the kernel will parse the in-memory config file created in step 1 and try to mount the actual root file system. See FILE FORMAT
for the format of the config file.
4. When the actual root file system is mounted, devfs will be re-mounted on the /dev directory.
5. If a /.mount.conf file does not exist in the root file system which was just mounted, the root mount logic stops here.
6. If a /.mount.conf file exists in the root file system which was just mounted, this file will be parsed, and the kernel will use this new
config file to try to re-mount the root file system. See FILE FORMAT for the format of the config file.
7. If the new root file system has a /.mount directory, the old root file system will be re-mounted on /.mount.
8. The root mount logic will go back to step 4.
The root mount logic is recursive, and step 8 will be repeated as long as each new root file system which is mounted has a /.mount.conf file.
FILE FORMAT
The kernel parses each line in .mount.conf and then tries to perform the action specified on that line as soon as it is parsed.
# A line beginning with a # is a comment and is ignored.
{FS}:{MOUNTPOINT} {OPTIONS}
The kernel will try to mount this in an operation equivalent to:
mount -t {FS} -o {OPTIONS} {MOUNTPOINT} /
If this is successfully mounted, further lines in .mount.conf are ignored. If all lines in .mount.conf have been processed and
no root file system has been successfully mounted, then the action specified by .onfail is performed.
.ask When the kernel processes this line, a mountroot> command-line prompt is displayed. At this prompt, the operator can enter the
the root mount.
.md file Create a memory backed md(4) virtual disk, using file as the backing store.
.onfail [panic|reboot|retry|continue]
If after parsing all the lines in .mount.conf the kernel is unable to mount a root file system, the .onfail directive tells the
kernel what action to perform.
.timeout N Before trying to mount a root file system, if the root mount device does not exist, wait at most N seconds for the device to
appear before trying to mount it. If .timeout is not specified, the default timeout is 3 seconds.
EXAMPLES
The following example .mount.conf will direct the kernel to try mounting the root file system first as an ISO CD9660 file system on /dev/cd0,
then if that does not work, as an ISO CD9660 file system on /dev/acd0, and then if that does not work, as a UFS file system on /dev/ada0s1a.
If that does not work, a mountroot> command-line prompt will be displayed where the operator can manually enter the root file system to
mount. Finally if that does not work, the kernel will panic.
.onfail panic
.timeout 3
cd9660:/dev/cd0 ro
.timeout 0
cd9660:/dev/acd0 ro
.timeout 3
ufs:/dev/ada0s1a
.ask
The following example .mount.conf will direct the kernel to create a md(4) memory disk attached to the file /data/OS-1.0.iso and then mount
the ISO CD9660 file system on the md device which was just created. The last line is a comment which is ignored.
.timeout 3
.md /data/OS-1.0.iso
cd9600:/dev/md# ro
# Can also use cd9660:/dev/md0 ro
The following example .mount.conf will direct the kernel to create a md(4) memory disk attached to the file /data/base.ufs.uzip and then
mount the UFS file system on the md uzip device which was just created by the geom_uzip(4) driver.
.md /data/base.ufs.uzip
ufs:/dev/md#.uzip ro
# Can also use ufs:/dev/md0.uzip ro
The following example .mount.conf will direct the kernel to do a unionfs mount on a directory /jail/freebsd-8-stable which has a chroot(2)
environment.
.timeout 3
unionfs:/jail/freebsd-8-stable
NOTES
For each root file system which is mounted, a /dev directory must exist so that the root mount logic can properly re-mount devfs(8). If this
directory does not exist, the system may hang during the bootup process.
SEE ALSO nmount(2), md(4), boot.config(5), fstab(5), boot(8), loader(8), mount(8)HISTORY
The mount.conf file first appeared in FreeBSD 9.0.
AUTHORS
The root mount logic in the FreeBSD kernel which parses /.mount.conf was written by Marcel Moolenaar <marcel@FreeBSD.org>. This man page was
written by Craig Rodrigues <rodrigc@FreeBSD.org>.
BSD July 7, 2013 BSD