aboutsummaryrefslogtreecommitdiff
path: root/zh_CN.GB2312/books/handbook/disks/chapter.sgml
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2006-03-26 01:32:50 +0000
committerXin LI <delphij@FreeBSD.org>2006-03-26 01:32:50 +0000
commit9fd98e24c2c06049cbb5120c04f42d8893250346 (patch)
tree2ee4427a723443637f2948ed3a24bff0e7490656 /zh_CN.GB2312/books/handbook/disks/chapter.sgml
parent41af9aaafedf4d897ba74539cf924fa58cd4c9a7 (diff)
Notes
Diffstat (limited to 'zh_CN.GB2312/books/handbook/disks/chapter.sgml')
-rw-r--r--zh_CN.GB2312/books/handbook/disks/chapter.sgml121
1 files changed, 55 insertions, 66 deletions
diff --git a/zh_CN.GB2312/books/handbook/disks/chapter.sgml b/zh_CN.GB2312/books/handbook/disks/chapter.sgml
index 9602d96e03..5a5fcfe458 100644
--- a/zh_CN.GB2312/books/handbook/disks/chapter.sgml
+++ b/zh_CN.GB2312/books/handbook/disks/chapter.sgml
@@ -2,7 +2,7 @@
The FreeBSD Documentation Project
The FreeBSD Simplified Chinese Project
- Original Revision: 1.251
+ Original Revision: 1.254
$FreeBSD$
-->
@@ -2401,7 +2401,7 @@ mkdir /mnt/var
#
if [ ! -x /sys/compile/MINI/kernel ]
then
- cat &lt;&lt; EOM
+ cat << EOM
The MINI kernel does not exist, please create one.
Here is an example config file:
#
@@ -2449,14 +2449,14 @@ fi
cp -f /sys/compile/MINI/kernel /mnt
-gzip -c -best /sbin/init &gt; /mnt/sbin/init
-gzip -c -best /sbin/fsck &gt; /mnt/sbin/fsck
-gzip -c -best /sbin/mount &gt; /mnt/sbin/mount
-gzip -c -best /sbin/halt &gt; /mnt/sbin/halt
-gzip -c -best /sbin/restore &gt; /mnt/sbin/restore
+gzip -c -best /sbin/init > /mnt/sbin/init
+gzip -c -best /sbin/fsck > /mnt/sbin/fsck
+gzip -c -best /sbin/mount > /mnt/sbin/mount
+gzip -c -best /sbin/halt > /mnt/sbin/halt
+gzip -c -best /sbin/restore > /mnt/sbin/restore
-gzip -c -best /bin/sh &gt; /mnt/bin/sh
-gzip -c -best /bin/sync &gt; /mnt/bin/sync
+gzip -c -best /bin/sh > /mnt/bin/sh
+gzip -c -best /bin/sync > /mnt/bin/sync
cp /root/.profile /mnt/root
@@ -2483,18 +2483,18 @@ cd /
#
# create minimum file system table
#
-cat &gt; /mnt/etc/fstab &lt;&lt;EOM
+cat > /mnt/etc/fstab <<EOM
/dev/fd0a / ufs rw 1 1
EOM
#
# create minimum passwd file
#
-cat &gt; /mnt/etc/passwd &lt;&lt;EOM
+cat > /mnt/etc/passwd <<EOM
root:*:0:0:Charlie &:/root:/bin/sh
EOM
-cat &gt; /mnt/etc/master.passwd &lt;&lt;EOM
+cat > /mnt/etc/master.passwd <<EOM
root::0:0::0:0:Charlie &:/root:/bin/sh
EOM
@@ -2664,15 +2664,15 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
</sect2>
<sect2 id="disks-mdconfig">
- <title>FreeBSD 5.X 下的 File-Backed 文件系统</title>
+ <title>采用文件后端的文件系统</title>
<indexterm>
- <primary>磁盘</primary>
- <secondary>file-backed (5.X)</secondary>
+ <primary>disks (磁盘)</primary>
+ <secondary>file-backed (采用文件作为后端)</secondary>
</indexterm>
- <para>在 FreeBSD&nbsp;5.X 系统中使用应用程序 &man.mdconfig.8;
-  被用来配置和启用内存磁盘,&man.md.4;,使用
- &man.mdconfig.8;你需要在你的内核配置文件中添加 &man.md.4; 模块来支持它:</para>
+ <para>在 FreeBSD&nbsp;5.X 和更新版本的系统中, 可以用 &man.mdconfig.8;
+ 程序来配置和启用内存磁盘, &man.md.4;。 要使用
+ &man.mdconfig.8;, 就需要在内核配置文件中添加 &man.md.4; 模块来支持它:</para>
<programlisting>device md</programlisting>
@@ -2684,7 +2684,7 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
<para>挂接一个存在的文件系统映像:</para>
<example>
- <title>在 FreeBSD&nbsp;5.X 中使用 <command>mdconfig</command> 命令来挂接一个存在的文件系统映像。</title>
+ <title>使用 <command>mdconfig</command> 挂载已经存在的文件系统映像</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>
@@ -2699,16 +2699,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>如果你没有使用 <option>-u</option> 选项指定一个单位号
@@ -2718,21 +2718,13 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
<devicename>md4</devicename>。想得到更多的关于
&man.mdconfig.8; 的信息请参考手册页。</para>
- <note><para>从 &os;&nbsp;5.1-RELEASE 开始, &man.bsdlabel.8;
- 程序代替了旧版的 &man.disklabel.8; 程序。相应的
- &man.bsdlabel.8; 中的许多陈旧的选项和参数也被取消;
- 在上面的例子中选项
- <option>-r</option> 应该被删掉。想获得更多的信息,
- 请参考 &man.bsdlabel.8; 的手册页。</para></note>
-
- <para>应用程序 &man.mdconfig.8; 是非常有作的,然而它
- 需要许多命令行来创建一个 file-backed 文件系统。
- FreeBSD&nbsp;5.0 也提供了一个被称作 &man.mdmfs.8; 的工具,
- 这个程序配置一个 &man.md.4; 磁盘使用
- &man.mdconfig.8;,在它上面安装一个 UFS 文件系统使用
- &man.newfs.8;,挂接它使用 &man.mount.8;。例如,
- 如果你想创建和挂接像上面一样的文件系统映像,
- 简单的执行下面的步骤:</para>
+ <para>应用程序 &man.mdconfig.8; 功能很强大,
+ 但在创建采用文件后端的文件系统时需要使用许多多行命令。 为此
+ FreeBSD&nbsp;5.0 也提供了一个名为 &man.mdmfs.8; 的工具, 该程序使用
+ &man.mdconfig.8; 来配置 &man.md.4; 盘, 并在其上用
+ &man.newfs.8; 创建 UFS 文件系统, 然后用 &man.mount.8; 挂接它。 例如,
+ 如果想创建和挂接像上面那样的文件系统映像,
+ 只需简单地执行下面的步骤:</para>
<example>
<title>使用 <command>mdmfs</command> 命令配置和挂接一个 File-Backed 磁盘</title>
@@ -2742,7 +2734,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>如果你使用没有加单位号的 <option>md</option> 选项,
@@ -2782,49 +2774,46 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
</sect2>
<sect2 id="disks-md-freebsd5">
- <title>FreeBSD 5.X 下的内存后备式文件系统</title>
+ <title>以内存为后端的文件系统</title>
<indexterm>
- <primary>磁盘</primary>
- <secondary>内存文件系统(5.X)</secondary>
+ <primary>disks (磁盘)</primary>
+ <secondary>内存文件系统</secondary>
</indexterm>
- <para>同样的工具也可以用来创建内存后备式文件系统:
- &man.mdconfig.8; 或 &man.mdmfs.8;。内存后备文件系统的
- 内存分配要使用 &man.malloc.9; 来完成。</para>
+ <para>同样的工具既可以用来创建以文件为后端的文件系统,
+ 也可以用来创建基于内存的文件系统: &man.mdconfig.8; 和 &man.mdmfs.8;。
+ 一般来说在建立以内存为后端的文件系统时, 应使用 <quote>交换区作为后端
+ (swap backing)</quote>。 使用交换区作为后端,
+ 并不意味着内存盘将被无条件地换出到交换区,
+ 它只是表示将根据需要从可换出的内存池中分配内存。
+ 此外, 也可以使用
+ &man.malloc.9; 作为后端的内存盘, 但这种内存盘在内核内存不足时,
+ 有可能会导致系统崩溃。</para>
<example>
<title>用 <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>用 <command>mdmfs</command>
- 创建一个新的内存后备磁盘</title>
- <screen>&prompt.root; <userinput>mdmfs -M -s <replaceable>5</replaceable>m md<replaceable>2</replaceable> <replaceable>/mnt</replaceable></userinput>
+ <title>使用 <command>mdmfs</command> 来新建内存盘</title>
+ <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>代替使用一个 &man.malloc.9; 后备文件系统,可以使用
- swap,正确的替换使用 <option>swap</option> 替换
- <option>malloc</option> 在命令行
- &man.mdconfig.8; 中。&man.mdmfs.8; 程序默认
- (没有 <option>-M</option> 选项) 创建一个 swap-based
- 磁盘。更多的详情,请参考 &man.mdconfig.8;
- 和 &man.mdmfs.8; 手册页。</para>
</sect2>
<sect2>
@@ -3719,7 +3708,7 @@ geli_da2_flags="-p -k /root/da2.key"</screen>
</screen>
<para>对于 &os; 6.0-RELEASE 之前的版本,
- 还需要在 <filename>/etc/rc.conf</filename> 中加入:
+ 还需要在 <filename>/etc/rc.conf</filename> 中加入:</para>
<programlisting>gbde_swap_enable="YES"</programlisting>
</sect2>