DragonFly On-Line Manual Pages
MD(4) DragonFly Kernel Interfaces Manual MD(4)
md -- memory disk
To compile this driver into the kernel, place the following line in your
kernel configuration file:
Alternatively, to load the driver as a module at boot time, place the
following line in /boot/loader.conf:
To specify the default maximum size of kmalloc(9) backed disks:
The md driver provides support for two kinds of memory backed virtual
disks: kmalloc(9) backed and pre-loaded module backed.
The kmalloc(9) backed disks are severely limited in size by constraints
imposed by kmalloc(9). Specifically, only one malloc bucket is used,
which means that all md devices with kmalloc(9) backing must share the
malloc per-bucket quota. The exact size of this quota varies, in partic-
ular with the amount of RAM in the system. The exact value can be deter-
mined with vmstat(8).
A sector filled with identical bytes does not consume storage, and there-
fore the storage allocated by a md disk can be freed with a command such
dd if=/dev/zero of=/dev/md567
The default maximum size of a md disk backed by kmalloc(9) is 20,000 sec-
tors of 512 bytes each. This can be changed with the kernel option
At boot time the md driver will search for pre-loaded modules of type
`md_image' and instantiate a md device for each of these modules. The
type `mfs_root' is also allowed for backward compatibility. These
devices are backed by the RAM reserved by the loader(8), and as such not
limited by the kmalloc(9) size constraints. However, this also means
that the storage cannot be released. For the same reason, the
``identical byte'' detection is not applicable.
The md driver uses the ``almost-clone'' convention, whereby opening
device number N creates device instance number N+1.
The vmstat(8) utility can be used to monitor memory usage by kmalloc(9)
backed md disks, but not those backed by pre-loaded modules.
To mount a kmalloc(9) backed md device on /tmp:
if [ -e /dev/md0 ]; then
newfs /dev/md0 && \
mount /dev/md0 /tmp && \
chmod 1777 /tmp
disklabel(5), disklabel(8), fdisk(8), loader(8), newfs(8), vmstat(8)
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
The md driver was written by Poul-Henning Kamp <phk@FreeBSD.org>.
DragonFly 4.9 September 28, 2009 DragonFly 4.9