Some rework of the memory, and file-backed file systems section:

- Remove 5.X from titles, since it applies to 5.X+.
- Refer only to bsdlabel in the 5.X+ section and remove note about the
  switch from disklabel to bsdlabel in FreeBSD 5.1.
- Do not suggest users place file systems on the "c" partition (which
  is meant for the "raw" device) and use the "a" partition instead.
  (Note that I'm not really sure if there is a good reason to label a
  memory disk before use when just using the entire disk for one file
  system, but I will leave this for now.)
- Update program output to show what resent FreeBSD version actually
  writes.
- For memory backed file system section, suggest that people use swap
  backed and not malloc(9) backed, since malloc based memory disks
  have a good disk of causing a panic since the kernel risks runing
  out of memory in the malloc pool.
This commit is contained in:
Simon L. B. Nielsen 2006-03-23 22:13:54 +00:00
parent 173b91940e
commit 605abcfbe4
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=27400

View file

@ -3009,14 +3009,14 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
</sect2>
<sect2 id="disks-mdconfig">
<title>File-Backed File System under FreeBSD&nbsp;5.X</title>
<title>File-Backed File System</title>
<indexterm>
<primary>disks</primary>
<secondary>file-backed (5.X)</secondary>
<secondary>file-backed</secondary>
</indexterm>
<para>The utility &man.mdconfig.8; is used to configure and enable
memory disks, &man.md.4;, under FreeBSD&nbsp;5.X. To use
memory disks, &man.md.4;, under FreeBSD&nbsp;5.X and later. To use
&man.mdconfig.8;, you have to load &man.md.4; module or to add
the support in your kernel configuration file:</para>
@ -3032,7 +3032,7 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
<example>
<title>Using <command>mdconfig</command> to Mount an Existing File System
Image under FreeBSD&nbsp;5.X</title>
Image</title>
<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> <replaceable>/mnt</replaceable></userinput></screen>
@ -3047,16 +3047,16 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
5120+0 records in
5120+0 records out
&prompt.root; <userinput>mdconfig -a -t vnode -f <replaceable>newimage</replaceable> -u <replaceable>0</replaceable></userinput>
&prompt.root; <userinput>disklabel -r -w md<replaceable>0</replaceable> auto</userinput>
&prompt.root; <userinput>newfs md<replaceable>0</replaceable>c</userinput>
/dev/md0c: 5.0MB (10240 sectors) block size 16384, fragment size 2048
using 4 cylinder groups of 1.27MB, 81 blks, 256 inodes.
&prompt.root; <userinput>bsdlabel -w md<replaceable>0</replaceable> auto</userinput>
&prompt.root; <userinput>newfs md<replaceable>0</replaceable>a</userinput>
/dev/md0a: 5.0MB (10224 sectors) block size 16384, fragment size 2048
using 4 cylinder groups of 1.25MB, 80 blks, 192 inodes.
super-block backups (for fsck -b #) at:
32, 2624, 5216, 7808
&prompt.root; <userinput>mount /dev/md<replaceable>0</replaceable>c <replaceable>/mnt</replaceable></userinput>
160, 2720, 5280, 7840
&prompt.root; <userinput>mount /dev/md<replaceable>0</replaceable>a <replaceable>/mnt</replaceable></userinput>
&prompt.root; <userinput>df <replaceable>/mnt</replaceable></userinput>
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/md0c 4846 2 4458 0% /mnt</screen>
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/md0a 4710 4 4330 0% /mnt</screen>
</example>
<para>If you do not specify the unit number with the
@ -3066,14 +3066,6 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
<devicename>md4</devicename>. For more details about
&man.mdconfig.8;, please refer to the manual page.</para>
<note><para>Since &os;&nbsp;5.1-RELEASE, the &man.bsdlabel.8;
utility replaces the old &man.disklabel.8; program. With
&man.bsdlabel.8; a number of obsolete options and parameters
have been retired; in the example above the option
<option>-r</option> should be removed. For more
information, please refer to the &man.bsdlabel.8;
manual page.</para></note>
<para>The utility &man.mdconfig.8; is very useful, however it
asks many command lines to create a file-backed file system.
FreeBSD&nbsp;5.0 also comes with a tool called &man.mdmfs.8;,
@ -3091,7 +3083,7 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
&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>
/dev/md0 4718 4 4338 0% /mnt</screen>
</example>
<para>If you use the option <option>md</option> without unit
@ -3132,50 +3124,49 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
</sect2>
<sect2 id="disks-md-freebsd5">
<title>Memory-Based File System under FreeBSD&nbsp;5.X</title>
<title>Memory-Based File System</title>
<indexterm>
<primary>disks</primary>
<secondary>memory file system (5.X)</secondary>
<secondary>memory file system</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>
file systems: &man.mdconfig.8; or &man.mdmfs.8;. For a
memory-based file system the <quote>swap backing</quote>
should normally be used. Using swap backing does not mean
that the memory disk will be swapped out to disk by default,
but merely that the memory disk will be allocated from a
memory pool which can be swapped out to disk if needed. It is
also possible to create memory-based disk which are
&man.malloc.9; backed, but using malloc backed memory disks,
especially large ones, can result in a system panic if the
kernel runs out of memory.</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>
<screen>&prompt.root; <userinput>mdconfig -a -t swap -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
using 4 cylinder groups of 1.27MB, 81 blks, 192 inodes.
with soft updates
super-block backups (for fsck -b #) at:
32, 2624, 5216, 7808
160, 2752, 5344, 7936
&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>
/dev/md1 4718 4 4338 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>
<screen>&prompt.root; <userinput>mdmfs -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>