Finish the section about mdconfig(8); and mdmfs(8);. I also
updated a bit the part about FreeBSD 4.X
This commit is contained in:
parent
e8c9249f77
commit
1aa1e1f53a
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=15218
1 changed files with 131 additions and 18 deletions
|
@ -2069,6 +2069,15 @@ echo "The floppy has been unmounted and is now ready."]]></programlisting>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
<sect1 id="disks-virtual">
|
<sect1 id="disks-virtual">
|
||||||
|
<sect1info>
|
||||||
|
<authorgroup>
|
||||||
|
<author>
|
||||||
|
<firstname>Marc</firstname>
|
||||||
|
<surname>Fonvieille</surname>
|
||||||
|
<contrib>Reorganized and enhanced by </contrib>
|
||||||
|
</author>
|
||||||
|
</authorgroup>
|
||||||
|
</sect1info>
|
||||||
<title>Network, Memory, and File-Based File Systems</title>
|
<title>Network, Memory, and File-Based File Systems</title>
|
||||||
<indexterm><primary>virtual disks</primary></indexterm>
|
<indexterm><primary>virtual disks</primary></indexterm>
|
||||||
<indexterm>
|
<indexterm>
|
||||||
|
@ -2096,14 +2105,21 @@ echo "The floppy has been unmounted and is now ready."]]></programlisting>
|
||||||
different tools for creation and use of file-backed and
|
different tools for creation and use of file-backed and
|
||||||
memory-based file systems.</para>
|
memory-based file systems.</para>
|
||||||
|
|
||||||
|
<note>
|
||||||
|
<para>The FreeBSD 4.X users will have to use &man.MAKEDEV.8;
|
||||||
|
to create the required devices. FreeBSD 5.0 and later use
|
||||||
|
&man.devfs.5; to allocate device nodes transparently for the
|
||||||
|
user.</para>
|
||||||
|
</note>
|
||||||
|
|
||||||
<sect2 id="disks-vnconfig">
|
<sect2 id="disks-vnconfig">
|
||||||
<title>File-Backed File System under FreeBSD 4.X</title>
|
<title>File-Backed File System under FreeBSD 4.X</title>
|
||||||
<indexterm>
|
<indexterm>
|
||||||
<primary>disks</primary>
|
<primary>disks</primary>
|
||||||
<secondary>file-backed</secondary>
|
<secondary>file-backed under FreeBSD 4.X</secondary>
|
||||||
</indexterm>
|
</indexterm>
|
||||||
|
|
||||||
<para>&man.vnconfig.8; configures and enables vnode pseudo-disk
|
<para>The utility &man.vnconfig.8; configures and enables vnode pseudo-disk
|
||||||
devices. A <firstterm>vnode</firstterm> is a representation
|
devices. A <firstterm>vnode</firstterm> is a representation
|
||||||
of a file, and is the focus of file activity. This means that
|
of a file, and is the focus of file activity. This means that
|
||||||
&man.vnconfig.8; uses files to create and operate a
|
&man.vnconfig.8; uses files to create and operate a
|
||||||
|
@ -2125,10 +2141,10 @@ echo "The floppy has been unmounted and is now ready."]]></programlisting>
|
||||||
&prompt.root; <userinput>mount /dev/vn<replaceable>0</replaceable>c <replaceable>/mnt</replaceable></userinput></screen>
|
&prompt.root; <userinput>mount /dev/vn<replaceable>0</replaceable>c <replaceable>/mnt</replaceable></userinput></screen>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<para>To create a new file system image with vnconfig:</para>
|
<para>To create a new file system image with &man.vnconfig.8;:</para>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>Creating a New File-Backed Disk with vnconfig</title>
|
<title>Creating a New File-Backed Disk with <command>vnconfig</command></title>
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>dd if=/dev/zero of=<replaceable>newimage</replaceable> bs=1k count=<replaceable>5</replaceable>k</userinput>
|
<screen>&prompt.root; <userinput>dd if=/dev/zero of=<replaceable>newimage</replaceable> bs=1k count=<replaceable>5</replaceable>k</userinput>
|
||||||
5120+0 records in
|
5120+0 records in
|
||||||
|
@ -2152,10 +2168,10 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
|
||||||
<title>File-Backed File System under FreeBSD 5.X</title>
|
<title>File-Backed File System under FreeBSD 5.X</title>
|
||||||
<indexterm>
|
<indexterm>
|
||||||
<primary>disks</primary>
|
<primary>disks</primary>
|
||||||
<secondary>file-backed</secondary>
|
<secondary>file-backed under FreeBSD 5.X</secondary>
|
||||||
</indexterm>
|
</indexterm>
|
||||||
|
|
||||||
<para>&man.mdconfig.8; is the utility used to configure and enable
|
<para>The utility &man.mdconfig.8; is used to configure and enable
|
||||||
memory disks, &man.md.4;, under FreeBSD 5.X. To use
|
memory disks, &man.md.4;, under FreeBSD 5.X. To use
|
||||||
&man.mdconfig.8;, you have to load &man.md.4; module or to add
|
&man.mdconfig.8;, you have to load &man.md.4; module or to add
|
||||||
the support in your kernel configuration file:</para>
|
the support in your kernel configuration file:</para>
|
||||||
|
@ -2171,17 +2187,17 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
|
||||||
<para>To mount an existing file system image:</para>
|
<para>To mount an existing file system image:</para>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>Using mdconfig to mount an Existing File System
|
<title>Using <command>mdconfig</command> to mount an Existing File System
|
||||||
Image under FreeBSD 5.X</title>
|
Image under FreeBSD 5.X</title>
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>mdconfig -a -t vnode -f <replaceable>diskimage</replaceable> -u <replaceable>0</replaceable></userinput>
|
<screen>&prompt.root; <userinput>mdconfig -a -t vnode -f <replaceable>diskimage</replaceable> -u <replaceable>0</replaceable></userinput>
|
||||||
&prompt.root; <userinput>mount /dev/md<replaceable>0</replaceable>c <replaceable>/mnt</replaceable></userinput></screen>
|
&prompt.root; <userinput>mount /dev/md<replaceable>0</replaceable>c <replaceable>/mnt</replaceable></userinput></screen>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<para>To create a new file system image with mdconfig:</para>
|
<para>To create a new file system image with &man.mdconfig.8;:</para>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>Creating a New File-Backed Disk with mdconfig</title>
|
<title>Creating a New File-Backed Disk with <command>mdconfig</command></title>
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>dd if=/dev/zero of=<replaceable>newimage</replaceable> bs=1k count=<replaceable>5</replaceable>k</userinput>
|
<screen>&prompt.root; <userinput>dd if=/dev/zero of=<replaceable>newimage</replaceable> bs=1k count=<replaceable>5</replaceable>k</userinput>
|
||||||
5120+0 records in
|
5120+0 records in
|
||||||
|
@ -2199,6 +2215,13 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
|
||||||
/dev/md0c 4846 2 4458 0% /mnt</screen>
|
/dev/md0c 4846 2 4458 0% /mnt</screen>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
|
<para>If you do not specify the unit number with the
|
||||||
|
<option>-u</option> option, &man.mdconfig.8; will use the
|
||||||
|
&man.md.4; automatic allocation to select an unused device.
|
||||||
|
The name of the allocated unit will be output on stdout like
|
||||||
|
<devicename>md4</devicename>. For more details about
|
||||||
|
&man.mdconfig.8;, please refer to the manual page.</para>
|
||||||
|
|
||||||
<para>The utility &man.mdconfig.8; is very useful, however it
|
<para>The utility &man.mdconfig.8; is very useful, however it
|
||||||
asks many command lines to create a file-backed file system.
|
asks many command lines to create a file-backed file system.
|
||||||
FreeBSD 5.0 also comes with a tool called &man.mdmfs.8;,
|
FreeBSD 5.0 also comes with a tool called &man.mdmfs.8;,
|
||||||
|
@ -2208,28 +2231,38 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
|
||||||
if you want to create and mount the same file system image as
|
if you want to create and mount the same file system image as
|
||||||
above, simply type the following:</para>
|
above, simply type the following:</para>
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>mdmfs -F <replaceable>newimage</replaceable> -s <replaceable>5</replaceable>m md<replaceable>0</replaceable> <replaceable>/mnt</replaceable></userinput></screen>
|
<screen>&prompt.root; <userinput>dd if=/dev/zero of=<replaceable>newimage</replaceable> bs=1k count=<replaceable>5</replaceable>k</userinput>
|
||||||
|
5120+0 records in
|
||||||
|
5120+0 records in
|
||||||
|
5120+0 records out
|
||||||
|
&prompt.root; <userinput>mdmfs -F <replaceable>newimage</replaceable> -s <replaceable>5</replaceable>m md<replaceable>0</replaceable> <replaceable>/mnt</replaceable></userinput>
|
||||||
|
&prompt.root; <userinput>df <replaceable>/mnt</replaceable></userinput>
|
||||||
|
Filesystem 1K-blocks Used Avail Capacity Mounted on
|
||||||
|
/dev/md0 4846 2 4458 0% /mnt</screen>
|
||||||
|
|
||||||
<para>For more details about &man.mdmfs.8;, please refer to
|
<para>If you use the option <option>md</option> without unit
|
||||||
the manual page.</para>
|
number, &man.mdmfs.8; will use &man.md.4; auto-unit feature to
|
||||||
|
automatically select an unused device. For more details
|
||||||
|
about &man.mdmfs.8;, please refer to the manual page.</para>
|
||||||
|
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
<sect2 id="disks-md">
|
<sect2 id="disks-md-freebsd4">
|
||||||
<title>md: Memory File System</title>
|
<title>Memory-Based File System under FreeBSD 4.X</title>
|
||||||
<indexterm>
|
<indexterm>
|
||||||
<primary>disks</primary>
|
<primary>disks</primary>
|
||||||
<secondary>memory file system</secondary>
|
<secondary>memory file system under FreeBSD 4.X</secondary>
|
||||||
</indexterm>
|
</indexterm>
|
||||||
|
|
||||||
<para><devicename>md</devicename> is a simple, efficient means to create memory
|
<para>The &man.md.4; driver is a simple, efficient means to create memory
|
||||||
file systems.</para>
|
file systems under FreeBSD 4.X. &man.malloc.9; is used
|
||||||
|
to allocate the memory.</para>
|
||||||
|
|
||||||
<para>Simply take a file system you have prepared with, for
|
<para>Simply take a file system you have prepared with, for
|
||||||
example, &man.vnconfig.8;, and:</para>
|
example, &man.vnconfig.8;, and:</para>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>md Memory Disk</title>
|
<title>md Memory Disk under FreeBSD 4.X</title>
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>dd if=<replaceable>newimage</replaceable> of=/dev/md<replaceable>0</replaceable></userinput>
|
<screen>&prompt.root; <userinput>dd if=<replaceable>newimage</replaceable> of=/dev/md<replaceable>0</replaceable></userinput>
|
||||||
5120+0 records in
|
5120+0 records in
|
||||||
|
@ -2239,6 +2272,86 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
|
||||||
Filesystem 1K-blocks Used Avail Capacity Mounted on
|
Filesystem 1K-blocks Used Avail Capacity Mounted on
|
||||||
/dev/md0c 4927 1 4532 0% /mnt</screen>
|
/dev/md0c 4927 1 4532 0% /mnt</screen>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
|
<para>For more details, please refer to &man.md.4; manual
|
||||||
|
page.</para>
|
||||||
|
|
||||||
|
<sect2 id="disks-md-freebsd5">
|
||||||
|
<title>Memory-Based File System under FreeBSD 5.X</title>
|
||||||
|
<indexterm>
|
||||||
|
<primary>disks</primary>
|
||||||
|
<secondary>memory file system under FreeBSD 5.X</secondary>
|
||||||
|
</indexterm>
|
||||||
|
|
||||||
|
<para>The same tools are used for memory-based and file-backed
|
||||||
|
file systems: &man.mdconfig.8; or &man.mdmfs.8;. The storage
|
||||||
|
for memory-based file system is allocated with
|
||||||
|
&man.malloc.9;.</para>
|
||||||
|
|
||||||
|
<example>
|
||||||
|
<title>Creating a New Memory-Based Disk with
|
||||||
|
<command>mdconfig</command></title>
|
||||||
|
|
||||||
|
<screen>&prompt.root; <userinput>mdconfig -a -t malloc -s <replaceable>5</replaceable>m -u <replaceable>1</replaceable></userinput>
|
||||||
|
&prompt.root; <userinput>newfs -U md<replaceable>1</replaceable></userinput>
|
||||||
|
/dev/md1: 5.0MB (10240 sectors) block size 16384, fragment size 2048
|
||||||
|
using 4 cylinder groups of 1.27MB, 81 blks, 256 inodes.
|
||||||
|
with soft updates
|
||||||
|
super-block backups (for fsck -b #) at:
|
||||||
|
32, 2624, 5216, 7808
|
||||||
|
&prompt.root; <userinput>mount /dev/md<replaceable>1</replaceable> <replaceable>/mnt</replaceable></userinput>
|
||||||
|
&prompt.root; <userinput>df <replaceable>/mnt</replaceable></userinput>
|
||||||
|
Filesystem 1K-blocks Used Avail Capacity Mounted on
|
||||||
|
/dev/md1 4846 2 4458 0% /mnt</screen>
|
||||||
|
</example>
|
||||||
|
|
||||||
|
<example>
|
||||||
|
<title>Creating a New Memory-Based Disk with
|
||||||
|
<command>mdmfs</command></title>
|
||||||
|
<screen>&prompt.root; <userinput>mdmfs -M -s <replaceable>5</replaceable>m md<replaceable>2</replaceable> <replaceable>/mnt</replaceable></userinput>
|
||||||
|
&prompt.root; <userinput>df <replaceable>/mnt</replaceable></userinput>
|
||||||
|
Filesystem 1K-blocks Used Avail Capacity Mounted on
|
||||||
|
/dev/md2 4846 2 4458 0% /mnt</screen>
|
||||||
|
</example>
|
||||||
|
|
||||||
|
<para>Instead of using a &man.malloc.9; backed file system, it is
|
||||||
|
possible to use swap, for that just replace
|
||||||
|
<option>malloc</option> with <option>swap</option> in the
|
||||||
|
command line of &man.mdconfig.8;. The &man.mdmfs.8; utility
|
||||||
|
by default (without <option>-M</option>) creates a swap-based
|
||||||
|
disk. For more details, please refer to &man.mdconfig.8;
|
||||||
|
and &man.mdmfs.8; manual pages.</para>
|
||||||
|
</sect2>
|
||||||
|
|
||||||
|
<sect2>
|
||||||
|
<title>Detaching a Memory Disk from the System</title>
|
||||||
|
<indexterm>
|
||||||
|
<primary>disks</primary>
|
||||||
|
<secondary>detaching a memory disk</secondary>
|
||||||
|
</indexterm>
|
||||||
|
|
||||||
|
<para>When a memory-based or file-based file system
|
||||||
|
is not used, you should release all resources to the system.
|
||||||
|
The first thing to do is to unmount the file system, then use
|
||||||
|
&man.mdconfig.8; to detach the disk from the system and release
|
||||||
|
the resources.</para>
|
||||||
|
|
||||||
|
<para>For example to detach and free all resources used by
|
||||||
|
<filename>/dev/md4</filename>:</para>
|
||||||
|
|
||||||
|
<screen>&prompt.root; <userinput>mdconfig -d -u <replaceable>4</replaceable></userinput></screen>
|
||||||
|
|
||||||
|
<para>It is possible to list information about configured
|
||||||
|
&man.md.4; devices in using the command <command>mdconfig
|
||||||
|
-l</command>.</para>
|
||||||
|
|
||||||
|
<para>For FreeBSD 4.X, &man.vnconfig.8; is used to detach
|
||||||
|
the device. For example to detach and free all resources
|
||||||
|
used by <filename>/dev/vn4</filename>:</para>
|
||||||
|
|
||||||
|
<screen>&prompt.root; <userinput>vnconfig -u vn<replaceable>4</replaceable></userinput></screen>
|
||||||
|
|
||||||
|
|
||||||
</sect2>
|
</sect2>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue