MFen:
handbook: Makefile 1.109 -> 1.111 advanced-networking/chapter.sgml 1.413 -> 1.415 basics/chapter.sgml 1.153 -> 1.154 book.sgml 1.172 -> 1.173 chapters.ent 1.37 -> 1.38 config/chapter.sgml 1.233 -> 1.236 cutting-edge/chapter.sgml 1.228 -> 1.231 desktop/chapter.sgml 1.76 -> 1.78 disks/chapter.sgml 1.286 -> 1.288 dtrace/chapter.sgml 0 -> 1.5 eresources/chapter.sgml 1.186 -> 1.195 filesystems/chapter.sgml 0 -> 1.4 geom/chapter.sgml 1.42 -> 1.43 jails/chapter.sgml 1.16 -> 1.17 mirrors/chapter.sgml 1.449 -> 1.451 multimedia/chapter.sgml 1.129 -> 1.130 network-servers/chapter.sgml 1.108 -> 1.109 ports/chapter.sgml 1.282 -> 1.284 preface/preface.sgml 1.39 -> 1.41 security/chapter.sgml 1.330 -> 1.332 updating/chapter.sgml 0 -> 1.1 x11/chapter.sgml 1.187 -> 1.190 Obtained from: The FreeBSD Simplified Chinese Project Merging work done by: delphij, loader
This commit is contained in:
parent
0e266935e9
commit
879e329a87
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=33242
25 changed files with 2020 additions and 407 deletions
zh_CN.GB2312/books/handbook
Makefile
advanced-networking
basics
book.sgmlchapters.entconfig
cutting-edge
desktop
disks
dtrace
eresources
filesystems
geom
jails
mirrors
multimedia
network-servers
ports
preface
security
updating
x11
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# Build the FreeBSD Handbook (Simplified Chinese).
|
||||
#
|
||||
# Original revision: 1.109
|
||||
# Original revision: 1.111
|
||||
|
||||
# ------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -24,6 +24,13 @@
|
|||
# easily be imported into PGP/GPG.
|
||||
#
|
||||
# ------------------------------------------------------------------------
|
||||
#
|
||||
# To add a new chapter to the Handbook:
|
||||
#
|
||||
# - Update this Makefile, chapters.ent and book.sgml
|
||||
# - Add a descriptive entry for the new chapter in preface/preface.sgml
|
||||
#
|
||||
# ------------------------------------------------------------------------
|
||||
|
||||
.PATH: ${.CURDIR}/../../share/sgml/glossary
|
||||
|
||||
|
@ -199,6 +206,7 @@ IMAGES_LIB+= callouts/15.png
|
|||
SRCS+= audit/chapter.sgml
|
||||
SRCS+= book.sgml
|
||||
SRCS+= colophon.sgml
|
||||
SRCS+= dtrace/chapter.sgml
|
||||
SRCS+= freebsd-glossary.sgml
|
||||
SRCS+= advanced-networking/chapter.sgml
|
||||
SRCS+= basics/chapter.sgml
|
||||
|
@ -210,6 +218,7 @@ SRCS+= desktop/chapter.sgml
|
|||
SRCS+= disks/chapter.sgml
|
||||
SRCS+= eresources/chapter.sgml
|
||||
SRCS+= firewalls/chapter.sgml
|
||||
SRCS+= filesystems/chapter.sgml
|
||||
SRCS+= geom/chapter.sgml
|
||||
SRCS+= install/chapter.sgml
|
||||
SRCS+= introduction/chapter.sgml
|
||||
|
@ -229,6 +238,7 @@ SRCS+= preface/preface.sgml
|
|||
SRCS+= printing/chapter.sgml
|
||||
SRCS+= security/chapter.sgml
|
||||
SRCS+= serialcomms/chapter.sgml
|
||||
SRCS+= updating/chapter.sgml
|
||||
SRCS+= users/chapter.sgml
|
||||
SRCS+= vinum/chapter.sgml
|
||||
SRCS+= virtualization/chapter.sgml
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
The FreeBSD Documentation Project
|
||||
The FreeBSD Chinese Documentation Project
|
||||
|
||||
Original revision: 1.413
|
||||
Original revision: 1.415
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
|
@ -1072,6 +1072,7 @@ ath0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
|
|||
|
||||
<programlisting>ifconfig_ath0="ssid <replaceable>your_ssid_here</replaceable> inet <replaceable>192.168.1.100</replaceable> netmask <replaceable>255.255.255.0</replaceable>"</programlisting>
|
||||
</sect5>
|
||||
</sect4>
|
||||
|
||||
<sect4 id="network-wireless-wpa">
|
||||
<title>WPA</title>
|
||||
|
@ -2006,13 +2007,12 @@ ubt0: Interface 0 endpoints: interrupt=0x81, bulk-in=0x82, bulk-out=0x2
|
|||
ubt0: Interface 1 (alt.config 5) endpoints: isoc-in=0x83, isoc-out=0x3,
|
||||
wMaxPacketSize=49, nframes=6, buffer size=294</screen>
|
||||
|
||||
<para>复制 <filename>/usr/share/examples/netgraph/bluetooth/rc.bluetooth</filename>
|
||||
到一个合适的地方,如 <filename>/etc/rc.bluetooth</filename>。
|
||||
这个脚本用于启动和停止 Bluetooth stack (蓝牙栈)。
|
||||
最好在拔出设备前停止 stack(stack),当然也不是非做不可。
|
||||
启动 stack (栈) 时,会得到如下的输出:</para>
|
||||
<para>脚本 <filename>/etc/rc.d/bluetooth</filename>
|
||||
是用来启动和停止 Bluetooth stack (蓝牙栈)的。
|
||||
最好在拔出设备前停止 stack(stack),当然也不是非做不可。
|
||||
启动 stack (栈) 时,会得到如下的输出:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>/etc/rc.bluetooth start ubt0</userinput>
|
||||
<screen>&prompt.root; <userinput>/etc/rc.d/bluetooth start ubt0</userinput>
|
||||
BD_ADDR: 00:02:72:00:d4:1a
|
||||
Features: 0xff 0xff 0xf 00 00 00 00 00
|
||||
<3-Slot> <5-Slot> <Encryption> <Slot offset>
|
||||
|
@ -4377,7 +4377,7 @@ IP Address 10.0.0.1 10.0.0.2</programlisting>
|
|||
|
||||
<programlisting>127.0.0.1 localhost.my.domain localhost
|
||||
10.0.0.1 host1.my.domain host1
|
||||
10.0.0.2 host2.my.domain</programlisting>
|
||||
10.0.0.2 host2.my.domain host2</programlisting>
|
||||
|
||||
<para>要确认连接是否工作,可以到每一台机子上,然后
|
||||
ping 另外一台。例如,在 <hostid>host1</hostid> 上:</para>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
The FreeBSD Documentation Project
|
||||
The FreeBSD Simplified Chinese Project
|
||||
|
||||
Original Revision: 1.153
|
||||
Original Revision: 1.154
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
|
@ -604,6 +604,129 @@ total 530
|
|||
&man.chflags.1; 和 &man.chflags.2; 联机手册,
|
||||
以对其加深理解。</para>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<sect2info>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Tom</firstname>
|
||||
<surname>Rhodes</surname>
|
||||
<contrib>原作 </contrib>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</sect2info>
|
||||
|
||||
<title>setuid、 setgid 和 sticky 权限</title>
|
||||
|
||||
<para>除了前面已经讨论过的那些权限之外, 还有三个管理员应该知道的权限配置。
|
||||
它们是 <literal>setuid</literal>、
|
||||
<literal>setgid</literal> 和 <literal>sticky</literal>。</para>
|
||||
|
||||
<para>这些配置对于一些 &unix; 操作而言很重要,
|
||||
因为它们能提供一些一般情况下不会授予普通用户的功能。
|
||||
为了便于理解, 我们首先介绍真实用户 ID (real
|
||||
user ID) 和生效用户 ID (effective user ID)。</para>
|
||||
|
||||
<para>真实用户 ID 是拥有或启动进程的用户 <acronym>UID</acronym>。
|
||||
生效 <acronym>UID</acronym>
|
||||
是进程以其身份运行的用户 ID。 举例来说,
|
||||
&man.passwd.1; 工具通常是以发起修改密码的用户身份启动,
|
||||
也就是说其进程的真实用户 ID 是那个用户的 ID;
|
||||
但是, 由于需要修改密码数据库, 它会以
|
||||
<username>root</username> 用户作为生效用户 ID 的身份运行。
|
||||
这样, 普通的非特权用户就可以修改口令, 而不是看到
|
||||
<errorname>Permission Denied</errorname> 错误了。</para>
|
||||
|
||||
<note>
|
||||
<para>&man.mount.8; 的 <literal>nosuid</literal>
|
||||
选项可以令系统在不给出任何错误提示的情况下不执行这些程序。
|
||||
另一方面, 这个选项并不是万无一失的, 正如
|
||||
&man.mount.8; 联机手册所提到的那样,
|
||||
如果系统中安装了绕过 <literal>nosuid</literal>
|
||||
的封装程序, 那么这种保护就可以被绕过了。</para>
|
||||
</note>
|
||||
|
||||
<para>setuid 权限可以通过在普通权限前面加上一个数字四 (4)
|
||||
来设置, 如下面的例子所示:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>chmod 4755 suidexample.sh</userinput></screen>
|
||||
|
||||
<para>这样一来,
|
||||
<filename><replaceable>suidexample.sh</replaceable></filename>
|
||||
的权限应该如下面这样:</para>
|
||||
|
||||
<programlisting>-rwsr-xr-x 1 trhodes trhodes 63 Aug 29 06:36 suidexample.sh</programlisting>
|
||||
|
||||
<para>您会注意到, 在原先的属主执行权限的位置变成了
|
||||
<literal>s</literal>。 这样, 需要提升特权的可执行文件,
|
||||
例如 <command>passwd</command> 就可以正常运行了。</para>
|
||||
|
||||
<para>可以打开两个终端来观察这一情形。 在其中一个终端里面,
|
||||
以普通用户身份启动 <command>passwd</command> 进程。
|
||||
在它等待输入新口令时, 在另一个终端中查看进程表中关于
|
||||
<command>passwd</command> 命令的信息。</para>
|
||||
|
||||
<para>在终端 A 中:</para>
|
||||
|
||||
<screen>Changing local password for trhodes
|
||||
Old Password:</screen>
|
||||
|
||||
<para>在终端 B 中:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>ps aux | grep passwd</userinput></screen>
|
||||
|
||||
<screen>trhodes 5232 0.0 0.2 3420 1608 0 R+ 2:10AM 0:00.00 grep passwd
|
||||
root 5211 0.0 0.2 3620 1724 2 I+ 2:09AM 0:00.01 passwd</screen>
|
||||
|
||||
<para>正如前面所说的那样, <command>passwd</command> 是以普通用户的身份启动的,
|
||||
但其生效
|
||||
<acronym>UID</acronym> 是 <username>root</username>。</para>
|
||||
|
||||
<para>与此对应, <literal>setgid</literal> 权限的作用,
|
||||
与 <literal>setuid</literal> 权限类似,
|
||||
只是当应用程序配合这一设定运行时, 它会被授予拥有文件的那个组的权限。</para>
|
||||
|
||||
<para>如果需要在文件上配置 <literal>setgid</literal> 权限,
|
||||
可以在权限数值前面增加数字二 (2) 来运行 <command>chmod</command> 命令,
|
||||
如下面的例子所示:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>chmod 2755 suidexample.sh</userinput></screen>
|
||||
|
||||
<para>可以用与前面类似的方法来检视新设定的生效情况, 在组权限的地方的
|
||||
<literal>s</literal> 表示这一配置已经生效:<para>
|
||||
|
||||
<screen>-rwxr-sr-x 1 trhodes trhodes 44 Aug 31 01:49 suidexample.sh</screen>
|
||||
|
||||
<note>
|
||||
<para>在这些例子中, 尽管 shell 脚本也属于可执行文件的一种,
|
||||
但它们不会以您配置的 <acronym>EUID</acronym> 或生效用户 ID 的身份运行。
|
||||
这是因为 shell 脚本可能无法直接呼叫
|
||||
&man.setuid.2; 调用。</para>
|
||||
</note>
|
||||
|
||||
<para>我们已经讨论了两个特殊权限位
|
||||
(<literal>setuid</literal> 和 <literal>setgid</literal>
|
||||
权限位), 它们让用户在使用程序时能够用到更高的权限,
|
||||
有时这会削弱系统的安全性。 除了这两个之外, 还有第三个特殊权限位:
|
||||
<literal>sticky bit</literal>, 它能够增强安全性。</para>
|
||||
|
||||
<para>当在目录上设置了 <literal>sticky bit</literal> 之后,
|
||||
其下的文件就只能由文件的所有者删除了。 这个权限设置能够防止用户删除类似
|
||||
<filename class="directory">/tmp</filename> 这样的公共目录中不属于他们的文件。
|
||||
要应用这种权限, 可以在权限设置前面加上数字一 (1)。 例如:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>chmod 1777 /tmp</userinput></screen>
|
||||
|
||||
<para>现在, 可以用
|
||||
<command>ls</command> 命令来查看效果:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>ls -al / | grep tmp</userinput></screen>
|
||||
|
||||
<screen>drwxrwxrwt 10 root wheel 512 Aug 31 01:49 tmp</screen>
|
||||
|
||||
<para>这里的结尾的 <literal>t</literal> 表示了
|
||||
<literal>sticky bit</literal> 权限。</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="dirstructure">
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
The FreeBSD Documentation Project
|
||||
The FreeBSD Simplified Chinese Documentation Project
|
||||
|
||||
Original Revision: 1.172
|
||||
Original Revision: 1.173
|
||||
$FreeBSD$
|
||||
>>>>>>> 1.173
|
||||
-->
|
||||
|
||||
<!DOCTYPE BOOK PUBLIC "-//FreeBSD//DTD DocBook V4.1-Based Extension//EN" [
|
||||
|
@ -50,6 +51,9 @@
|
|||
<!ENTITY % chap.freebsd-glossary "IGNORE">
|
||||
<!ENTITY % chap.mac "IGNORE">
|
||||
<!ENTITY % chap.audit "IGNORE">
|
||||
<!ENTITY % chap.filesystems "IGNORE">
|
||||
<!ENTITY % chap.dtrace "IGNORE">
|
||||
<!ENTITY % chap.updating "IGNORE">
|
||||
|
||||
<!ENTITY % pgpkeys SYSTEM "../../../share/pgpkeys/pgpkeys.ent"> %pgpkeys;
|
||||
]>
|
||||
|
@ -258,10 +262,12 @@
|
|||
<![ %chap.audit; [ &chap.audit; ]]>
|
||||
<![ %chap.disks; [ &chap.disks; ]]>
|
||||
<![ %chap.geom; [ &chap.geom; ]]>
|
||||
<![ %chap.filesystems; [ &chap.filesystems; ]]>
|
||||
<![ %chap.vinum; [ &chap.vinum; ]]>
|
||||
<![ %chap.virtualization; [ &chap.virtualization; ]]>
|
||||
<![ %chap.l10n; [ &chap.l10n; ]]>
|
||||
<![ %chap.cutting-edge; [ &chap.cutting-edge; ]]>
|
||||
<![ %chap.dtrace; [ &chap.dtrace; ]]>
|
||||
</part>
|
||||
|
||||
<part id="network-communication">
|
||||
|
@ -301,6 +307,7 @@
|
|||
不需要以特定的顺序来阅读它们, 此外, 您开始在网络中使用 FreeBSD 之前也不必把它们都读完。</para>
|
||||
</partintro>
|
||||
|
||||
<![ %chap.updating; [ &chap.updating; ]]>
|
||||
<![ %chap.serialcomms; [ &chap.serialcomms; ]]>
|
||||
<![ %chap.ppp-and-slip; [ &chap.ppp-and-slip; ]]>
|
||||
<![ %chap.mail; [ &chap.mail; ]]>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
Chapters should be listed in the order in which they are referenced.
|
||||
|
||||
Original revision: 1.37
|
||||
Original revision: 1.38
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
|
@ -36,12 +36,15 @@
|
|||
<!ENTITY chap.audit SYSTEM "audit/chapter.sgml">
|
||||
<!ENTITY chap.disks SYSTEM "disks/chapter.sgml">
|
||||
<!ENTITY chap.geom SYSTEM "geom/chapter.sgml">
|
||||
<!ENTITY chap.filesystems SYSTEM "filesystems/chapter.sgml">
|
||||
<!ENTITY chap.vinum SYSTEM "vinum/chapter.sgml">
|
||||
<!ENTITY chap.virtualization SYSTEM "virtualization/chapter.sgml">
|
||||
<!ENTITY chap.l10n SYSTEM "l10n/chapter.sgml">
|
||||
<!ENTITY chap.cutting-edge SYSTEM "cutting-edge/chapter.sgml">
|
||||
<!ENTITY chap.dtrace SYSTEM "dtrace/chapter.sgml">
|
||||
|
||||
<!-- Part four -->
|
||||
<!ENTITY chap.updating SYSTEM "updating/chapter.sgml">
|
||||
<!ENTITY chap.serialcomms SYSTEM "serialcomms/chapter.sgml">
|
||||
<!ENTITY chap.ppp-and-slip SYSTEM "ppp-and-slip/chapter.sgml">
|
||||
<!ENTITY chap.mail SYSTEM "mail/chapter.sgml">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
The FreeBSD Documentation Project
|
||||
The FreeBSD Chinese Documentation Project
|
||||
|
||||
Original Revision: 1.233
|
||||
Original Revision: 1.236
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
|
@ -110,21 +110,32 @@
|
|||
要记住硬盘驱动器外磁道传输数据要比从内磁道传输数据快。
|
||||
因此应该将小的和经常访问的文件系统放在驱动器靠外的位置,
|
||||
一些大的分区比如 <filename>/usr</filename>
|
||||
应该放在比较靠里的位置。
|
||||
应该放在磁盘比较靠里的位置。
|
||||
以类似这样的顺序建立分区是一个不错的主意:root,swap,
|
||||
<filename>/var</filename>,<filename>/usr</filename>。</para>
|
||||
|
||||
<para><filename>/var</filename> 的大小能反映您的机器使用情况。
|
||||
它用来存储邮件,日志文件和打印队列缓存,
|
||||
<para><filename>/var</filename> 分区的大小能反映您的机器使用情况。
|
||||
<filename>/var</filename> 文件系统用来存储邮件,
|
||||
日志文件和打印队列缓存,
|
||||
特别是邮箱和日志文件可能会达到无法预料的大小,
|
||||
这主要取决于在您的系统上有多少用户和您的日志文件可以保存多长时间。
|
||||
一般大多数用户不需要一个 G 以上的空间,但要记住
|
||||
<filename>/var/tmp</filename> 应该足够大来以便存储一些
|
||||
packages。</para>
|
||||
大多数用户很少需要 <filename>/var</filename>
|
||||
有 1GB 以上的闲置空间。</para>
|
||||
|
||||
<note>
|
||||
<para>有时候 <filename>/var/tmp</filename> 需要很多的磁盘空间。
|
||||
在使用 &man.pkg.add.1; 安装新的软件时,包管理工具会在
|
||||
<filename>/var/tmp</filename> 中解压出一份临时拷贝。
|
||||
大的软件包,像 <application>Firefox</application>,
|
||||
或者 <application>OpenOffice</application>
|
||||
在安装时如果 <filename>/var/tmp</filename>
|
||||
中没有足够的空间就可能需要一些技巧了。</para>
|
||||
</note>
|
||||
|
||||
<para><filename>/usr</filename> 分区存储很多用来系统运行所需要的文件例如
|
||||
&man.ports.7; (建议这样做) 和源代码 (可选的)。安装的时候这两项都是可选的。
|
||||
这个分区至少要保留两个 G 的可用空间。</para>
|
||||
&man.ports.7; (建议这样做) 和源代码 (可选的)。
|
||||
ports 和基本系统的源代码在安装时都是可选的,
|
||||
但我们建议给这个分区至少保留 2GB 的可用空间。</para>
|
||||
|
||||
<para>当选择分区大小的时候,记住保留一些空间。
|
||||
用完了一个分区的空间而在另一个分区上还有很多,
|
||||
|
@ -134,7 +145,6 @@
|
|||
<literal>Auto-defaults</literal> 自动分区有时会分配给
|
||||
<filename>/var</filename> 和 <filename>/</filename> 较小的分区空间。
|
||||
分区应该精确一些并且大一些。</para></note>
|
||||
|
||||
</sect3>
|
||||
|
||||
<sect3 id="swap-design">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
The FreeBSD Documentation Project
|
||||
The FreeBSD Simplified Chinese Project
|
||||
|
||||
Original Revision: 1.228
|
||||
Original Revision: 1.231
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
|
@ -16,20 +16,24 @@
|
|||
</author>
|
||||
<!-- Mar 2000 -->
|
||||
</authorgroup>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Jordan</firstname>
|
||||
<surname>Hubbard</surname>
|
||||
<contrib>原创:</contrib>
|
||||
</author>
|
||||
|
||||
<author>
|
||||
<firstname>Poul-Henning</firstname>
|
||||
<surname>Kamp</surname>
|
||||
</author>
|
||||
|
||||
<author>
|
||||
<firstname>John</firstname>
|
||||
<surname>Polstra</surname>
|
||||
</author>
|
||||
|
||||
<author>
|
||||
<firstname>Nik</firstname>
|
||||
<surname>Clayton</surname>
|
||||
|
@ -81,6 +85,17 @@
|
|||
<listitem><para>知道怎样安装附加的第三方软件(<xref
|
||||
linkend="ports">)。</para></listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<note>
|
||||
<para>整个这一章中,<command>cvsup</command>
|
||||
命令都被用来获取 &os; 源代码的更新。
|
||||
你需要安装一个像
|
||||
<filename role="package">net/cvsup-without-gui</filename>
|
||||
这样的 port 或者二进制包。
|
||||
如果你使用的是 &os; 6.2-RELEASE 或之后的版本,
|
||||
你可以使用 &man.csup.1; 代替,
|
||||
现在它已经是基本系统的一部分了。</para>
|
||||
</note>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="current-stable">
|
||||
|
@ -180,19 +195,22 @@
|
|||
</indexterm>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>加入 &a.current.name; 和 &a.cvsall.name; 列表。
|
||||
<para>加入 &a.current.name; 和 &a.svn-src-head.name; 列表。
|
||||
这个不仅仅是个好主意,而且很 <emphasis>重要</emphasis>。如果您不去
|
||||
<emphasis>&a.current.name;</emphasis>,
|
||||
您就不会看到人们所做的关于系统当前状态的说明,
|
||||
这样您就有可能在别人已经发现并解决了的一大堆问题面前难倒。
|
||||
更重要的是您会错过一些重要的公告---对于您的系统安全可能是至关重要的。</para>
|
||||
|
||||
<para>&a.cvsall.name; 列表允许您看到每个变化的提交记录,
|
||||
<para>&a.svn-src-head.name; 列表允许您看到每个变化的提交记录,
|
||||
因为这些记录与其它相关信息是同步的。</para>
|
||||
|
||||
<para>要加入这些列表,或其它可能的列表,请访问
|
||||
&a.mailman.lists.link; ,并且点击您想订阅的列项。
|
||||
关于其它步骤的说明那里有提供。</para>
|
||||
关于其它步骤的说明那里有提供。
|
||||
如果你有兴趣追踪整个原代码树的变更记录,
|
||||
我们建议你订阅 &a.svn-src-all.name;
|
||||
邮件列表。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
|
@ -221,6 +239,23 @@
|
|||
运行 <command>cvsup</command>,以保持他们的源码自动更新。
|
||||
您须要定制上边的 <filename>supfile</filename> 样本,并且配置 <link
|
||||
linkend="cvsup">cvsup</link> 以适应您的环境。</para>
|
||||
|
||||
<note>
|
||||
<para><filename>standard-supfile</filename>
|
||||
例子是为追踪指定的 &os; 安全分支而指定的,
|
||||
而不是 &os.current;。
|
||||
你需要编辑这个文件并把如下这行:</para>
|
||||
|
||||
<programlisting>*default release=cvs tag=RELENG_<replaceable>X</replaceable>_<replaceable>Y</replaceable></programlisting>
|
||||
|
||||
<para>替换为:</para>
|
||||
|
||||
<programlisting>*default release=cvs tag=.</programlisting>
|
||||
|
||||
<para>可以参阅手册中的
|
||||
<link linkend="cvs-tags">CVS Tags</link>
|
||||
章节获得更多可用 tag 的详细说明。</para>
|
||||
</note>
|
||||
</listitem>
|
||||
|
||||
<indexterm>
|
||||
|
@ -335,11 +370,17 @@
|
|||
他们就会在这个邮件列表里发表声明,给用户机会回应,
|
||||
看他们对于提出的变化是否还有什么问题。</para>
|
||||
|
||||
<para>&a.cvsall.name; 列表允许您看到每一个变化的提交记录条目,
|
||||
这些变化是随着由可能的副作用引起的任何相关信息而产生的。</para>
|
||||
<para>加入相关的 <application>SVN</application>
|
||||
列表来追踪你所关心的分支。比如,如果你在追踪 7-STABLE
|
||||
分支,加入 &a.svn-src-stable-7.name; 列表。
|
||||
这样每次这个分支上有改动的时候就能让你看到提交记录,
|
||||
还包括了修改可能引起的副作用之类的相关信息。</para>
|
||||
|
||||
<para>要加入这些列表或其他可用的,访问 &a.mailman.lists.link;
|
||||
并点击您希望订阅的列表。关于其它步骤的说明可以在那里看到。</para>
|
||||
并点击您希望订阅的列表。关于其它步骤的说明可以在那里看到。
|
||||
如果你有兴趣追踪整个原代码树的变更记录,
|
||||
我们建议你订阅 &a.svn-src-all.name;
|
||||
邮件列表。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
|
@ -546,10 +587,11 @@
|
|||
buildworld 之前需要完成的步骤,
|
||||
然后使用下面的过程:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>make buildworld</userinput>
|
||||
<screen>&prompt.root; <userinput>cd /usr/src</userinput>
|
||||
&prompt.root; <userinput>make buildworld</userinput>
|
||||
&prompt.root; <userinput>make buildkernel</userinput>
|
||||
&prompt.root; <userinput>make installkernel</userinput>
|
||||
&prompt.root; <userinput>reboot</userinput></screen>
|
||||
&prompt.root; <userinput>shutdown -r now</userinput></screen>
|
||||
|
||||
<note>
|
||||
<para>有时, 可能需要额外地执行一次
|
||||
|
@ -565,7 +607,9 @@
|
|||
可以在加载器提示后输入 <command>boot -s</command>)。
|
||||
接下来执行:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>mergemaster -p</userinput>
|
||||
<screen>&prompt.root; <userinput>mount -a -t ufs</userinput>
|
||||
&prompt.root; <userinput>mergemaster -p</userinput>
|
||||
&prompt.root; <userinput>cd /usr/src</userinput>
|
||||
&prompt.root; <userinput>make installworld</userinput>
|
||||
&prompt.root; <userinput>mergemaster</userinput>
|
||||
&prompt.root; <userinput>reboot</userinput></screen>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
The FreeBSD Documentation Project
|
||||
The FreeBSD Chinese Project
|
||||
|
||||
Original Revision: 1.76
|
||||
Original Revision: 1.78
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
|
@ -264,7 +264,7 @@
|
|||
插件。 如果不是这样的话, 则需要以
|
||||
<username>root</username> 身份执行下列命令:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>ln -s /usr/local/diablo-jre1.5.0/plugin/i386/ns7/libjavaplugin_oji.so \
|
||||
<screen>&prompt.root; <userinput>ln -s /usr/local/diablo-jre1.6.0/plugin/i386/ns7/libjavaplugin_oji.so \
|
||||
/usr/local/lib/browser_plugins/</userinput></screen>
|
||||
|
||||
<para>然后重新启动浏览器。</para>
|
||||
|
@ -351,7 +351,7 @@
|
|||
关于如何获得用于
|
||||
<application>Konqueror</application>
|
||||
的 <application>&flash;</application> 支持的 <quote>How To</quote> 文档
|
||||
可以在 <ulink url="http://freebsd.kde.org/howto.php"></ulink> 找到。</para>
|
||||
可以在 <ulink url="http://freebsd.kde.org/howtos/konqueror-flash.php"></ulink> 找到。</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
The FreeBSD Documentation Project
|
||||
The FreeBSD Simplified Chinese Project
|
||||
|
||||
Original Revision: 1.286
|
||||
Original Revision: 1.288
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
|
@ -725,7 +725,7 @@ da0: 126MB (258048 512 byte sectors: 64H 32S/T 126C)</screen>
|
|||
在生成设备文件时, <groupname>operator</groupname> 组应能读写它们。 这可以通过在
|
||||
<filename>/etc/devfs.rules</filename> 中增加一些相应的设置来实现:</para>
|
||||
|
||||
<programlisting>[localrules=1]
|
||||
<programlisting>[localrules=5]
|
||||
add path 'da*' mode 0660 group operator</programlisting>
|
||||
|
||||
<note>
|
||||
|
@ -757,16 +757,17 @@ add path 'da*' mode 0660 group operator</programlisting>
|
|||
这个目录必须是属于将要挂接文件系统的用户的。
|
||||
以 <username>root</username> 身份为用户建立属于该用户的
|
||||
<filename>/mnt/<replaceable>username</replaceable></filename>
|
||||
(此处 <replaceable>username</replaceable> 应替换成用户的登录名):</para>
|
||||
(此处 <replaceable>username</replaceable> 应替换成用户的登录名,
|
||||
并把 <replaceable>usergroup</replaceable> 替换成用户所属的组):</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>mkdir /mnt/<replaceable>username</replaceable></userinput>
|
||||
&prompt.root; <userinput>chown <replaceable>user</replaceable>:<replaceable>user</replaceable> /mnt/<replaceable>user</replaceable></userinput></screen>
|
||||
&prompt.root; <userinput>chown <replaceable>username</replaceable>:<replaceable>usergroup</replaceable> /mnt/<replaceable>username</replaceable></userinput></screen>
|
||||
|
||||
<para>假设已经插入了一个 USB 读卡设备, 并且系统将其识别为
|
||||
<filename>/dev/da0s1</filename>, 由于这些设备通常是 FAT
|
||||
文件系统, 用户可以这样挂接它们:</para>
|
||||
|
||||
<screen>&prompt.user; <userinput>mount -t msdosfs -m 644 -M 755 /dev/da0s1 /mnt/<replaceable>username</replaceable></userinput></screen>
|
||||
<screen>&prompt.user; <userinput>mount -t msdosfs -o -m=644,-M=755 /dev/da0s1 /mnt/<replaceable>username</replaceable></userinput></screen>
|
||||
|
||||
<para>如果拔出设备 (必须首先将其对应的磁盘卷卸下),
|
||||
则您会在系统消息缓冲区中看到类似下面的信息:</para>
|
||||
|
|
18
zh_CN.GB2312/books/handbook/dtrace/Makefile
Normal file
18
zh_CN.GB2312/books/handbook/dtrace/Makefile
Normal file
|
@ -0,0 +1,18 @@
|
|||
#
|
||||
# Build the Handbook with just the content from this chapter.
|
||||
#
|
||||
# The FreeBSD Simplified Chinese Project
|
||||
# Original Revision: 1.1
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
CHAPTERS= dtrace/chapter.sgml
|
||||
|
||||
VPATH= ..
|
||||
|
||||
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
|
||||
|
||||
DOC_PREFIX?= ${.CURDIR}/../../../..
|
||||
|
||||
.include "../Makefile"
|
370
zh_CN.GB2312/books/handbook/dtrace/chapter.sgml
Normal file
370
zh_CN.GB2312/books/handbook/dtrace/chapter.sgml
Normal file
|
@ -0,0 +1,370 @@
|
|||
<!--
|
||||
Recently I suggested to myself that this should become a profiling
|
||||
and debugging chapter, which covers things like ktrace(1) and
|
||||
using other debugging (like -x in shell scripts). But then I
|
||||
realized that, over time and while DTrace becomes better supported,
|
||||
that might make this chapter too large.
|
||||
-->
|
||||
|
||||
<!--
|
||||
The FreeBSD Documentation Project
|
||||
Original Revision: 1.5
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
<chapter id="dtrace">
|
||||
<chapterinfo>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Tom</firstname>
|
||||
<surname>Rhodes</surname>
|
||||
<contrib>Written by </contrib>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</chapterinfo>
|
||||
|
||||
<title>DTrace</title>
|
||||
|
||||
<sect1 id="dtrace-synopsis">
|
||||
<title>概述</title>
|
||||
|
||||
<indexterm><primary>DTrace</primary></indexterm>
|
||||
<indexterm>
|
||||
<primary>DTrace support</primary>
|
||||
<see>DTrace</see>
|
||||
</indexterm>
|
||||
|
||||
<para>DTrace,也称为动态跟踪,是由 &sun;
|
||||
开发的一个用来在生产和试验性生产系统上找出系统瓶颈的工具。
|
||||
在任何情况下它都不是一个调试工具,
|
||||
而是一个实时系统分析寻找出性能及其他问题的工具。</para>
|
||||
|
||||
<para>DTrace 是个特别好的分析工具,带有大量的帮助诊断系统问题的特性。
|
||||
还可以使用预先写好的脚本利用它的功能。
|
||||
用户也可以通过使用 DTrace D 语言创建他们自己定制的分析工具,
|
||||
以满足特定的需求。</para>
|
||||
|
||||
<para>在阅读了这一章节之后,你将了解:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>DTrace 是什么,它提供了些哪些特性。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>DTrace 在 &solaris; 与 &os; 上的实现的差别。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>如何在 &os; 上开启和使用 DTrace。</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<para>在阅读这一章节之前,你应该了解:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>了解 &unix; 和 &os; 的基本知识
|
||||
(<xref linkend="basics">)。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>熟悉基本的内核配置/编译
|
||||
(<xref linkend="kernelconfig">).</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>熟悉 &os; 有关的安全知识
|
||||
(<xref linkend="security">)。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>了解如何获取和重新编译 &os; 源代码
|
||||
(<xref linkend="cutting-edge">)。</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<!--
|
||||
Temporary warning to avoid listing experimental versions
|
||||
and production versions of FreeBSD with this technology.
|
||||
-->
|
||||
<warning>
|
||||
<para>这项特性目前仍被认为是试验性的。
|
||||
有些选项功能性缺失,另有一些可能还无法运行。最终,
|
||||
这个特性会适合用于生产,届时这篇文档也会做些适当的修改。</para>
|
||||
</warning>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="dtrace-implementation">
|
||||
<title>实现上的差异</title>
|
||||
|
||||
<para>虽然 &os; 上的 DTrace 与 &solaris; 上的非常相似,
|
||||
在继续深入之前我们需要说明一下存在的差异。
|
||||
用户首先会注意到的便是 &os; 上的 DTrace 需要明确的被启用。
|
||||
DTrace 相关的内核选项和模块必须开启后才能正常工作。
|
||||
稍后我们会作详细介绍。</para>
|
||||
|
||||
<para>有一个 <literal>DDB_CTF</literal>
|
||||
内核选项用来开启从内核与内核模块加载
|
||||
<literal>CTF</literal> 数据。
|
||||
<acronym>CTF</acronym> 是 &solaris; Compact C Type Format
|
||||
封装了类似于 <acronym>DWARF</acronym> 和 venerable stabs
|
||||
简化的调试信息。<acronym>CTF</acronym> 数据是由
|
||||
<command>ctfconvert</command> 和 <command>ctfmerge</command>
|
||||
工具加入二进制文件的。<command>ctfconvert</command>
|
||||
工具分析由编译器生成的 <acronym>DWARF</acronym> 调试
|
||||
<acronym>ELF</acronym> section,
|
||||
<command>ctfmerge</command> 合并目标文件的
|
||||
<acronym>CTF</acronym> <acronym>ELF</acronym> section
|
||||
到可执行文件或共享库。更多关于在启用 &os;
|
||||
内核上启用此项的详细内容即将完成。</para>
|
||||
|
||||
<para>比起 &solaris;, &os; 有几个不同提供器。
|
||||
最值得注意的时 <literal>dtmalloc</literal> 提供器,
|
||||
可以让你根据类型追踪 &os; 内核中的
|
||||
<function>malloc()</function>。</para>
|
||||
|
||||
<para>只有 <username>root</username> 可以使用 &os; 上的 DTrace。
|
||||
这是由系统安全上的差异造成的,&solaris; 提供了一些 &os;
|
||||
上还为实现的低层的安全检查。同样,
|
||||
<devicename>/dev/dtrace/dtrace</devicename> 也被严格的限制为仅供
|
||||
<username>root</username> 用户访问。</para>
|
||||
|
||||
<para>最后,DTrace 为 &sun; <acronym>CDDL</acronym>
|
||||
许可下发布的软件。随 &os; 发行的
|
||||
<literal>Common Development and Distribution License</literal>
|
||||
可以在查阅
|
||||
<filename>/usr/src/cddl/contrib/opensolaris/OPENSOLARIS.LICENSE</filename>
|
||||
或者通过
|
||||
<ulink url="http://www.opensolaris.org/os/licensing"></ulink>
|
||||
查看在线版本。</para>
|
||||
|
||||
<para>这个许可表示带有 DTrace 选项的 &os; 内核仍为
|
||||
<acronym>BSD</acronym> 许可;然而以二进制发布模块,
|
||||
或者加载二进制模块则需遵守 <acronym>CDDL</acronym>。</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="dtrace-enable">
|
||||
<title>启用 DTrace 支持</title>
|
||||
|
||||
<para>在内核配置文件中加入以下几行来开启对 DTrace 的支持:</para>
|
||||
|
||||
<programlisting>options KDTRACE_HOOKS
|
||||
options DDB_CTF</programlisting>
|
||||
|
||||
<note>
|
||||
<para>使用 AMD64 架构的需要在内核配置文件中加入如下这行:</para>
|
||||
|
||||
<programlisting>options KDTRACE_FRAME</programlisting>
|
||||
|
||||
<para>此选项提供了对 <acronym>FBT</acronym> 特性的支持。
|
||||
DTrace 可以在没有此选项的情况下正常工作,
|
||||
但是函数边界跟踪便会有所限制。</para>
|
||||
</note>
|
||||
|
||||
<para>所有的源代码都必须重新使用 <acronym>CTF</acronym>
|
||||
选项编译安装。重新编译 &os; 源代码可以通过以下的命令完成:</para>
|
||||
|
||||
<!-- XXXTR: WITH_CTF has been reported to leave a user with a
|
||||
broken system when used with buildworld. Until this is
|
||||
fixed, comment out those parts. When uncommenting, kill
|
||||
the extra screen.
|
||||
-->
|
||||
|
||||
<!-- XXXTR: WITH_CTF has been reported to leave a user with a
|
||||
broken system when used with buildworld. Until this is
|
||||
fixed, comment out those parts. When uncommenting, kill
|
||||
the extra screen.
|
||||
-->
|
||||
|
||||
<screen>&prompt.root; <userinput>cd /usr/src</userinput>
|
||||
<!-- &prompt.root; <userinput>make WITH_CTF=1 buildworld</userinput> -->
|
||||
&prompt.root; <userinput>make WITH_CTF=1 kernel</userinput></screen>
|
||||
<!-- &prompt.root; <userinput>make WITH_CTF=1 installworld</userinput>
|
||||
&prompt.root; <userinput>mergemaster -Ui</userinput></screen> -->
|
||||
|
||||
<para>系统需要重新启动。</para>
|
||||
|
||||
<para>在重新启动和新内核载入内存之后,需要添加 Korn shell
|
||||
的支持。因为 DTrace 工具包有一些工具是由 <command>ksh</command>
|
||||
写的。安装 <filename role="package">shells/ksh93</filename>。
|
||||
同样也可以通过 <filename role="package">shells/pdksh</filename>
|
||||
或者 <filename role="package">shells/mksh</filename>
|
||||
使用这些工具。</para>
|
||||
|
||||
<para>最后是获得最新的 DTrace 工具包。
|
||||
当前版本可以通过下面的链接找到
|
||||
<ulink url="http://www.opensolaris.org/os/community/dtrace/dtracetoolkit/"></ulink>。
|
||||
这个工具包含有一个安装机制,尽管如此,并不需要安装便可使用它们。</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="dtrace-using">
|
||||
<title>使用 DTrace</title>
|
||||
|
||||
<para>在使用 DTrace 的功能之前,DTrace 设备必须存在。
|
||||
使用如下的命令装载此设备:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>kldload dtraceall</userinput></screen>
|
||||
|
||||
<para>DTrace 支持现在应该可以使用了。
|
||||
管理员现在可以使用如下的命令查看所有的探测器:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>dtrace -l | more</userinput></screen>
|
||||
|
||||
<para>所有的输出都传递给 <command>more</command> 工具,
|
||||
因为它们会很快超出屏幕的显示区域。此时,DTrace
|
||||
应该被认为是能够正常工作的了。现在是该考察工具包的时候了。</para>
|
||||
|
||||
<para>工具包是实现写好的一堆脚本,与 DTrace 一起运行来收集系统信息。
|
||||
有脚本用来检查已打开的文件,内存,<acronym>CPU</acronym>
|
||||
使用率和许多东西。使用如下的命令解开脚本:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>gunzip -c DTraceToolkit* | tar xvf -</userinput></screen>
|
||||
|
||||
<para>使用 <command>cd</command> 命令切换到那个目录,
|
||||
并修改所有文件的可执行权限,把那些名字小写的文件权限改为
|
||||
<literal>755</literal>。</para>
|
||||
|
||||
<para>所有这些脚本都需要修改它们的内容。那些指向
|
||||
<filename>/usr/bin/ksh</filename> 需要修改成
|
||||
<filename>/usr/local/bin/ksh</filename>,另外使用
|
||||
<filename>/usr/bin/sh</filename> 需要变更为
|
||||
<filename>/bin/sh</filename>,最后还有使用
|
||||
<filename>/usr/bin/perl</filename> 的需要变更为
|
||||
<filename>/usr/local/bin/perl</filename>。</para>
|
||||
|
||||
<important>
|
||||
<para>此刻还需谨慎提醒一下读者 &os; 的 DTrace 支持仍是
|
||||
<emphasis>不完整的</emphasis> 和 <emphasis>试验性</emphasis> 的。
|
||||
这些脚本中的大多数都无法运行,因为它们过于针对 &solaris;
|
||||
或者使用了目前还不支持的探测器。</para>
|
||||
</important>
|
||||
|
||||
<para>在撰写这篇文章的时候,DTrace 工具包中只有两个脚本在
|
||||
&os; 上是完全支持的:
|
||||
<filename>hotkernel</filename> 和 <filename>procsystime</filename>
|
||||
脚本。这两个脚本便是我们下一部分将要探讨的:</para>
|
||||
|
||||
<para><filename>hotkernel</filename>
|
||||
被设计成验明哪个函数占用了内核时间。
|
||||
正常运行的话,它将生成类似以下的输出:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>./hotkernel</userinput>
|
||||
Sampling... Hit Ctrl-C to end.</screen>
|
||||
|
||||
<para>系统管理员必须使用
|
||||
<keycombo action="simul">
|
||||
<keycap>Ctrl</keycap><keycap>C</keycap>
|
||||
</keycombo> 组合键停止这个进程。
|
||||
紧接着中止之后,脚本便会一张内核函数与测定时间的列表,
|
||||
使用增量排序输出:</para>
|
||||
|
||||
|
||||
<screen>kernel`_thread_lock_flags 2 0.0%
|
||||
0xc1097063 2 0.0%
|
||||
kernel`sched_userret 2 0.0%
|
||||
kernel`kern_select 2 0.0%
|
||||
kernel`generic_copyin 3 0.0%
|
||||
kernel`_mtx_assert 3 0.0%
|
||||
kernel`vm_fault 3 0.0%
|
||||
kernel`sopoll_generic 3 0.0%
|
||||
kernel`fixup_filename 4 0.0%
|
||||
kernel`_isitmyx 4 0.0%
|
||||
kernel`find_instance 4 0.0%
|
||||
kernel`_mtx_unlock_flags 5 0.0%
|
||||
kernel`syscall 5 0.0%
|
||||
kernel`DELAY 5 0.0%
|
||||
0xc108a253 6 0.0%
|
||||
kernel`witness_lock 7 0.0%
|
||||
kernel`read_aux_data_no_wait 7 0.0%
|
||||
kernel`Xint0x80_syscall 7 0.0%
|
||||
kernel`witness_checkorder 7 0.0%
|
||||
kernel`sse2_pagezero 8 0.0%
|
||||
kernel`strncmp 9 0.0%
|
||||
kernel`spinlock_exit 10 0.0%
|
||||
kernel`_mtx_lock_flags 11 0.0%
|
||||
kernel`witness_unlock 15 0.0%
|
||||
kernel`sched_idletd 137 0.3%
|
||||
0xc10981a5 42139 99.3%</screen>
|
||||
|
||||
<!-- XXXTR: I attempted to use objdump and nm on /boot/kernel/kernel
|
||||
to find 0xc10981a5, but to no avail. It would be nice to know
|
||||
how we should look that up. -->
|
||||
|
||||
<para>这个脚本也能与内核模块一起工作。要使用此特性,
|
||||
用 <option>-m</option> 标志运行脚本:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>./hotkernel -m</userinput>
|
||||
Sampling... Hit Ctrl-C to end.
|
||||
^C
|
||||
MODULE COUNT PCNT
|
||||
0xc107882e 1 0.0%
|
||||
0xc10e6aa4 1 0.0%
|
||||
0xc1076983 1 0.0%
|
||||
0xc109708a 1 0.0%
|
||||
0xc1075a5d 1 0.0%
|
||||
0xc1077325 1 0.0%
|
||||
0xc108a245 1 0.0%
|
||||
0xc107730d 1 0.0%
|
||||
0xc1097063 2 0.0%
|
||||
0xc108a253 73 0.0%
|
||||
kernel 874 0.4%
|
||||
0xc10981a5 213781 99.6%</screen>
|
||||
|
||||
<!-- XXXTR: I was unable to match these up with output from
|
||||
kldstat and kldstat -v and grep. Maybe I'm missing something
|
||||
seriously obvious. It is 5AM btw. -->
|
||||
|
||||
<para><filename>procsystime</filename>
|
||||
脚本捕捉并打印给定 <acronym>PID</acronym> 的系统调用时间。
|
||||
在下面的例子中,新生成了一个 <filename>/bin/csh</filename>
|
||||
实例。<filename>procsystime</filename> 执行后则等待在新运行的
|
||||
<command>csh</command> 上键入一些命令。 这是测试的结果:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>./procsystime -n csh</userinput>
|
||||
Tracing... Hit Ctrl-C to end...
|
||||
^C
|
||||
|
||||
Elapsed Times for processes csh,
|
||||
|
||||
SYSCALL TIME (ns)
|
||||
getpid 6131
|
||||
sigreturn 8121
|
||||
close 19127
|
||||
fcntl 19959
|
||||
dup 26955
|
||||
setpgid 28070
|
||||
stat 31899
|
||||
setitimer 40938
|
||||
wait4 62717
|
||||
sigaction 67372
|
||||
sigprocmask 119091
|
||||
gettimeofday 183710
|
||||
write 263242
|
||||
execve 492547
|
||||
ioctl 770073
|
||||
vfork 3258923
|
||||
sigsuspend 6985124
|
||||
read 3988049784</screen>
|
||||
|
||||
<para>正如显示的那样,<function>read</function>
|
||||
系统调用似乎使用了最多的纳秒单位时间,
|
||||
<function>getpid()</function> 系统调用使用了最少的时间。</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="dtrace-language">
|
||||
<title>D 语言</title>
|
||||
|
||||
<para>DTrace 工具包包括了很多由 DTrace 特殊语言写成的脚本。
|
||||
在 &sun; 的文档中称这类语言为 <quote>D 语言</quote>,
|
||||
它与 C++ 非常类似。对此语言更深入的讨论则超出了这篇文章的范围。
|
||||
更多相关的讨论可以在
|
||||
<ulink url="http://wikis.sun.com/display/DTrace/Documentation"></ulink>
|
||||
找到。</para>
|
||||
</sect1>
|
||||
</chapter>
|
||||
|
||||
<!-- XXXTR: Should probably put links and resources here. I'm
|
||||
nervous about this chapter as it may require a partial
|
||||
re-write and large modification once DTrace is complete, but
|
||||
at least we can get everyone started ... -->
|
|
@ -2,7 +2,7 @@
|
|||
The FreeBSD Documentation Project
|
||||
The FreeBSD Simplified Chinese Project
|
||||
|
||||
Original Revision: 1.186
|
||||
Original Revision: 1.195
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
|
@ -64,11 +64,6 @@
|
|||
</thead>
|
||||
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>&a.cvsall.name;</entry>
|
||||
<entry>FreeBSD源代码的变动</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>&a.advocacy.name;</entry>
|
||||
<entry>FreeBSD鼓吹者</entry>
|
||||
|
@ -510,6 +505,11 @@
|
|||
<entry>&a.x11.name;</entry>
|
||||
<entry>维护和支持在 FreeBSD 上运行的 X11</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>&a.xen.name;</entry>
|
||||
<entry>讨论 &os; &xen; 上的移植 — 实现和使用</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
|
@ -559,7 +559,7 @@
|
|||
<para><emphasis>分类列表:</emphasis> 所有以上的列表在一个分类格式里面是可利用的。
|
||||
一旦订阅了一个列表,您可以在您的账号选项里面设置您的分类选项。</para>
|
||||
|
||||
<para><emphasis>CVS列表:</emphasis> 以下的邮件是给对FreeBSD源代码的变更记录有兴趣的人看的,
|
||||
<para><emphasis>CVS 和 SVN 列表:</emphasis> 以下的邮件是给对FreeBSD源代码的变更记录有兴趣的人看的,
|
||||
而且它们是<emphasis>只读</emphasis>的邮件列表,您不能发Email给他们。</para>
|
||||
|
||||
<informaltable frame="none" pgwide="1">
|
||||
|
@ -575,7 +575,7 @@
|
|||
<tbody>
|
||||
<row>
|
||||
<entry>&a.cvsall.name;</entry>
|
||||
<entry><filename>/usr/(CVSROOT|doc|ports|projects|src)</filename></entry>
|
||||
<entry><filename>/usr/(CVSROOT|doc|ports)</filename></entry>
|
||||
<entry>所有对源代码的改变纪录 (其他 CVS commit 列表的超集)</entry>
|
||||
</row>
|
||||
|
||||
|
@ -600,7 +600,94 @@
|
|||
<row>
|
||||
<entry>&a.cvs-src.name;</entry>
|
||||
<entry><filename>/usr/src</filename></entry>
|
||||
<entry>所有对 src 源代码的改变记录</entry>
|
||||
<entry>所有对 src 源代码的改变记录
|
||||
(由 svn-to-cvs 提交导入程序生成)</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>&a.svn-src-all.name;</entry>
|
||||
<entry><filename>/usr/src</filename></entry>
|
||||
<entry>所有对 Subversion 仓库的改变记录
|
||||
(除了 <filename>user</filename> 和
|
||||
<filename>projects</filename>)</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>&a.svn-src-head.name;</entry>
|
||||
<entry><filename>/usr/src</filename></entry>
|
||||
<entry>所有对 Subversion 仓库 <quote>head</quote>
|
||||
分支的改变记录 (&os;-CURRENT 分支)</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>&a.svn-src-projects.name;</entry>
|
||||
<entry><filename>/usr/projects</filename></entry>
|
||||
<entry>所有对 Subversion 源码仓库中有关
|
||||
<filename>projects</filename> 部分的改变记录</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>&a.svn-src-release.name;</entry>
|
||||
<entry><filename>/usr/src</filename></entry>
|
||||
<entry>所有对 Subversion 源码仓库中有关
|
||||
<filename>releases</filename> 部分的改变记录</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>&a.svn-src-releng.name;</entry>
|
||||
<entry><filename>/usr/src</filename></entry>
|
||||
<entry>所有对 Subversion 源码仓库中有关
|
||||
<filename>releng</filename> 部分的改变记录
|
||||
(security / release engineering 分支)</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>&a.svn-src-stable.name;</entry>
|
||||
<entry><filename>/usr/src</filename></entry>
|
||||
<entry>所有对 Subversion 源码仓库中有关
|
||||
stable 分支的改变记录</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>&a.svn-src-stable-6.name;</entry>
|
||||
<entry><filename>/usr/src</filename></entry>
|
||||
<entry>所有对 Subversion 源码仓库中有关
|
||||
<filename>stable/6</filename> 分支的改变记录</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>&a.svn-src-stable-7.name;</entry>
|
||||
<entry><filename>/usr/src</filename></entry>
|
||||
<entry>所有对 Subversion 源码仓库中有关
|
||||
<filename>stable/7</filename> 分支的改变记录</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>&a.svn-src-stable-other.name;</entry>
|
||||
<entry><filename>/usr/src</filename></entry>
|
||||
<entry>所有对 Subversion 源码仓库中早期
|
||||
<filename>stable</filename> 分支的改变记录</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>&a.svn-src-svnadmin.name;</entry>
|
||||
<entry><filename>/usr/src</filename></entry>
|
||||
<entry>所有对 Subversion 源码仓库中管理用脚本, hook
|
||||
和其他配置数据的改变记录</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>&a.svn-src-user.name;</entry>
|
||||
<entry><filename>/usr/src</filename></entry>
|
||||
<entry>所有对 Subversion 源码仓库中有关
|
||||
<filename>user</filename> 部分的改变记录</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>&a.svn-src-vendor.name;</entry>
|
||||
<entry><filename>/usr/src</filename></entry>
|
||||
<entry>所有对 Subversion 源码仓库中有关
|
||||
vender 部分的改变记录</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
|
@ -1363,6 +1450,20 @@
|
|||
你也能从那里找到更多的例子和以往的报告。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>&a.xen.name;</term>
|
||||
|
||||
<listitem>
|
||||
<para><emphasis>讨论 &os; 有关 &xen; 上的移植
|
||||
— 实现和使用</emphasis></para>
|
||||
|
||||
<para>这个邮件列表集中讨论 &os; 的 &xen; 移植。
|
||||
预期的流量会很小,所以这个列表旨在同时为
|
||||
设计与实现细节的技术讨论和管理部属问题
|
||||
提供一个讨论的场所。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</sect2>
|
||||
<sect2 id="eresources-mailfiltering">
|
||||
|
@ -1622,7 +1723,7 @@
|
|||
<row>
|
||||
<entry>ukug.uk.FreeBSD.org</entry>
|
||||
<entry>Forwarding only</entry>
|
||||
<entry><email>freebsd-users@uk.FreeBSD.org</email></entry>
|
||||
<entry><email>ukfreebsd@uk.FreeBSD.org</email></entry>
|
||||
<entry>Lee Johnston
|
||||
<email>lee@uk.FreeBSD.org</email></entry>
|
||||
</row>
|
||||
|
@ -1630,36 +1731,6 @@
|
|||
</tgroup>
|
||||
</informaltable>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="eresources-shell">
|
||||
<title>Shell账号</title>
|
||||
|
||||
<para>下面的用户组为积极支持FreeBSD的人们提供了shell账号。如果他被滥用的话,
|
||||
这个列表的管理员有撤销的权利。 </para>
|
||||
|
||||
<informaltable frame="none" pgwide="1">
|
||||
<tgroup cols="4">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>主机</entry>
|
||||
<entry>访问</entry>
|
||||
<entry>工具</entry>
|
||||
<entry>管理员</entry>
|
||||
</row>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>dogma.freebsd-uk.eu.org</entry>
|
||||
<entry>Telnet/FTP/SSH</entry>
|
||||
<entry>Email, Web space, Anonymous FTP</entry>
|
||||
<entry>Lee Johnston
|
||||
<email>lee@uk.FreeBSD.org</email></entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</sect1>
|
||||
</appendix>
|
||||
|
||||
<!--
|
||||
|
|
18
zh_CN.GB2312/books/handbook/filesystems/Makefile
Normal file
18
zh_CN.GB2312/books/handbook/filesystems/Makefile
Normal file
|
@ -0,0 +1,18 @@
|
|||
#
|
||||
# Build the Handbook with just the content from this chapter.
|
||||
#
|
||||
# The FreeBSD Simplified Chinese Project
|
||||
# Original Revision: 1.1
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
CHAPTERS= filesystems/chapter.sgml
|
||||
|
||||
VPATH= ..
|
||||
|
||||
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
|
||||
|
||||
DOC_PREFIX?= ${.CURDIR}/../../../..
|
||||
|
||||
.include "../Makefile"
|
572
zh_CN.GB2312/books/handbook/filesystems/chapter.sgml
Normal file
572
zh_CN.GB2312/books/handbook/filesystems/chapter.sgml
Normal file
|
@ -0,0 +1,572 @@
|
|||
<!--
|
||||
The FreeBSD Documentation Project
|
||||
Original Revision: 1.4
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
<chapter id="filesystems">
|
||||
<chapterinfo>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Tom</firstname>
|
||||
<surname>Rhodes</surname>
|
||||
<contrib>Written by </contrib>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</chapterinfo>
|
||||
|
||||
<title>文件系统 Support</title>
|
||||
|
||||
<sect1 id="filesystems-synopsis">
|
||||
<title>概述</title>
|
||||
|
||||
<indexterm><primary>File Systems</primary></indexterm>
|
||||
<indexterm>
|
||||
<primary>File Systems Support</primary>
|
||||
<see>File Systems</see>
|
||||
</indexterm>
|
||||
|
||||
<para>文件系统对于任何操作系统来说都是一个不可缺的部分。
|
||||
它们允许用户上载和存储文件,提供对数据的访问,当然,
|
||||
是使硬盘能具有实际的用途。不同的操作系统通常都有一个共同的主要方面,
|
||||
那就是它们原生的文件系统。在 &os;
|
||||
上这个文件系统通常被称为快速文件系统或者 <acronym>FFS</acronym>,
|
||||
这是基于原来的 Unix™ 文件系统,通常也被称为
|
||||
<acronym>UFS</acronym>。 这是 &os;
|
||||
用于在磁盘上访问数据的原生的文件系统。</para>
|
||||
|
||||
<para>&os; 也支持数量繁多的不同的文件系统,
|
||||
用于提供本地从其他操作系统上访问数据的支持,
|
||||
那些就是指存放在本地挂载的 <acronym>USB</acronym>
|
||||
存储设备,闪存设备和硬盘上的数据。还支持一些非原生的文件系统。
|
||||
这些文件系统是在其他的操作系统上开发的,像 &linux;
|
||||
的扩展文件系统 (<acronym>EXT</acronym>),和 &sun;
|
||||
的 Z 文件系统 (<acronym>ZFS</acronym>)。</para>
|
||||
|
||||
<para>&os; 上对于各种文件系统的支持分成不同的层次。
|
||||
一些要求加载内核模块,另外的可能要求安装一系列的工具。
|
||||
这一章节旨在帮助 &os; 用户在他们的系统上访问其他的文件系统,
|
||||
由 &sun; 的 Z 文件系统开始。</para>
|
||||
|
||||
<para>在阅读了这一章节之后,你将了解:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>原生与被支持的文件系统之间的区别。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>&os; 支持哪些文件系统。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>如何起用,配置,访问和使用非原生的文件系统。</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<para>在阅读这章以前,你应该:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>了解 &unix; 和 &os; 基本知识
|
||||
(<xref linkend="basics">)。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>熟悉基本的内核配置/编译方法
|
||||
(<xref linkend="kernelconfig">)。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>熟悉在 &os; 上安装第三方软件
|
||||
(<xref linkend="ports">)。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>熟悉 &os; 上的磁盘,存储和设备名
|
||||
(<xref linkend="disks">)。</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<!--
|
||||
Temporary warning to avoid listing experimental versions
|
||||
and production versions of FreeBSD with this technology.
|
||||
-->
|
||||
<warning>
|
||||
<para><acronym>ZFS</acronym> 特性目前仍被认为是试验性的。
|
||||
有些选项功能性缺失,另有一些可能还无法运行。最终,
|
||||
这个特性会适合用于生产,届时这篇文档也会做些适当的修改。</para>
|
||||
</warning>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="filesystems-zfs">
|
||||
<title>Z 文件系统</title>
|
||||
|
||||
<para>Z 文件系统是由 &sun; 开发使用存储池方法的新技术。
|
||||
这就是说只有在需要存储数据的时候空间才会被使用。
|
||||
它也为保护数据最大完整性而设计的,支持数据快照,
|
||||
多份拷贝和数据校验。增加了被称为 <acronym>RAID</acronym>-Z
|
||||
的新的数据复制类型。<acronym>RAID</acronym>-Z 是种类似于
|
||||
<acronym>RAID</acronym>5类型, 但被设计成防止写入漏洞。<para>
|
||||
|
||||
<sect2>
|
||||
<title>调整 ZFS</title>
|
||||
|
||||
<para><acronym>ZFS</acronym> 子系统需利用到大量的系统资源,
|
||||
所以可能需要一些调校来为日常应用提供最大化的效能。
|
||||
作为 &os; 的一项试验性的特性,这可能在不久的将来有所变化;
|
||||
无论如何,下面的这些步骤是我们推荐的:</para>
|
||||
|
||||
<sect3>
|
||||
<title>内存</title>
|
||||
|
||||
<para>总共的系统内存至少应有 1GB,推荐 2GB 或者更多。
|
||||
在此处所有的例子中,我们使用了 1GB
|
||||
内存的系统并配合了一些恰当的调校。</para>
|
||||
|
||||
<para>有些人在少于 1GB 内存的环境有幸正常使用,
|
||||
但是在这样有限的物理内存的条件下,当系统的负载很高时,
|
||||
&os; 极有可能因于内存耗尽而崩溃。</para>
|
||||
</sect3>
|
||||
|
||||
<sect3>
|
||||
<title>内核配置</title>
|
||||
|
||||
<para>我们建议把未使用的驱动和选项从内核配置文件中去除。
|
||||
既然大部份的驱动都有以模块的形式存在,它们就可以很容易的通过
|
||||
<filename>/boot/loader.conf</filename> 加载。</para>
|
||||
|
||||
<para>i386 构架的用户应在内核配置文件中加入以下的选项,
|
||||
重新编译内核并重启机器:</para>
|
||||
|
||||
<programlisting>options KVA_PAGES=512</programlisting>
|
||||
|
||||
<para>这个选项将扩展内核的地址空间, 因而允许
|
||||
<varname>vm.kvm_size</varname> 能够超越 1 GB
|
||||
的限制(<acronym>PAE</acronym>为 2 GB)。
|
||||
为了找出这个选项最合适的值,
|
||||
把以兆(MB)为单位所需的地址空间除以 4 得到。
|
||||
在这个例子中,<literal>512</literal> 则为 2 GB。</para>
|
||||
</sect3>
|
||||
|
||||
<sect3>
|
||||
<title>Loader 可调参数</title>
|
||||
|
||||
<para>所有构架上 &os; 都应该加大 <devicename>kmem</devicename>
|
||||
地址空间。在有 1GB 物理内存的测试系统上,在
|
||||
<filename>/boot/loader.conf</filename>
|
||||
中加入如下的参数并且重启后通过了测试。</para>
|
||||
|
||||
<programlisting>vm.kmem_slze="330M"
|
||||
vm.kmem_size_max="330M"
|
||||
vfs.zfs.arc_max="40M"
|
||||
vfs.zfs.vdev.cache.size="5M"</programlisting>
|
||||
|
||||
<para>更多 ZFS 相关推荐调校的细节请参阅
|
||||
<ulink url="http://wiki.freebsd.org/ZFSTuningGuide"></ulink>.</para>
|
||||
</sect3>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>使用 <acronym>ZFS</acronym></title>
|
||||
|
||||
<para>&os; 有一种启动机制能在系统初始化时挂在
|
||||
<acronym>ZFS</acronym> 存储池。
|
||||
可以通过以下的命令设置:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>echo 'zfs_enable="YES"' >> /etc/rc.conf</userinput>
|
||||
&prompt.root; <userinput>/etc/rc.d/zfs start</userinput></screen>
|
||||
|
||||
<para>这份文档剩余的部分假定系统中有2块
|
||||
<acronym>SCSI</acronym> 磁盘可用,
|
||||
它们的设备名分别为
|
||||
<devicename><replaceable>da0</replaceable></devicename>
|
||||
和 <devicename><replaceable>da1</replaceable></devicename>。
|
||||
<acronym>IDE</acronym> 硬件的用户可以使用
|
||||
<devicename><replaceable>ad</replaceable></devicename>
|
||||
代替 <acronym>SCSI</acronym>。</para>
|
||||
<sect3>
|
||||
<title>单个磁盘存储池</title>
|
||||
|
||||
<para>在单个磁盘上创建 <acronym>ZFS</acronym>,
|
||||
使用 <command>zpool</command> 命令:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zpool create example /dev/da0</userinput></screen>
|
||||
|
||||
<para>可以通过 <command>df</command>
|
||||
的输出查看新的存储池:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>df</userinput>
|
||||
Filesystem 1K-blocks Used Avail Capacity Mounted on
|
||||
/dev/ad0s1a 2026030 235230 1628718 13% /
|
||||
devfs 1 1 0 100% /dev
|
||||
/dev/ad0s1d 54098308 1032846 48737598 2% /usr
|
||||
example 17547136 0 17547136 0% /example</screen>
|
||||
|
||||
<para>这份输出清楚的表明了 <literal>example</literal>
|
||||
存储池不仅创建成功而且被 <emphasis>挂载</emphasis> 了。
|
||||
我们能像访问普通的文件系统那样访问它,
|
||||
就像以下例子中演示的那样,用户能够在上面创建文件并浏览:</para>
|
||||
|
||||
<screen>&prompt.root <userinput>cd /example</userinput>
|
||||
&prompt.root; <userinput>ls</userinput>
|
||||
&prompt.root; <userinput>touch testfile</userinput>
|
||||
&prompt.root; <userinput>ls -al</userinput>
|
||||
total 4
|
||||
drwxr-xr-x 2 root wheel 3 Aug 29 23:15 .
|
||||
drwxr-xr-x 21 root wheel 512 Aug 29 23:12 ..
|
||||
-rw-r--r-- 1 root wheel 0 Aug 29 23:15 testfile</screen>
|
||||
|
||||
<para>遗憾的是这个存储池并没有利用到
|
||||
<acronym>ZFS</acronym> 的任何特性。
|
||||
在这个存储池上创建一个文件系统,并启用压缩:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zfs create example/compressed</userinput>
|
||||
&prompt.root; <userinput>zfs set compression=gzip example/compressed</userinput></screen>
|
||||
|
||||
<para>现在 <literal>example/compressed</literal>
|
||||
是一个启用了压缩的 <acronym>ZFS</acronym> 文件系统了。
|
||||
可以尝试复制一些大的文件到
|
||||
<filename class="directory">/example/compressed</filename>。</para>
|
||||
|
||||
<para>使用这个命令可以禁用压缩:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zfs set compression=off example/compressed</userinput></screen>
|
||||
|
||||
<para>使用如下的命令卸载这个文件系统,并用
|
||||
<command>df</command> 工具确认:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zfs umount example/compressed</userinput>
|
||||
&prompt.root; <userinput>df</userinput>
|
||||
Filesystem 1K-blocks Used Avail Capacity Mounted on
|
||||
/dev/ad0s1a 2026030 235232 1628716 13% /
|
||||
devfs 1 1 0 100% /dev
|
||||
/dev/ad0s1d 54098308 1032864 48737580 2% /usr
|
||||
example 17547008 0 17547008 0% /example</screen>
|
||||
|
||||
<para>重新挂在这个文件系统使之能被访问,
|
||||
并用 <command>df</command> 确认:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zfs mount example/compressed</userinput>
|
||||
&prompt.root; <userinput>df</userinput>
|
||||
Filesystem 1K-blocks Used Avail Capacity Mounted on
|
||||
/dev/ad0s1a 2026030 235234 1628714 13% /
|
||||
devfs 1 1 0 100% /dev
|
||||
/dev/ad0s1d 54098308 1032864 48737580 2% /usr
|
||||
example 17547008 0 17547008 0% /example
|
||||
example/compressed 17547008 0 17547008 0% /example/compressed</screen>
|
||||
|
||||
<para>存储池与文件系统也可通过 <command>mount</command>
|
||||
的输出查看:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>mount</userinput>
|
||||
/dev/ad0s1a on / (ufs, local)
|
||||
devfs on /dev (devfs, local)
|
||||
/dev/ad0s1d on /usr (ufs, local, soft-updates)
|
||||
example on /example (zfs, local)
|
||||
example/data on /example/data (zfs, local)
|
||||
example/compressed on /example/compressed (zfs, local)</screen>
|
||||
|
||||
<para>正如前面所提到的,<acronym>ZFS</acronym> 文件系统,
|
||||
在创建之后就能像普通的文件系统那样使用。然而,
|
||||
还有很多其他的特性是可用的。在下面的例子中,
|
||||
我们将创建一个新的文件系统,<literal>data</literal>。
|
||||
并要在上面存储些重要的文件,
|
||||
所以文件系统需要被设置成把每一个数据块都保存两份拷贝:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zfs create example/data</userinput>
|
||||
&prompt.root; <userinput>zfs set copies=2 example/data</userinput></screen>
|
||||
|
||||
<para>现在可以再次使用 <command>df</command>
|
||||
查看数据和空间的使用状况:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>df</userinput>
|
||||
Filesystem 1K-blocks Used Avail Capacity Mounted on
|
||||
/dev/ad0s1a 2026030 235234 1628714 13% /
|
||||
devfs 1 1 0 100% /dev
|
||||
/dev/ad0s1d 54098308 1032864 48737580 2% /usr
|
||||
example 17547008 0 17547008 0% /example
|
||||
example/compressed 17547008 0 17547008 0% /example/compressed
|
||||
example/data 17547008 0 17547008 0% /example/data</screen>
|
||||
|
||||
<para>请注意存储池上的每一个文件系统都有着相同数量的可用空间。
|
||||
这就是我们在这些例子中使用 <command>df</command> 的原因,
|
||||
是为了文件系统都是从相同的存储池取得它们所需的空间。
|
||||
<acronym>ZFS</acronym> 去掉了诸如卷和分区此类的概念,
|
||||
并允许多个文件系统占用同一个存储池。
|
||||
不再需要文件系统与存储池的时候能像这样销毁它们:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zfs destroy example/compressed</userinput>
|
||||
&prompt.root; <userinput>zfs destroy example/data</userinput>
|
||||
&prompt.root; <userinput>zpool destroy example</userinput></screen>
|
||||
|
||||
<para>磁盘无法避免的会坏掉和停止运转。
|
||||
当这块磁盘坏掉的时候,上面的数据都将丢失。
|
||||
一个避免因磁盘损坏而丢失数据的方法是使用
|
||||
<acronym>RAID</acronym>。<acronym>ZFS</acronym>
|
||||
在它的存储池设计中支持这样的特性,
|
||||
这便是下一节将探讨的。</para>
|
||||
|
||||
</sect3>
|
||||
|
||||
<sect3>
|
||||
<title><acronym>ZFS</acronym> RAID-Z</title>
|
||||
|
||||
<para>正如前文中所提到的,这一章节将假设存在两个
|
||||
<acronym>SCSI</acronym> 设备,
|
||||
<devicename>da0</devicename> 和
|
||||
<devicename>da1</devicename>。
|
||||
使用如下的命令创建一个 <acronym>RAID</acronym>-Z
|
||||
存储池:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zpool create storage raidz da0 da1</userinput></screen>
|
||||
|
||||
<para>zpool <literal>storage</literal> 至此就创建好了。
|
||||
可以如前文提到的那样使用 &man.mount.8; 和 &man.df.1; 确认。
|
||||
如需配给更多的磁盘设备则把它们加这个列表的后面。
|
||||
在存储池上创建一个叫 <literal>home</literal> 的文件系统,
|
||||
用户的文件最终都将被保存在上面:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zfs create storage/home</userinput></screen>
|
||||
|
||||
<para>像前文中提到的那样,用户的目录与文件也可启用压缩并保存多份拷贝,
|
||||
可通过如下的命令完成:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zfs set copies=2 storage/home</userinput>
|
||||
&prompt.root; <userinput>zfs set compression=gzip storage/home</userinput></screen>
|
||||
|
||||
<para>把用户的数据都拷贝过来并创建一个符号链接,
|
||||
让他们开始使用这个新的目录:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>cp -rp /home/* /storage/home</userinput>
|
||||
&prompt.root; <userinput>rm -rf /home /usr/home</userinput>
|
||||
&prompt.root; <userinput>ln -s /storage/home /home</userinput>
|
||||
&prompt.root; <userinput>ln -s /storage/home /usr/home</userinput></screen>
|
||||
|
||||
<para>现在用户的数据应该都保存在新创建的
|
||||
<filename class="directory">/storage/home</filename>
|
||||
上了。 测试添加一个新用户并以这个身份登录。</para>
|
||||
|
||||
<para>尝试创建一个可日后用来回退的快照:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zfs snapshot storage/home@08-30-08</userinput></screen>
|
||||
|
||||
<para>请注意快照选项将只会抓取一个真实的文件系统,
|
||||
而不是某个用户目录或文件。<literal>@</literal>
|
||||
字符为文件系统名或卷名的分隔符。
|
||||
当用户目录被损坏时,可用如下命令恢复:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zfs rollback storage/home@08-30-08</userinput></screen>
|
||||
|
||||
<para>获得所有可用快照的列表,可使用
|
||||
<command>ls</command> 命令查看文件系统的
|
||||
<filename class="directory">.zfs/snapshot</filename>
|
||||
目录。例如,执行如下命令来查看之前抓取的快照:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>ls /storage/home/.zfs/snapshot</userinput></screen>
|
||||
|
||||
<para>可以编写一个脚本来每月定期抓取用户数据的快照,久而久之,
|
||||
快照可能消耗掉大量的磁盘空间。
|
||||
之前创建的快照可用以下命令删除:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zfs destroy storage/home@08-30-08</userinput></screen>
|
||||
|
||||
<para>在所有这些测试之后,我们没有理由再把
|
||||
<filename class="directory">/store/home</filename>
|
||||
这样放置了。让它称为真正的
|
||||
<filename class="directory">/home</filename>
|
||||
文件系统:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zfs set mountpoint=/home storage/home</userinput></screen>
|
||||
|
||||
<para>使用 <command>df</command> 和
|
||||
<command>mount</command>
|
||||
命令将显示现在系统把我们的文件系统真正当作了
|
||||
<filename class="directory">/home</filename>:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>mount</userinput>
|
||||
/dev/ad0s1a on / (ufs, local)
|
||||
devfs on /dev (devfs, local)
|
||||
/dev/ad0s1d on /usr (ufs, local, soft-updates)
|
||||
storage on /storage (zfs, local)
|
||||
storage/home on /home (zfs, local)
|
||||
&prompt.root; <userinput>df</userinput>
|
||||
Filesystem 1K-blocks Used Avail Capacity Mounted on
|
||||
/dev/ad0s1a 2026030 235240 1628708 13% /
|
||||
devfs 1 1 0 100% /dev
|
||||
/dev/ad0s1d 54098308 1032826 48737618 2% /usr
|
||||
storage 17547008 0 17547008 0% /storage
|
||||
storage/home 17547008 0 17547008 0% /home</screen>
|
||||
|
||||
<para>这样就基本完成了 <acronym>RAID</acronym>-Z
|
||||
的配置了。使用夜间 &man.periodic.8;
|
||||
获取有关文件系统创建之类的状态更新,
|
||||
执行如下的命令:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>echo 'daily_status_zfs_enable="YES"' >> /etc/periodic.conf</userinput></screen>
|
||||
</sect3>
|
||||
|
||||
<sect3>
|
||||
<title>修复 <acronym>RAID</acronym>-Z</title>
|
||||
|
||||
<para>每一种软 <acronym>RAID</acronym>
|
||||
都有监测它们 <literal>状态</literal> 的方法。
|
||||
<acronym>ZFS</acronym> 也不例外。
|
||||
可以使用如下的命令查看 <acronym>RAID</acronym>-Z
|
||||
设备:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zpool status -x</userinput></screen>
|
||||
|
||||
<para>如果所有的存储池处于健康状态并且一切正常的话,
|
||||
将返回如下信息:</para>
|
||||
|
||||
<screen>all pools are healthy</screen>
|
||||
|
||||
<para>如果存在问题,可能是一个磁盘设备下线了,
|
||||
那么返回的存储池的状态将看上去是类似这个样子的:</para>
|
||||
|
||||
<screen> pool: storage
|
||||
state: DEGRADED
|
||||
status: One or more devices has been taken offline by the administrator.
|
||||
Sufficient replicas exist for the pool to continue functioning in a
|
||||
degraded state.
|
||||
action: Online the device using 'zpool online' or replace the device with
|
||||
'zpool replace'.
|
||||
scrub: none requested
|
||||
config:
|
||||
|
||||
NAME STATE READ WRITE CKSUM
|
||||
storage DEGRADED 0 0 0
|
||||
raidz1 DEGRADED 0 0 0
|
||||
da0 ONLINE 0 0 0
|
||||
da1 OFFLINE 0 0 0
|
||||
|
||||
errors: No known data errors</screen>
|
||||
|
||||
<para>在这个例子中,这是由管理员把此设备下线后的状态。
|
||||
可以使用如下的命令将磁盘下线:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zpool offline storage da1</userinput></screen>
|
||||
|
||||
<para>现在切断系统电源之后就可以替换下
|
||||
<devicename>da1</devicename> 了。
|
||||
当系统再次上线时,使用如下的命令替换磁盘:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zpool replace storage da1</userinput></screen>
|
||||
|
||||
<para>至此可用不带 <option>-x</option>
|
||||
标志的命令再次检查状态:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zpool status storage</userinput>
|
||||
pool: storage
|
||||
state: ONLINE
|
||||
scrub: resilver completed with 0 errors on Sat Aug 30 19:44:11 2008
|
||||
config:
|
||||
|
||||
NAME STATE READ WRITE CKSUM
|
||||
storage ONLINE 0 0 0
|
||||
raidz1 ONLINE 0 0 0
|
||||
da0 ONLINE 0 0 0
|
||||
da1 ONLINE 0 0 0
|
||||
|
||||
errors: No known data errors</screen>
|
||||
|
||||
<para>在这个例子中,一切都显示正常。</para>
|
||||
</sect3>
|
||||
|
||||
<sect3>
|
||||
<title>数据校验</title>
|
||||
|
||||
<para>正如前面所提到的,<acronym>ZFS</acronym>
|
||||
使用 <literal>校验和</literal>(checksum) 来检查存储数据的完整性。
|
||||
这时在文件系统创建时自动启用的,可使用以下的命令禁用:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zfs set checksum=off storage/home</userinput></screen>
|
||||
|
||||
<para>这不是个明智的选择,因为校验和
|
||||
不仅非常有用而且只需占用少量的存储空间。
|
||||
并且启用它们也不会明显的消耗过多资源。
|
||||
启用后就可以让 <acronym>ZFS</acronym>
|
||||
使用校验和校验来检查数据的完整。
|
||||
这个过程通常称为 <quote>scrubbing</quote>。
|
||||
可以使用以下的命令检查 <literal>storage</literal>
|
||||
存储池里数据的完整性:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zpool scrub storage</userinput></screen>
|
||||
|
||||
<para>这个过程需花费相当长的时间,取决于存储的数据量。
|
||||
而且 <acronym>I/O</acronym> 非常密集,
|
||||
所以在任何时间只能执行一个这样的操作。
|
||||
在 scrub 完成之后,状态就会被更新,
|
||||
可使用如下的命令查看:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>zpool status storage</userinput>
|
||||
pool: storage
|
||||
state: ONLINE
|
||||
scrub: scrub completed with 0 errors on Sat Aug 30 19:57:37 2008
|
||||
config:
|
||||
|
||||
NAME STATE READ WRITE CKSUM
|
||||
storage ONLINE 0 0 0
|
||||
raidz1 ONLINE 0 0 0
|
||||
da0 ONLINE 0 0 0
|
||||
da1 ONLINE 0 0 0
|
||||
|
||||
errors: No known data errors</screen>
|
||||
|
||||
<para>这个例子中完成时间非常的清楚。
|
||||
这个特性可以帮助你在很长的一段时间内确保数据的完整。</para>
|
||||
|
||||
<para>Z 文件系统有更多的选项,请参阅
|
||||
&man.zfs.8; 和 &man.zpool.8; 手册页。</para>
|
||||
</sect3>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
|
||||
<!--
|
||||
XXXTR: stub sections (added later, as needed, as desire,
|
||||
after I get opinions from -doc people):
|
||||
|
||||
Still need to discuss native and foreign file systems.
|
||||
|
||||
<sect1>
|
||||
<title>Device File System</title>
|
||||
</sect1>
|
||||
|
||||
<sect1>
|
||||
<title>DOS and NTFS File Systems</title>
|
||||
<para>This is a good section for those who transfer files, using
|
||||
USB devices, from Windows to FreeBSD and vice-versa. My camera,
|
||||
and many other cameras I have seen default to using FAT16. There
|
||||
is (was?) a kde utility, I think called kamera, that could be used
|
||||
to access camera devices. A section on this would be useful.</para>
|
||||
|
||||
<para>XXXTR: Though! The disks chapter, covers a bit of this and
|
||||
devfs under it's USB devices. It leaves a lot to be desired though,
|
||||
see:
|
||||
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/usb-disks.html
|
||||
It may be better to flesh out that section a bit more. Add the
|
||||
word "camera" to it so that others can easily notice.</para>
|
||||
</sect1>
|
||||
|
||||
<sect1>
|
||||
<title>Linux EXT 文件系统</title>
|
||||
|
||||
<para>Probably NOT as useful as the other two, but it requires
|
||||
knowledge of the existence of the tools. Which are hidden in
|
||||
the ports collection. Most Linux guys would probably only use
|
||||
Linux, BSD guys would be smarter and use NFS.</para>
|
||||
</sect1>
|
||||
|
||||
<sect1>
|
||||
<title>HFS</title>
|
||||
|
||||
<para>I think this is the file system used on Apple OSX. There are
|
||||
tools in the ports collection, and with Apple being a big
|
||||
FreeBSD supporter and user of our technologies, surely there
|
||||
is enough cross over to cover this?</para>
|
||||
</sect1>
|
||||
-->
|
||||
|
||||
</chapter>
|
|
@ -2,7 +2,7 @@
|
|||
The FreeBSD Documentation Project
|
||||
The FreeBSD Simplified Chinese Project
|
||||
|
||||
Original Revision: 1.42
|
||||
Original Revision: 1.43
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
|
@ -217,132 +217,122 @@ XXX: What message? Put it inside the screen output above.
|
|||
<primary>磁盘镜像</primary>
|
||||
</indexterm>
|
||||
|
||||
<para>镜像是一种许多公司和家庭用户使用的不需中断的备份技术。
|
||||
当存在镜像时, 它的意思是说 磁盘B 简单地复制 磁盘A。
|
||||
或者, 也可能是 磁盘C+D
|
||||
复制 磁盘A+B。 无论磁盘如何配置, 共同的特征,
|
||||
都是磁盘或卷的信息会被复制。 随后,在无需中断服务或访问的情况下,
|
||||
可以很容易地复原和备份这些信息, 甚至把它们存储到其他更安全的地方。</para>
|
||||
<para>镜像是许多公司和家庭用户使用的一种无须中断的备份技术。
|
||||
简单地说, 镜像的概念就是 磁盘B 是同步复制 (replicate) 的 磁盘A 的副本, 或者 磁盘C+D
|
||||
是 diskA+B 的同步复制副本, 等等。 无论磁盘配置如何,
|
||||
这种技术的共同特点都是一块磁盘或分区的内容会同步复制到另外的地方。
|
||||
这样, 除了能够很容易地恢复信息之外,
|
||||
还能够在无须中断服务或访问的情况下进行备份,
|
||||
甚至直接将副本送到数据保安公司异地储存。</para>
|
||||
|
||||
<para>要开始做这件事, 首先要确保系统中有两个同样大的磁盘驱动器,
|
||||
下面的例子假定使用直接访问方式 (Direct Access, &man.da.4;)
|
||||
<acronym>SCSI</acronym> 的磁盘。</para>
|
||||
<para>在开始做这件事之前, 首先请准备两个容量相同的磁盘驱动器,
|
||||
下面的例子假定它们都是使用直接访问方式 (Direct Access, &man.da.4;) 的
|
||||
<acronym>SCSI</acronym> 磁盘。</para>
|
||||
|
||||
<para>首先需要把 &os; 安装到第一块磁盘上, 并建立两个分区。
|
||||
第一个分区将成为交换区, 其尺寸应该是两倍的
|
||||
<acronym>RAM</acronym> 尺寸, 而余下的空间,
|
||||
则作为根 (<filename class="directory">/</filename>) 文件系统来使用。
|
||||
当然, 也可以为其他挂接点划分不同的分区;
|
||||
但是, 这将使难度提高一个量级,
|
||||
因为您将不得不手工修改 &man.bsdlabel.8; 和 &man.fdisk.8;
|
||||
的设置。</para>
|
||||
<sect2>
|
||||
<title>对主磁盘进行镜像</title>
|
||||
|
||||
<para>重新启动系统, 并等待其完全初始化完。
|
||||
当这个过程完成之后, 以 <username>root</username>
|
||||
用户的身份登录。</para>
|
||||
<para>假定您现有系统中的 &os; 安装到了第一个, 也就是
|
||||
<devicename>da0</devicename> 盘上, 则应告诉 &man.gmirror.8;
|
||||
将主要数据保存在这里。</para>
|
||||
|
||||
<para>创建 <filename>/dev/mirror/gm</filename> 设备,
|
||||
并将其连接到 <filename>/dev/da1</filename>:</para>
|
||||
<para>在开始构建镜像卷之前, 可以启用更多的调试信息,
|
||||
并应开放对设备的完全访问。 这可以通过将 &man.sysctl.8; 变量
|
||||
<varname>kern.geom.debugflags</varname>
|
||||
设置为下面的值来实现:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>gmirror label -vnb round-robin gm0 /dev/da1</userinput></screen>
|
||||
<screen>&prompt.root; <userinput>sysctl kern.geom.debugflags=17</userinput></screen>
|
||||
|
||||
<para>系统应会给出下列回应:</para>
|
||||
<screen>
|
||||
Metadata value stored on /dev/da1.
|
||||
<para>接下来需要创建镜像。 这个过程的第一步是在主磁盘上保存元数据信息,
|
||||
也就是用下面的命令来创建
|
||||
<filename class="devicefile">/dev/mirror/gm</filename> 设备:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>gmirror label -vb round-robin gm0 /dev/da0</userinput></screen>
|
||||
|
||||
<para>系统应给出下面的回应:</para>
|
||||
|
||||
<screen>Metadata value stored on /dev/da0.
|
||||
Done.</screen>
|
||||
|
||||
<para>初始化 GEOM, 这将加载
|
||||
<filename>/boot/kernel/geom_mirror.ko</filename> 内核模块:</para>
|
||||
<para>初始化 GEOM, 这步操作会加载内核模块
|
||||
<filename>/boot/kernel/geom_mirror.ko</filename>:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>gmirror load</userinput></screen>
|
||||
<screen>&prompt.root; <userinput>gmirror load</userinput></screen>
|
||||
|
||||
<note>
|
||||
<para>这个命令应该会在
|
||||
<filename class="directory">/dev/mirror</filename>
|
||||
目录中创建
|
||||
<devicename>gm0</devicename> 设备节点。</para>
|
||||
</note>
|
||||
<note>
|
||||
<para>当这个命令运行完之后, 系统会在
|
||||
<filename class="directory">/dev/mirror</filename>
|
||||
目录中创建设备节点
|
||||
<devicename>gm0</devicename>。</para>
|
||||
</note>
|
||||
|
||||
<para>在刚创建的 <devicename>gm0</devicename>
|
||||
设备上安装通用的 <command>fdisk</command> 标签以及引导区代码:</para>
|
||||
<para>配置在系统初始化过程中自动加载 <filename>geom_mirror.ko</filename>:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>fdisk -vBI /dev/mirror/gm0</userinput></screen>
|
||||
<screen>&prompt.root; <userinput>echo 'geom_mirror_load="YES"' >> /boot/loader.conf</userinput></screen>
|
||||
|
||||
<para>接下来安装通用的 <command>bsdlabel</command>
|
||||
信息:</para>
|
||||
<para>编辑 <filename>/etc/fstab</filename> 文件,
|
||||
将其中先前的 <devicename>da0</devicename> 改为新的镜像设备
|
||||
<devicename>gm0</devicename>。 以 <username>root</username> 用户身份编辑
|
||||
<filename>/etc/fstab</filename>:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>bsdlabel -wB /dev/mirror/gm0s1</userinput></screen>
|
||||
<screen>&prompt.root; <userinput>vi /etc/fstab</userinput></screen>
|
||||
|
||||
<note>
|
||||
<para>如果存在多个区段 (slice) 或分区 (partition),
|
||||
则需要修改一部分上面命令的参数。
|
||||
它们必须与另一个盘上对应的区段和分区匹配。</para>
|
||||
</note>
|
||||
<para>在 &man.vi.1; 中备份现有的
|
||||
<filename>fstab</filename> 内容, 具体操作是
|
||||
<userinput>:w /etc/fstab.bak</userinput>。 接着,
|
||||
把所有旧的 <devicename>da0</devicename> 替换成 <devicename>gm0</devicename>,
|
||||
也就是输入命令
|
||||
<userinput>:%s/da/mirror\/gm/g</userinput>。<para>
|
||||
|
||||
<para>使用 &man.newfs.8; 工具来在 <devicename>gm0s1a</devicename>
|
||||
设备上建立默认的 <acronym>UFS</acronym>
|
||||
文件系统:</para>
|
||||
<para>修改完后的 <filename>fstab</filename> 文件应该是下面的样子。
|
||||
磁盘驱动器是 <acronym>SCSI</acronym> 或 <acronym>ATA</acronym>
|
||||
甚至 <acronym>RAID</acronym> 都没有关系, 最终的结果都是
|
||||
<devicename>gm</devicename>。</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>newfs -U /dev/mirror/gm0s1a</userinput></screen>
|
||||
<programlisting># Device Mountpoint FStype Options Dump Pass#
|
||||
/dev/mirror/gm0s2b none swap sw 0 0
|
||||
/dev/mirror/gm0s2a / ufs rw 1 1
|
||||
#/dev/mirror/gm0s2d /store ufs rw 2 2
|
||||
/dev/mirror/gm0s2e /usr ufs rw 2 2
|
||||
/dev/acd0 /cdrom cd9660 ro,noauto 0 0</programlisting>
|
||||
|
||||
<para>这将让系统输出很多信息和一系列数字。 不必为此担心,
|
||||
只需看看是否有错误提示就可以了, 如果没问题, 接下来把它挂到
|
||||
<filename class="directory">/mnt</filename> 挂接点上面:</para>
|
||||
<para>重启系统:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>mount /dev/mirror/gm0s1a /mnt</userinput></screen>
|
||||
<screen>&prompt.root; <userinput>shutdown -r now</userinput></screen>
|
||||
|
||||
<para>现在需要把所有引导盘上的数据迁移到新的文件系统上了。
|
||||
下面的例子使用了 &man.dump.8; 和 &man.restore.8;
|
||||
这两个命令; 不过, 用 &man.dd.1; 在这里也可以达到完全一样的目的。</para>
|
||||
<para>在系统初始化过程中, 新建的
|
||||
<devicename>gm0</devicename> 会代替
|
||||
<devicename>da0</devicename> 设备工作。 系统完成初始化之后,
|
||||
可以通过检查 <command>mount</command> 命令的输出来查看效果:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>dump -L -0 -f- / |(cd /mnt && restore -r -v -f-)</userinput></screen>
|
||||
<screen>&prompt.root; <userinput>mount</userinput>
|
||||
Filesystem 1K-blocks Used Avail Capacity Mounted on
|
||||
/dev/mirror/gm0s1a 1012974 224604 707334 24% /
|
||||
devfs 1 1 0 100% /dev
|
||||
/dev/mirror/gm0s1f 45970182 28596 42263972 0% /home
|
||||
/dev/mirror/gm0s1d 6090094 1348356 4254532 24% /usr
|
||||
/dev/mirror/gm0s1e 3045006 2241420 559986 80% /var
|
||||
devfs 1 1 0 100% /var/named/dev</screen>
|
||||
|
||||
<para>这个操作必须在所有文件系统上都作一遍。 您可以将前述命令中的文件系统,
|
||||
改为所希望的文件系统的位置。</para>
|
||||
<para>这个输出是正常的。 最后, 使用下面的命令将 <devicename>da1</devicename>
|
||||
磁盘加到镜像卷中, 以开始同步过程:</para>
|
||||
|
||||
<para>接下来应该编辑复制出来的 <filename>/mnt/etc/fstab</filename>
|
||||
文件, 并删去或注释掉交换文件
|
||||
<footnote>
|
||||
<para>需要注意的是,
|
||||
在 <filename>fstab</filename> 注释掉交换文件,
|
||||
通常会需要您以其他方式重建交换空间。
|
||||
请参见 <xref linkend="adding-swap-space"> 以了解进一步的细节。</para>
|
||||
</footnote>。 修改其他文件系统对应的信息,
|
||||
以便让它们使用新盘。 参考下面的例子:</para>
|
||||
<screen>&prompt.root; <userinput>gmirror insert gm0 /dev/da1</userinput></screen>
|
||||
|
||||
<programlisting># Device Mountpoint FStype Options Dump Pass#
|
||||
#/dev/da0s2b none swap sw 0 0
|
||||
/dev/mirror/gm0s1a / ufs rw 1 1</programlisting>
|
||||
<para>在构建镜像卷的过程中, 可以用下面的命令查看状态:</para>
|
||||
|
||||
<para>用下面的命令来确保系统引导时会加载 <filename>geom_mirror.ko</filename>:</para>
|
||||
<screen>&prompt.root; <userinput>gmirror status</userinput></screen>
|
||||
|
||||
<screen>&prompt.root; <userinput>echo 'geom_mirror_load="YES"' >> /mnt/boot/loader.conf</userinput></screen>
|
||||
<screen>&prompt.root; <userinput>echo 'geom_mirror_load="YES"' >> /boot/loader.conf</userinput></screen>
|
||||
<para>一旦镜像卷的构建操作完成, 这个命令的输出就会变成这样:</para>
|
||||
|
||||
<para>最后重新启动系统:</para>
|
||||
<screen> Name Status Components
|
||||
mirror/gm0 COMPLETE da0
|
||||
da1</screen>
|
||||
|
||||
<screen>&prompt.root; <userinput>shutdown -r now</userinput></screen>
|
||||
|
||||
<para>在启动时选择第 4 个选项进入单用户模式。 在控制台,
|
||||
可以通过 &man.df.1; 的输出来确认系统是从
|
||||
<devicename>gm0s1a</devicename> 启动的。</para>
|
||||
|
||||
<para>如果一切顺利,系统将从 <devicename>gm0s1a</devicename>
|
||||
设备启动。 现在可以使用以下命令清除主磁盘并插入镜像中:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>dd if=/dev/zero of=/dev/da0 bs=512 count=79</userinput></screen>
|
||||
|
||||
<screen>&prompt.root; <userinput>gmirror configure -a gm0</userinput>
|
||||
&prompt.root; <userinput>gmirror insert gm0 /dev/da0</userinput></screen>
|
||||
|
||||
<para>此处 <option>-a</option> 告诉 &man.gmirror.8; 采用自动同步,
|
||||
或换言之: 自动地将磁盘的写操作做镜像处理。 联机手册中详细解释了如何重建,
|
||||
以及替换磁盘, 只不过它用 <devicename>data</devicename>
|
||||
表示这里的 <devicename>gm0</devicename>。</para>
|
||||
|
||||
<para>在镜像建立后,可以用如下命令检查镜像的状态:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>gmirror status</userinput></screen>
|
||||
<para>如果有问题或者构建仍在进行, 输出中的
|
||||
<literal>COMPLETE</literal> 就会是
|
||||
<literal>DEGRADED</literal>。</para>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>故障排除</title>
|
||||
|
@ -371,6 +361,27 @@ OK? <userinput>boot</userinput></screen>
|
|||
<para>然后重新编译和安装内核来解决这个问题。</para>
|
||||
</sect3>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>从磁盘故障中恢复</title>
|
||||
|
||||
<para>磁盘镜像的一大好处是在当其中一个磁盘出现故障时,
|
||||
可以很容易地将其替换掉, 并且通常不会丢失数据。</para>
|
||||
|
||||
<para>考虑前面的 <acronym>RAID</acronym>1
|
||||
配置, 假设 <devicename>da1</devicename>
|
||||
出现了故障并需要替换, 要替换它,
|
||||
首先确定哪个磁盘出现了故障, 并关闭系统。
|
||||
此时, 可以用换上新的磁盘, 并重新启动系统。
|
||||
这之后可以用下面的命令来完成磁盘的替换操作:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>gmirror forget gm0</userinput></screen>
|
||||
|
||||
<screen>&prompt.root; <userinput>gmirror insert gm0 /dev/da1</userinput></screen>
|
||||
|
||||
<para>在重建过程中可以用 <command>gmirror</command> <option>status</option>
|
||||
命令来监看进度。 就是这样简单。</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="geom-ggate">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
The FreeBSD Documentation Project
|
||||
The FreeBSD Simplified Chinese Project
|
||||
|
||||
Original Revision: 1.16
|
||||
Original Revision: 1.17
|
||||
$FreeBSD$
|
||||
-->
|
||||
<chapter id="jails">
|
||||
|
@ -289,6 +289,7 @@ jail_<replaceable>www</replaceable>_devfs_ruleset="<replaceable>www_ruleset</rep
|
|||
<para>如欲了解全部可用的选项, 请参阅联机手册
|
||||
&man.rc.conf.5;。</para>
|
||||
</note>
|
||||
</step>
|
||||
</procedure>
|
||||
|
||||
<para><filename>/etc/rc.d/jail</filename> 脚本也可以用于手工启动或停止
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
The FreeBSD Documentation Project
|
||||
The FreeBSD Chinese Documentation Project
|
||||
|
||||
Original Revision: 1.449
|
||||
Original Revision: 1.451
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
|
@ -2246,167 +2246,6 @@ doc/zh_*</screen>
|
|||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="portsnap">
|
||||
<title>使用 Portsnap</title>
|
||||
|
||||
<sect2 id="portsnap-intro">
|
||||
<title>介绍</title>
|
||||
|
||||
<para><application>Portsnap</application>
|
||||
是一套用以安全地分发 &os; ports 套件的系统。 每隔大约一个小时,
|
||||
就会生成一份 ports 的最新 <quote>快照</quote>,
|
||||
它会被打包并进行数字签名。 这些文件接下来将通过 HTTP
|
||||
来分发。</para>
|
||||
|
||||
<para>与 <application>CVSup</application> 类似,
|
||||
<application>Portsnap</application> 采用
|
||||
<emphasis>拉 (pull)</emphasis> 的模式来进行更新:
|
||||
经过打包并签名的 ports tree 被放在 web 服务器上,
|
||||
被动地等待用户请求它们。 用户需要手工运行
|
||||
&man.portsnap.8; 来下载更新,
|
||||
或者设置 &man.cron.8; 任务来自动地进行更新。</para>
|
||||
|
||||
<para>由于一些技术原因, <application>Portsnap</application>
|
||||
并不自动地直接更新位于
|
||||
<filename>/usr/ports/</filename> 目录中的 <quote>实际的</quote> ports
|
||||
tree; 事实上, 默认情况下它只操作位于
|
||||
<filename>/var/db/portsnap/</filename> 的压缩的 ports tree 副本,
|
||||
而这个副本则用于更新实际的 ports tree。</para>
|
||||
|
||||
<note>
|
||||
<para>如果 <application>Portsnap</application> 是通过
|
||||
&os; Ports Collection 安装的,
|
||||
则这份压缩快照的默认位置则是 <filename>/usr/local/portsnap/</filename>
|
||||
而非 <filename>/var/db/portsnap/</filename>。</para>
|
||||
</note>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="portsnap-install">
|
||||
<title>安装</title>
|
||||
|
||||
<para>在 &os; 6.0 和更新版本上,
|
||||
<application>Portsnap</application> 已经成为 &os;
|
||||
基本系统的一部分。 在较早版本的 &os; 中,
|
||||
它可经由 <filename role="package">ports-mgmt/portsnap</filename>
|
||||
port 来安装。</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="portsnap-config">
|
||||
<title>Portsnap 的配置</title>
|
||||
|
||||
<para><application>Portsnap</application> 的操作,
|
||||
是通过 <filename>/etc/portsnap.conf</filename> 配置文件来控制的。
|
||||
对于多数用户来说, 默认的配置文件已经可用了; 要了解进一步的细节,
|
||||
则应参考 &man.portsnap.conf.5; 联机手册。</para>
|
||||
|
||||
<note>
|
||||
<para>假如 <application>Portsnap</application> 是通过
|
||||
&os; Ports Collection 安装的, 则它将使用配置文件
|
||||
<filename>/usr/local/etc/portsnap.conf</filename> 而非
|
||||
<filename>/etc/portsnap.conf</filename>。 这个文件并不随 port
|
||||
的安装自动创建, 但我们提供了一个示例的配置文件;
|
||||
将其复制到合适的位置, 然后运行下面的命令:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>cd /usr/local/etc && cp portsnap.conf.sample portsnap.conf</userinput></screen>
|
||||
</note>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>首次运行 <application>Portsnap</application></title>
|
||||
|
||||
<para>在首次运行 &man.portsnap.8; 时, 它需要将整个
|
||||
ports tree 的压缩快照下载到 <filename>/var/db/portsnap/</filename> (或者,
|
||||
如果 <application>Portsnap</application> 是通过
|
||||
Ports Collection 安装的, 则是
|
||||
<filename>/usr/local/portsnap/</filename>)。
|
||||
在 2006 年初, 其下载尺寸大约是 41 MB。</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>portsnap fetch</userinput></screen>
|
||||
|
||||
<para>一旦下载了压缩的快照, 就可以将它释放成为位于
|
||||
<filename>/usr/ports/</filename> 中的
|
||||
<quote>实际的</quote> ports tree 了。 即时之前那个目录中已经有了一份
|
||||
ports tree 也需要这样做 (例如,
|
||||
通过使用 <application>CVSup</application>), 因为这个操作,
|
||||
将为后续的 <command>portsnap</command> 决定更新 ports tree
|
||||
的哪一部份提供基础。</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>portsnap extract</userinput></screen>
|
||||
|
||||
<note>
|
||||
<para>默认安装时, 并不会自动创建
|
||||
<filename class="directory">/usr/ports</filename> 这个目录。
|
||||
如果您使用 &os; 6.0-RELEASE, 在首次使用
|
||||
<command>portsnap</command> 之前应手工创建这个目录。
|
||||
在更高版本的 &os; 和 <application>Portsnap</application> 中,
|
||||
这个操作会由 <command>portsnap</command> 命令自动完成。<para>
|
||||
</note>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>更新 Ports Tree</title>
|
||||
|
||||
<para>在首次下载压缩的 ports tree 快照,
|
||||
并将其释放到 <filename>/usr/ports/</filename> 之后,
|
||||
更新 ports tree 包含下面两步:
|
||||
<emphasis>fetch</emphasis>(下载) 对于压缩快照的更新,
|
||||
并使用它们来 <emphasis>update</emphasis>(更新)
|
||||
实际的 ports tree。 这两步可以通过一个
|
||||
<command>portsnap</command> 命令来完成:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>portsnap fetch update</userinput></screen>
|
||||
|
||||
<note>
|
||||
<para>较早版本的 <command>portsnap</command>
|
||||
并不支持这种写法。 如果不能用的话, 试试看下面的:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>portsnap fetch</userinput>
|
||||
&prompt.root; <userinput>portsnap update</userinput></screen>
|
||||
</note>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>通过 cron 来运行 Portsnap</title>
|
||||
|
||||
<para>为了避免对于 <application>Portsnap</application>
|
||||
服务器的 <quote>快闪</quote> 式访问,
|
||||
<command>portsnap fetch</command> 不支持作为
|
||||
&man.cron.8; 任务来运行。 与此相反, 提供了一个特殊的
|
||||
<command>portsnap cron</command> 命令,
|
||||
它在开始下载更新之前会随机等待最多 3600 秒。</para>
|
||||
|
||||
<para>此外, 强烈建议不要将
|
||||
<command>portsnap update</command> 作为
|
||||
<command>cron</command> 任务来运行, 因为它可能给正在同时进行的 port
|
||||
安装带来大问题。 不过, 更新 ports 的 <filename>INDEX</filename> 文件一般并无大碍, 这可以通过
|
||||
<command>portsnap</command>的
|
||||
<option>-I</option> 参数来实现 (显然, 如果
|
||||
<command>portsnap -I update</command> 是通过
|
||||
<command>cron</command> 来运行的, 在之后还需要执行不带 <option>-I</option> 的
|
||||
<command>portsnap update</command> 来更新 ports tree 余下的部分。)</para>
|
||||
|
||||
<para>可以在 <filename>/etc/crontab</filename>
|
||||
中加入下列设置, 以便让 <command>portsnap</command> 更新其压缩快照, 以及位于
|
||||
<filename>/usr/ports/</filename> 中的 <filename>INDEX</filename> 文件,
|
||||
并在有 port 过期时发出邮件通知:</para>
|
||||
|
||||
<programlisting>0 3 * * * root portsnap -I cron update && pkg_version -vIL=</programlisting>
|
||||
|
||||
<note>
|
||||
<para>如果系统时钟没有设置为使用本地时区,
|
||||
请将 <literal>3</literal> 改为一介于 0 和 23 的随机值, 以便让
|
||||
<application>Portsnap</application> 服务器的负载更为平均。</para>
|
||||
</note>
|
||||
<note>
|
||||
<para>某些较早版本的 <command>portsnap</command>,
|
||||
并不支持在一次调用 <command>portsnap</command> 时使用多个命令 (例如,
|
||||
<literal>cron update</literal>)。 如果这样不行, 请将
|
||||
<command>portsnap -I cron update</command> 改为
|
||||
<command>portsnap cron && portsnap -I update</command>。</para>
|
||||
</note>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="cvs-tags">
|
||||
<title>CVS 标签</title>
|
||||
|
||||
|
@ -2696,14 +2535,6 @@ doc/zh_*</screen>
|
|||
最后, <filename class="directory">www</filename> 树上不会有任何特定发行版的标签。</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>RELENG_7_1_0_RELEASE</term>
|
||||
|
||||
<listitem>
|
||||
<para>FreeBSD 7.1</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>RELENG_7_0_0_RELEASE</term>
|
||||
|
||||
|
@ -2712,14 +2543,6 @@ doc/zh_*</screen>
|
|||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>RELENG_6_4_0_RELEASE</term>
|
||||
|
||||
<listitem>
|
||||
<para>FreeBSD 6.4</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>RELENG_6_3_0_RELEASE</term>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
The FreeBSD Documentation Project
|
||||
The FreeBSD Simplified Chinese Documentation Project
|
||||
|
||||
Original Revision: 1.129
|
||||
Original Revision: 1.130
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
|
@ -457,7 +457,7 @@ Playing MPEG stream from Foobar-GreatestHits.mp3 ...
|
|||
MPEG 1.0 layer III, 128 kbit/s, 44100 Hz joint-stereo
|
||||
</screen>
|
||||
|
||||
<para><devicename><literal>/dev/dsp1.0</literal></devicename> 应该换成您的系统上的
|
||||
<para>前面的 <filename><replaceable>/dev/dsp1.0</replaceable></filename> 应换成您系统上对应的
|
||||
<devicename>dsp</devicename> 设备。</para>
|
||||
|
||||
</sect2>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
The FreeBSD Documentation Project
|
||||
The FreeBSD Simplified Chinese Project
|
||||
|
||||
Original Revision: 1.108
|
||||
Original Revision: 1.109
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
|
@ -2341,8 +2341,8 @@ nis_client_flags="-S <replaceable>NIS domain</replaceable>,<replaceable>server</
|
|||
或者需要给 <command>dhclient</command> 传递其他参数,
|
||||
还可以添加下面的配置 (根据需要进行修改):</para>
|
||||
|
||||
<programlisting>dhcp_program="/sbin/dhclient"
|
||||
dhcp_flags=""</programlisting>
|
||||
<programlisting>dhclient_program="/sbin/dhclient"
|
||||
dhclient_flags=""</programlisting>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
The FreeBSD Documentation Project
|
||||
The FreeBSD Simplified Chinese Documentation Project
|
||||
|
||||
Original Revision: 1.282
|
||||
Original Revision: 1.284
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
|
@ -599,7 +599,7 @@ docbook =
|
|||
|
||||
<screen>&prompt.root; <userinput>pkg_add -r portsnap</userinput></screen>
|
||||
|
||||
<para>请参见 <link linkend="portsnap">使用 Portsnap</link>
|
||||
<para>请参见 <link linkend="updating-portsnap">使用 Portsnap</link>
|
||||
以了解关于全部 <application>Portsnap</application>
|
||||
功能的详细描述。</para>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!--
|
||||
The FreeBSD Chinese Documentation Project
|
||||
|
||||
Original Revision: 1.39
|
||||
Original Revision: 1.41
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
|
@ -199,7 +199,7 @@
|
|||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="install">,安装</emphasis></term>
|
||||
<term><emphasis><xref linkend="install">, 安装</emphasis></term>
|
||||
<listitem>
|
||||
<para>
|
||||
本章将会带领用户完成安装过程。一些高级安装主题,
|
||||
|
@ -207,14 +207,14 @@
|
|||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="basics">,&unix; 基础</emphasis></term>
|
||||
<term><emphasis><xref linkend="basics">, &unix; 基础</emphasis></term>
|
||||
<listitem>
|
||||
<para>本章涵盖了 FreeBSD 操作系统基础命令和功能。
|
||||
如果熟悉 &linux; 或者其他类 &unix; 操作系统,则可以跳过这章。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="ports">,安装应用程序</emphasis></term>
|
||||
<term><emphasis><xref linkend="ports">, 安装应用程序</emphasis></term>
|
||||
<listitem>
|
||||
<para>
|
||||
本章涵盖如何用 FreeBSD 的 <quote>Ports Collection</quote>
|
||||
|
@ -222,7 +222,7 @@
|
|||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="x11">,X Window 系统</emphasis></term>
|
||||
<term><emphasis><xref linkend="x11">, X Window 系统</emphasis></term>
|
||||
<listitem>
|
||||
<para>本章概要地描述了 X Window System 系统并详细地介绍了如何在
|
||||
FreeBSD 上使用它。 此外他也描述了常用的桌面环境,
|
||||
|
@ -233,21 +233,21 @@
|
|||
<!-- Part II Common Tasks -->
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="desktop">,桌面应用</emphasis></term>
|
||||
<term><emphasis><xref linkend="desktop">, 桌面应用</emphasis></term>
|
||||
<listitem>
|
||||
<para>列出了一些常用的桌面应用程序,比如 web 浏览器和办公套件,
|
||||
描述了在 FreeBSD 上如何安装它们。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="multimedia">,多媒体</emphasis></term>
|
||||
<term><emphasis><xref linkend="multimedia">, 多媒体</emphasis></term>
|
||||
<listitem>
|
||||
<para>展示了如何为您的系统设置声卡和视频回放支持。
|
||||
也描述了一些简单的音频和视频应用程序。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="kernelconfig">,配置 FreeBSD
|
||||
<term><emphasis><xref linkend="kernelconfig">, 配置 FreeBSD
|
||||
内核</emphasis></term>
|
||||
<listitem>
|
||||
<para>解释了为什么需要配置一个新内核并提供了配置、
|
||||
|
@ -255,14 +255,14 @@
|
|||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="printing">,打印</emphasis></term>
|
||||
<term><emphasis><xref linkend="printing">, 打印</emphasis></term>
|
||||
<listitem>
|
||||
<para>描绘了 FreeBSD 上打印机管理,
|
||||
包括横幅页、打印统计,还有初始的设置。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="linuxemu">,&linux; 二进制兼容</emphasis></term>
|
||||
<term><emphasis><xref linkend="linuxemu">, &linux; 二进制兼容</emphasis></term>
|
||||
<listitem>
|
||||
<para>描述了 FreeBSD 的 &linux; 兼容特性。
|
||||
也提供了许多流行的 &linux; 应用程序的详细的安装说明,
|
||||
|
@ -274,48 +274,48 @@
|
|||
<!-- Part III - System Administration -->
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="config-tuning">,配置和调整</emphasis></term>
|
||||
<term><emphasis><xref linkend="config-tuning">, 配置和调整</emphasis></term>
|
||||
<listitem>
|
||||
<para>本章描述了管理员调整 FreeBSD 系统以优化性能时可能用到的一些参数。
|
||||
也描述了 FreeBSD 中的各种配置文件以及它们所在的位置。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="boot">,启动过程</emphasis></term>
|
||||
<term><emphasis><xref linkend="boot">, 启动过程</emphasis></term>
|
||||
<listitem>
|
||||
<para>本章描述 FreeBSD 的启动过程并且解释了如何用配置选项来控制这个过程。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="users">,用户和基本帐号管理</emphasis></term>
|
||||
<term><emphasis><xref linkend="users">, 用户和基本帐号管理</emphasis></term>
|
||||
<listitem>
|
||||
<para>本章描述了如何创建和操作用户帐号,
|
||||
同样也论述了设置用户资源限制和其他账号管理任务的方法。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="security">, 安全</emphasis></term>
|
||||
<term><emphasis><xref linkend="security">, 安全</emphasis></term>
|
||||
<listitem>
|
||||
<para>描述了保证 FreeBSD 系统安全可以使用的许多工具, 这包括
|
||||
Kerberos, IPsec 以及 OpenSSH。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="jails">, Jail</emphasis></term>
|
||||
<term><emphasis><xref linkend="jails">, Jail</emphasis></term>
|
||||
<listitem>
|
||||
<para>介绍了 jail 框架, 以及 jail 相对于
|
||||
&os; 中传统的 chroot 支持的改进。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="mac">, 强制访问控制</emphasis></term>
|
||||
<term><emphasis><xref linkend="mac">, 强制访问控制</emphasis></term>
|
||||
<listitem>
|
||||
<para>解释了何谓强制访问控制 (MAC) 以及如何利用这一机制来加强
|
||||
FreeBSD 系统的安全。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="audit">, 安全事件审计</emphasis></term>
|
||||
<term><emphasis><xref linkend="audit">, 安全事件审计</emphasis></term>
|
||||
<listitem>
|
||||
<para>介绍了 &os; 事件审计是什么, 以及如何安装、 配置它,
|
||||
并检查或监视审计记帐信息。</para>
|
||||
|
@ -323,7 +323,7 @@
|
|||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="disks">,存储</emphasis></term>
|
||||
<term><emphasis><xref linkend="disks">, 存储</emphasis></term>
|
||||
<listitem>
|
||||
<para>本章描述了怎样用 FreeBSD 来管理存储介质和文件系统,包括物理磁盘、RAID
|
||||
阵列、光学和磁带媒体、后备存储磁盘以及网络文件系统。</para>
|
||||
|
@ -337,7 +337,14 @@
|
|||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="vinum-vinum">, Vinum</emphasis></term>
|
||||
<term><emphasis><xref linkend="filesystems">, 文件系统支持</emphasis></term>
|
||||
<listitem>
|
||||
<para>探讨了 &os; 对非原生文件系统的支持,比如 &sun;
|
||||
的 Z 文件系统。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="vinum-vinum">, Vinum</emphasis></term>
|
||||
<listitem>
|
||||
<para>本章描述了怎样使用逻辑卷管理器 Vinum。它提供了设备无关的逻辑磁盘和软件
|
||||
RAID-0、RAID-1 以及 RAID-5。</para>
|
||||
|
@ -350,44 +357,59 @@
|
|||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="l10n">,本地化</emphasis></term>
|
||||
<term><emphasis><xref linkend="l10n">, 本地化</emphasis></term>
|
||||
<listitem>
|
||||
<para>本章描述了如何在 FreeBSD 上使用非英语语言。它涵盖了系统和应用程序级的本地化。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="cutting-edge">, 最前沿</emphasis></term>
|
||||
<term><emphasis><xref linkend="cutting-edge">, 最前沿</emphasis></term>
|
||||
<listitem>
|
||||
<para>介绍了 FreeBSD-STABLE、
|
||||
FreeBSD-CURRENT 以及 FreeBSD 发行版本之间的差异。
|
||||
描述了一般用户如何紧跟开发过程并从中受益。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="dtrace">, Dtrace</emphasis></term>
|
||||
<listitem>
|
||||
<para>本章描述了如何在 &os; 上配置和使用 &sun; 的 DTrace 工具.
|
||||
动态跟踪可以通过实时的系统分析,帮助找出系统性能瓶颈。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<!-- Part IV - Network Communications -->
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="serialcomms">,串行通信</emphasis></term>
|
||||
<term><emphasis><xref linkend="updating">, 更新 &os;</emphasis></term>
|
||||
<listitem>
|
||||
<para>本章描述了最新的用来更新 &os; 系统的工具。基本系统中的
|
||||
&man.freebsd-update.8; 和 Ports Collection 中的
|
||||
&man.portsnap.8;。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="serialcomms">, 串行通信</emphasis></term>
|
||||
<listitem>
|
||||
<para>本章解释了如何连接终端和调制解调器到 FreeBSD 系统,包括拨入和拨出连接。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="ppp-and-slip">,PPP 和 SLIP</emphasis></term>
|
||||
<term><emphasis><xref linkend="ppp-and-slip">, PPP 和 SLIP</emphasis></term>
|
||||
<listitem>
|
||||
<para>本章描述了如何用 FreeBSD 通过使用 PPP,SLIP 或者基于以太网的
|
||||
PPP(PPPoE)来连接远程系统。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="mail">, 电子邮件</emphasis></term>
|
||||
<term><emphasis><xref linkend="mail">, 电子邮件</emphasis></term>
|
||||
<listitem>
|
||||
<para>本章解释了一个 email 服务器的不同组成部分并且简单讨论了关于最流行的
|
||||
mail 服务器软件 <application>sendmail</application> 的配置。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="network-servers">, 网络服务</emphasis></term>
|
||||
<term><emphasis><xref linkend="network-servers">, 网络服务</emphasis></term>
|
||||
<listitem>
|
||||
<para>提供了详细的指引和示范配置文件以说明如何将一台 FreeBSD 机器作为网络文件系统服务器,
|
||||
域名服务器, 网络信息服务器或时间同步服务器来使用的方法。</para>
|
||||
|
@ -401,7 +423,7 @@
|
|||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="advanced-networking">, 高级网络应用</emphasis></term>
|
||||
<term><emphasis><xref linkend="advanced-networking">, 高级网络应用</emphasis></term>
|
||||
<listitem>
|
||||
<para>描述了许多关于网络的主题,包括如何在您的局域网中共享
|
||||
Internet 连接, 高级路由话题, 无线网络, &bluetooth;, ATM, IPv6以及许多高级话题。</para>
|
||||
|
@ -411,30 +433,30 @@
|
|||
<!-- Part V - Appendices -->
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="mirrors">,获取 FreeBSD </emphasis></term>
|
||||
<term><emphasis><xref linkend="mirrors">, 获取 FreeBSD </emphasis></term>
|
||||
<listitem>
|
||||
<para>列出了获得 FreeBSD 安装 CDROM 或 DVDROM 的不同资源,也提供了允许您自由下载
|
||||
FreeBSD 的不同 Internet 站点。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="bibliography">,参考书目</emphasis></term>
|
||||
<term><emphasis><xref linkend="bibliography">, 参考书目</emphasis></term>
|
||||
<listitem>
|
||||
<para>由于本手册触及到了很多不同的主题,因而可能引发您想要获取更多详细的讲解。
|
||||
参考书目列出了很多写作这本书时参考的好书。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="eresources">,Internet 上的资源</emphasis></term>
|
||||
<term><emphasis><xref linkend="eresources">, Internet 上的资源</emphasis></term>
|
||||
<listitem>
|
||||
<para>讲述了很多对 FreeBSD 用户有用的能够提出问题并进行技术交流的关于
|
||||
FreeBSD 的论坛。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis><xref linkend="pgpkeys">,PGP 秘钥</emphasis></term>
|
||||
<term><emphasis><xref linkend="pgpkeys">, PGP 公钥</emphasis></term>
|
||||
<listitem>
|
||||
<para>列出了一些 FreeBSD 开发者的 PGP 签名。</para>
|
||||
<para>列出了一些 FreeBSD 开发者的 PGP 签名公钥。</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
The FreeBSD Documentation Project
|
||||
The FreeBSD Simplified Chinese Project
|
||||
|
||||
Original Revision: 1.330
|
||||
Original Revision: 1.332
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
|
@ -1980,7 +1980,7 @@ Aug 27 15:37:58 Aug 28 01:37:58 krbtgt/EXAMPLE.ORG@EXAMPLE.ORG</screen>
|
|||
|
||||
<para>完成所需的操作之后, 可以撤消这一 ticket:</para>
|
||||
|
||||
<screen>&prompt.user; <userinput>k5destroy</userinput></screen>
|
||||
<screen>&prompt.user; <userinput>kdestroy</userinput></screen>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
|
|
18
zh_CN.GB2312/books/handbook/updating/Makefile
Normal file
18
zh_CN.GB2312/books/handbook/updating/Makefile
Normal file
|
@ -0,0 +1,18 @@
|
|||
#
|
||||
# Build the Handbook with just the content from this chapter.
|
||||
#
|
||||
# The FreeBSD Simplified Chinese Project
|
||||
# Original Revision: 1.1
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
CHAPTERS= updating/chapter.sgml
|
||||
|
||||
VPATH= ..
|
||||
|
||||
MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX}
|
||||
|
||||
DOC_PREFIX?= ${.CURDIR}/../../../..
|
||||
|
||||
.include "../Makefile"
|
477
zh_CN.GB2312/books/handbook/updating/chapter.sgml
Normal file
477
zh_CN.GB2312/books/handbook/updating/chapter.sgml
Normal file
|
@ -0,0 +1,477 @@
|
|||
<!--
|
||||
Original Revision: 1.1
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
<chapter id="updating">
|
||||
<chapterinfo>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Tom</firstname>
|
||||
<surname>Rhodes</surname>
|
||||
<contrib>Written by </contrib>
|
||||
</author>
|
||||
</authorgroup>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Colin</firstname>
|
||||
<surname>Percival</surname>
|
||||
<contrib>Based on notes provided by </contrib>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</chapterinfo>
|
||||
|
||||
<title>更新 &os;</title>
|
||||
|
||||
<sect1 id="updating-synopsis">
|
||||
<title>概述</title>
|
||||
|
||||
<indexterm><primary>Updating FreeBSD</primary></indexterm>
|
||||
<indexterm>
|
||||
<primary>freebsd-update</primary>
|
||||
<see>Updating</see>
|
||||
</indexterm>
|
||||
|
||||
<para>长久以来,&os 操作系统的一个主要方面始终没有改变,
|
||||
那就是使用应用程序和工具去获得系统各种大大小小的更新。</para>
|
||||
|
||||
<para>多年来用户升级他们的系统,收集安全补丁,
|
||||
无损 Ports Collection 更新 ports 和 package
|
||||
唯一的选择是使用 <application>CVSup</application>
|
||||
工具。</para>
|
||||
|
||||
<para>当然原来的 <application>CVSup</application> 仍被支持,
|
||||
现在有一个 C 语言的版本加入了 &os;,
|
||||
并且有些新的方法能用来获得系统更新。</para>
|
||||
|
||||
<para>类似像 &man.portsnap.8; 和 &man.freebsd-update.8;
|
||||
这样的工具使得升级过程变得更加简便有效。
|
||||
这些新的方法在提高效率的同时也给用户提供一个简洁的接口。
|
||||
一些新的工具能通过 &man.cron.8; 执行,
|
||||
从而减少系统管理员的人为介入,这会有益于那些管理着成百上千台 &os;
|
||||
的人。<para>
|
||||
|
||||
<para>这一章节将会介绍这些新的方法,
|
||||
以及用户跟系统管理如何从这些新方法的实用和易用中获益。</para>
|
||||
|
||||
<para>在阅读了这章以后,你将了解:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>哪些工具能被用来更新系统和 Ports Collection。<para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>如何使用 <command>freebsd-update</command>
|
||||
打安全补丁和完成主要及次要的 &os; 升级。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>如何比较已安装的系统与原来已知拷贝的状态。</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<para>在阅读这章之前,你应该:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>了解一些 &unix; 和 &os; 的基础知识
|
||||
(<xref linkend="basics">)。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>熟悉基本的内核配置/编译方法
|
||||
(<xref linkend="kernelconfig">)。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>熟悉使用 Ports Collection 在 &os;
|
||||
上安装第三方的应用程序
|
||||
(<xref linkend="ports">)。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>熟悉组成 &os; 的各个部分以及使用
|
||||
&man.mergemaster.8; 工具
|
||||
(<xref linkend="cutting-edge">)。</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="updating-freebsdupdate">
|
||||
<title>FreeBSD 更新</title>
|
||||
|
||||
<para>打安全补丁是对于维护计算机软件的一个重要部分,
|
||||
特别是对于操作系统。对于 &os; 来说,
|
||||
很长的一段时间以来这都不是一件容易的事情。
|
||||
补丁打在源代码上,代码需要被重新编译为二进制,
|
||||
然后再重新安装编译后的程序。</para>
|
||||
|
||||
<para>&os; 引入了 <command>freebsd-update</command>
|
||||
工具之后这便不再是问题了。这个工具提供了 2 种功能。
|
||||
第一,它可以把二进制的安全和勘误更新直接应用于 &os;
|
||||
的基本系统,而不需要重新编译和安装。第二,
|
||||
这个工具还支持主要跟次要的发行版的升级。</para>
|
||||
|
||||
<note>
|
||||
<para>由安全小组支持的各种体系结构和发行版都可使用二进制更新。
|
||||
然而有些特性,比如升级 &os; 操作系统需要最近的 &man.freebsd-update.8;
|
||||
和 &os; 6.3。在升级到一个新的发行版本之前,
|
||||
应先阅读一下当前发行版的声明,
|
||||
因为他们可能包含有关于你期望升级版本的重要消息。
|
||||
这些发行声明可以通过以下链接查阅:
|
||||
<ulink url="http://www.FreeBSD.org/releases/"></ulink>。</para>
|
||||
</note>
|
||||
|
||||
<para>如果 <command>crontab</command> 中存在有用到
|
||||
<command>freebsd-update</command> 特性的部分,
|
||||
那么这些在开始以下操作前必须先被禁止。最新版本的
|
||||
<command>freebsd-update</command> 可以通过上面的
|
||||
<acronym>URL</acronym> 下载用 <command>tar</command>
|
||||
和 <command>gzip</command> 打包的版本,
|
||||
并按照下面的命令安装:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>gunzip -c freebsd-update-upgrade.tgz | tar xvf -</userinput>
|
||||
&prompt.root; <userinput>mv freebsd-update.sh /usr/sbin/freebsd-update</userinput>
|
||||
&prompt.root; <userinput>mv freebsd-update.conf /etc</userinput></screen>
|
||||
|
||||
<para>对于所有当前流行的发行版本来说,
|
||||
并不需要下载最新版。</para>
|
||||
|
||||
<sect2>
|
||||
<title>配置文件</title>
|
||||
|
||||
<para>有些用户可能希望调整配置文件来更好的控制升级过程。
|
||||
可用参数的文档非常齐全,
|
||||
但下面的这些可能需要进一步的解释:</para>
|
||||
|
||||
<programlisting># Components of the base system which should be kept updated.
|
||||
Components src world kernel</programlisting>
|
||||
|
||||
<para>这个参数是控制 &os; 的哪一部分将被保持更新。
|
||||
默认的是更新源代码,整个基本系统还有内核。
|
||||
这些部件跟安装时的那些相同,举例来说,
|
||||
在这里加入 “world/games” 就会允许打入游戏相关的补丁。
|
||||
使用 “src/bin” 则是允许更新
|
||||
<filename class="directory">src/bin</filename>
|
||||
目录中的源代码。</para>
|
||||
|
||||
<para>最好的选择是把这个选项保留为默认值,
|
||||
因为如果要修改它去包含一些指定的选项,
|
||||
就需要用户列出每一个想要更新的项目。
|
||||
这可能会引起可怕的后果,
|
||||
因为部分的源代码和二进制程序得不到同步。</para>
|
||||
|
||||
<programlisting># Paths which start with anything matching an entry in an IgnorePaths
|
||||
# statement will be ignored.
|
||||
IgnorePaths</programlisting>
|
||||
|
||||
<para>添加路径,比如
|
||||
<filename class="directory">/bin</filename> 或者
|
||||
<filename class="directory">/sbin</filename>
|
||||
让这些指定的目录在更新过程中不被修改。
|
||||
这个选项能够防止本地的修改被
|
||||
<command>freebsd-update</command> 覆盖。</para>
|
||||
|
||||
<programlisting># Paths which start with anything matching an entry in an UpdateIfUnmodified
|
||||
# statement will only be updated if the contents of the file have not been
|
||||
# modified by the user (unless changes are merged; see below).
|
||||
UpdateIfUnmodified /etc/ /var/ /root/ /.cshrc /.profile</programlisting>
|
||||
|
||||
<para>更新指定目录中的未被修改的配置文件。
|
||||
用户的任何修改都会使这些文件的自动更新失效。
|
||||
还有另外一个选项,
|
||||
<literal>KeepModifiedMetadata</literal>,
|
||||
这个能让 <command>freebsd-update</command>
|
||||
在合并时保存修改。</para>
|
||||
|
||||
<programlisting># When upgrading to a new &os; release, files which match MergeChanges
|
||||
# will have any local changes merged into the version from the new release.
|
||||
MergeChanges /etc/ /var/named/etc/</programlisting>
|
||||
|
||||
<para>一个 <command>freebsd-update</command>
|
||||
应该尝试合并的配置文件的列表。文件合并的过程是
|
||||
一系列的 &man.diff.1; 补丁类似于更少选项的 &man.mergemaster.8;
|
||||
合并的选项是接受,打开一个文本编辑器,或者
|
||||
<command>freebsd-update</command> 会被中止。
|
||||
在不能确定的时候,请先备份 <filename class="directory">/etc</filename>
|
||||
然后接受合并。更多关于 <command>mergemaster</command>
|
||||
的信息请参阅 <xref linkend="cutting-edge">。</para>
|
||||
|
||||
<programlisting># Directory in which to store downloaded updates and temporary
|
||||
# files used by &os; Update.
|
||||
# WorkDir /var/db/freebsd-update</programlisting>
|
||||
|
||||
<para>这个目录是放置所有补丁和临时文件的。
|
||||
用户做一个版本升级的话,请确认此处至少有 1 GB
|
||||
的可用磁盘空间。</para>
|
||||
|
||||
<programlisting># When upgrading between releases, should the list of Components be
|
||||
# read strictly (StrictComponents yes) or merely as a list of components
|
||||
# which *might* be installed of which &os; Update should figure out
|
||||
# which actually are installed and upgrade those (StrictComponents no)?
|
||||
# StrictComponents no</programlisting>
|
||||
|
||||
<para>当设置成 <literal>yes</literal> 时,
|
||||
<command>freebsd-udpate</command> 将假设这个
|
||||
<literal>Components</literal> 列表时完整的,
|
||||
并且对此列表以外的项目不会修改。实际上就是
|
||||
<command>freebsd-update</command> 会尝试更新
|
||||
<literal>Componets</literal>
|
||||
列表里的每一个文件。</para>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>安全补丁</title>
|
||||
|
||||
<para>安全补丁存储在远程的机器上,
|
||||
可以使用如下的命令下载并安装:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>freebsd-update fetch</userinput>
|
||||
&prompt.root; <userinput>freebsd-update install</userinput></screen>
|
||||
|
||||
<para>如果给内核打了补丁,那么系统需要重新启动。
|
||||
如果一切都进展顺利,系统就应该被打好了补丁而且
|
||||
<command>freebsd-update</command> 可由夜间
|
||||
&man.cron.8; 执行。在 <filename>/etc/crontab</filename>
|
||||
中加入以下条目足以完成这项任务:</para>
|
||||
|
||||
<programlisting>@daily root freebsd-update cron</programlisting>
|
||||
|
||||
<para>这条记录是说明每天运行一次
|
||||
<command>freebsd-update</command>。用这种方法,
|
||||
使用了 <option>cron</option> 参数,
|
||||
<command>freebsd-update</command> 仅检查是否存在更新。
|
||||
如果有了新的补丁,就会自动下载到本地的磁盘,
|
||||
但不会自动给系统打上。<username>root</username>
|
||||
会收到一封电子邮件告知需手动安装补丁。</para>
|
||||
|
||||
<para>如果出现了错误,可以使用下面的
|
||||
<command>freebsd-update</command>
|
||||
命令回退到上一次的修改:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>freebsd-update rollback</userinput></screen>
|
||||
|
||||
<para>完成以后如果内核或任何的内核模块被修改的话,
|
||||
就需要重新启动系统。这将使 &os;
|
||||
装载新的二进制程序进内存。</para>
|
||||
|
||||
<note>
|
||||
<para><command>freebsd-update</command> 只能应用于
|
||||
<filename>GENERIC</filename> 内核。如果对
|
||||
<filename>GENERIC</filename>
|
||||
做了任何修改或者安装了一个自行编译的内核,
|
||||
<command>freebsd-update</command>
|
||||
就无法完成升级 — 如前一个范例那样失败后
|
||||
产生一条错误信息。</para>
|
||||
</note>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>重大和次要的更新</title>
|
||||
|
||||
<para>这个过程会删除旧的目标文件和库,
|
||||
这将使大部分的第三方应用程序无法删除。
|
||||
建议将所有安装的 ports 先删除然后重新安装,或者稍后使用
|
||||
<filename role="package">ports-mgmt/portupgrade</filename>
|
||||
工具升级。 大多数用户将会使用如下命令尝试编译:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>portupgrade -af</userinput></screen>
|
||||
|
||||
<para>这将确保所有的东西都会被正确的重新安装。
|
||||
请注意环境变量 <makevar>BATCH</makevar> 设置成
|
||||
<literal>yes</literal> 的话将在整个过程中对所有询问回答
|
||||
<literal>yes</literal>,这会帮助在编译过程中免去人工的介入。</para>
|
||||
|
||||
<para>重大和次要的更新可以由
|
||||
<command>freebsd-update</command> 命令后指定一个发行版本来执行,
|
||||
举例来说,下面的命令将帮助你升级到 &os; 6.3:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>freebsd-update -r 6.3-RELEASE upgrade</userinput></screen>
|
||||
|
||||
<para>在这个命令被执行后,<command>freebsd-update</command>
|
||||
将会先解析配置文件和评估当前的系统以获得更新系统所需的必要信息。
|
||||
然后便会显示出一个包含了已检测到与未检测到的组件列表。
|
||||
例如:</para>
|
||||
|
||||
<screen>Looking up update.FreeBSD.org mirrors... 1 mirrors found.
|
||||
Fetching metadata signature for 6.3-BETA1 from update1.FreeBSD.org... done.
|
||||
Fetching metadata index... done.
|
||||
Inspecting system... done.
|
||||
|
||||
The following components of FreeBSD seem to be installed:
|
||||
kernel/smp src/base src/bin src/contrib src/crypto src/etc src/games
|
||||
src/gnu src/include src/krb5 src/lib src/libexec src/release src/rescue
|
||||
src/sbin src/secure src/share src/sys src/tools src/ubin src/usbin
|
||||
world/base world/info world/lib32 world/manpages
|
||||
|
||||
The following components of FreeBSD do not seem to be installed:
|
||||
kernel/generic world/catpages world/dict world/doc world/games
|
||||
world/proflibs
|
||||
|
||||
Does this look reasonable (y/n)? y</screen>
|
||||
|
||||
<para>此时,<command>freebsd-update</command>
|
||||
将会尝试下载所有升级所需的文件。在某些情况下,
|
||||
用户可能被问及需安装些什么和如何进行之类的问题。<para>
|
||||
|
||||
<para>下载完所有的补丁之后,它们很快就会被打上。
|
||||
这个过程可能会持续一段时间,取决与机器的速度和当前的负载情况。
|
||||
配置文件将会被合并 — 这一部分需要用户的参与,
|
||||
因为文件可能被合并或者屏幕上弹出了一个文本编辑器用来手工合并。
|
||||
在处理过程中,每一个成功的合并都会给用户显示出来。
|
||||
失败或者被忽略的合并则会引起合并程序的中止。
|
||||
用户可能想要备份一下 <filename class="directory">/etc</filename>
|
||||
之后手工合并重要的文件,比如
|
||||
<filename>master.passwd</filename> 或
|
||||
<filename>group</filename>。</para>
|
||||
|
||||
<note>
|
||||
<para>系统至此还没有被修改,所有的补丁和合并都在另外一个目录中进行。
|
||||
当所有的补丁都被成功的打上了以后,所有的配置文件都被合并后,
|
||||
我们就已经完成了整个升级过程中最困难的部分,
|
||||
下面就需要用户来安装这些变更了。</para>
|
||||
</note>
|
||||
|
||||
<para>一旦这个步骤完成后,使用如下的命令将升级后的文件安装到磁盘上。</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>freebsd-update install</userinput></screen>
|
||||
|
||||
<para>内核与内核模块会先被打上补丁。此时机器必须要重新启动。
|
||||
使用下面的命令重启机器,这样新的内核将载入内存:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>shutdown -r now</userinput></screen>
|
||||
|
||||
<para>在系统重新上线后,需要再次运行 <command>freebsd-update</command>。
|
||||
升级的状态被保存着,这样 <command>freebsd-update</command>
|
||||
就无需重头开始,但是会删除所有旧的共享库和目标文件。
|
||||
执行如下命令继续这个阶段的升级:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>freebsd-update install</userinput></screen>
|
||||
|
||||
<note>
|
||||
<para>取决与是否有库的版本更新,通常只有 2 个而不是
|
||||
3 个安装阶段。</para>
|
||||
</note>
|
||||
|
||||
<para>现在需要重新编译和安装第三方软件。
|
||||
这么做的原因是某些已安装的软件可能依赖于在升级过程中已删除的库。
|
||||
可使用 <filename role="package">ports-mgmt/portupgrade</filename>
|
||||
自动化这个步骤,以如下的命令开始:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>portupgrade -f ruby</userinput>
|
||||
&prompt.root; <userinput>rm /var/db/pkg/pkgdb.db</userinput>
|
||||
&prompt.root; <userinput>portupgrade -f ruby18-bdb</userinput>
|
||||
&prompt.root; <userinput>rm /var/db/pkg/pkgdb.db /usr/ports/INDEX-*.db</userinput>
|
||||
&prompt.root; <userinput>portupgrade -af</userinput></screen>
|
||||
|
||||
<para>这个完成了以后,再最后一次运行
|
||||
<command>freebsd-update</command> 来结束升级过程。
|
||||
执行如下命令处理升级中的所有细节:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>freebsd-update install</userinput></screen>
|
||||
|
||||
<para>重新启动机器进入新版本的 &os; 升级过程至此就完成了。</para>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>系统状态对照</title>
|
||||
|
||||
<para><command>freebsd-update</command>
|
||||
工具也可被用来对着一个已知完好的 &os; 拷贝测试当前的版本。
|
||||
这个选项评估当前的系统工具,库和配置文件。
|
||||
使用以下的命令开始对照:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>freebsd-update IDS >> outfile.ids</userinput></screen>
|
||||
|
||||
<warning>
|
||||
<para>这个命令的名称是 <acronym>IDS</acronym>,
|
||||
它并不是一个像
|
||||
<filename role="package">security/snort</filename>
|
||||
这样的入侵检测系统的替代品。因为
|
||||
<command>freebsd-update</command> 在磁盘上存储数据,
|
||||
很显然它们有被篡改的可能。
|
||||
当然也可以使用一些方法来降低被篡改的可能性,比如设置
|
||||
<varname>kern.securelevel</varname> 和不使用时把
|
||||
<command>freebsd-update</command>
|
||||
数据放在只读文件系统上。例如 <acronym>DVD</acronym> 或
|
||||
安全存放的外置 <acronym>USB</acronym> 磁盘上。
|
||||
</warning>
|
||||
|
||||
<para>现在系统将会被检查,生成一份包含了文件和它们的 &man.sha256.1;
|
||||
哈希值的清单,有已知发行版中的值与当前系统中安装的值。
|
||||
这就是为什么输出被送到了 <filename>outfile.ids</filename> 文件。
|
||||
它滚动的太块无法用肉眼对照,而且会很快填满控制台的缓冲区。</para>
|
||||
|
||||
<para>这个文件中有非常长的行,但输出的格式很容易分析。
|
||||
举例来说,要获得一份与发行版中不同哈希值的文件列表,
|
||||
已可使用如下的命令:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>cat update.ids | awk '{ print $1 }' | more</userinput>
|
||||
/etc/master.passwd
|
||||
/etc/motd
|
||||
/etc/passwd
|
||||
/etc/pf.conf</screen>
|
||||
|
||||
<para>这份输出时删节缩短后的,其实是有更多的文件。
|
||||
其中有些文件并非人为修改,比如
|
||||
<filename>/etc/passwd</filename>
|
||||
被修改是因为添加了用户进系统。在某些情况下,
|
||||
还有另外的一些文件,诸如内核模块与
|
||||
<command>freebsd-update</command> 的不同是因为它们被更新过了。
|
||||
为了指定的文件或目录排除在外,把它们加到
|
||||
<filename>/etc/freebsd-update.conf</filename> 的
|
||||
<literal>IDSIgnorePaths</literal> 选项中。</para>
|
||||
|
||||
<para>除了前面讨论过的部分之外,
|
||||
这也能被当作是对升级方法的详细补充。</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="updating-portsnap">
|
||||
<title>Portsnap: 一个 Ports Collection 更新工具</title>
|
||||
|
||||
<para>&os; 基本系统也包括了一个更新 Ports Collection 的工具:
|
||||
&man.portsnap.8;。在运行之后,它会连上一个远程网站,
|
||||
校验安全密钥,然后下载一份 ports collection 的拷贝。
|
||||
密钥是用来校验所有下载文件的完整性,确保它们在传输是未被修改。
|
||||
使用以下的命令下载最新的 Ports Collection:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>portsnap fetch</userinput>
|
||||
Looking up portsnap.FreeBSD.org mirrors... 3 mirrors found.
|
||||
Fetching snapshot tag from portsnap1.FreeBSD.org... done.
|
||||
Fetching snapshot metadata... done.
|
||||
Updating from Wed Aug 6 18:00:22 EDT 2008 to Sat Aug 30 20:24:11 EDT 2008.
|
||||
Fetching 3 metadata patches.. done.
|
||||
Applying metadata patches... done.
|
||||
Fetching 3 metadata files... done.
|
||||
Fetching 90 patches.....10....20....30....40....50....60....70....80....90. done.
|
||||
Applying patches... done.
|
||||
Fetching 133 new ports or files... done.</screen>
|
||||
|
||||
<para>这个例子展示的是 &man.portsnap.8;
|
||||
发现并校验了几个用于当前 ports 的补丁。这还表明以前运行过,
|
||||
如果是第一次运行的话,那么仅仅只会下载 Ports Collection。</para>
|
||||
|
||||
<para>在 &man.portsnap.8; 成功完成一次
|
||||
<command>fetch</command> 操作后,而且本地系统上的 Ports Collection
|
||||
和随之而来的补丁通过校验以后。键入以下命令安装更新文件:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>portsnap extract</userinput>
|
||||
/usr/ports/.cvsignore
|
||||
/usr/ports/CHANGES
|
||||
/usr/ports/COPYRIGHT
|
||||
/usr/ports/GIDs
|
||||
/usr/ports/KNOBS
|
||||
/usr/ports/LEGAL
|
||||
/usr/ports/MOVED
|
||||
/usr/ports/Makefile
|
||||
/usr/ports/Mk/bsd.apache.mk
|
||||
/usr/ports/Mk/bsd.autotools.mk
|
||||
/usr/ports/Mk/bsd.cmake.mk
|
||||
<replaceable>...</replaceable></screen>
|
||||
|
||||
<para>至此更新就完成了,然后便可以使用更新后的
|
||||
Ports Collection 来安装或升级应用程序。</para>
|
||||
</sect1>
|
||||
</chapter>
|
|
@ -2,7 +2,7 @@
|
|||
The FreeBSD Documentation Project
|
||||
The FreeBSD Simplified Chinese Project
|
||||
|
||||
Original Revision: 1.187
|
||||
Original Revision: 1.190
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
|
@ -370,8 +370,22 @@
|
|||
|
||||
<para>如果这个命令并不能启动 X11,
|
||||
也许是默认的配置文件不适合你机器的配置, 这时候就需要手工配置
|
||||
X11 了。 配置 X11 需要几步,
|
||||
第一步是以超级用户的身份建立初始的配置文件:</para>
|
||||
X11 了。</para>
|
||||
|
||||
<note>
|
||||
<para>诸如 <application>GNOME</application>,
|
||||
<application>KDE</application> 或
|
||||
<application>XFce</application> 之类的桌面环境,
|
||||
大多都提供了一些允许用户非常易用的工具,
|
||||
来设置像分辨率这样的显示参数。
|
||||
所以如果你觉得默认的配置并不适合,
|
||||
而且你打算安装一个这样的桌面环境,
|
||||
那么就请继续完成桌面环境的安装,
|
||||
并使用适合的显示设置工具。</para>
|
||||
</note>
|
||||
|
||||
<para>配置 X11 需要一些步骤。
|
||||
第一步是以超级用户的身份建立初始的配置文件:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>Xorg -configure</userinput></screen>
|
||||
|
||||
|
@ -1322,8 +1336,8 @@ DisplayManager.requestPort: 0</screen>
|
|||
信息和资源, 可以在 <ulink url="http://freebsd.kde.org/">FreeBSD 上的 KDE
|
||||
团队</ulink> 的网站找到。</para>
|
||||
|
||||
<para>FreeBSD 上提供了两种版本的 KDE。 版本 3
|
||||
已经推出了很长时间, 十分成熟。 而版本 4,
|
||||
<para>FreeBSD 上提供了两种版本的 <application>KDE</application>。
|
||||
版本 3 已经推出了很长时间, 十分成熟。 而版本 4,
|
||||
也就是下一代版本, 也可以通过 Ports 套件来安装。
|
||||
这两种版本甚至能够并存。</para>
|
||||
</sect3>
|
||||
|
@ -1360,11 +1374,11 @@ DisplayManager.requestPort: 0</screen>
|
|||
还需要告诉X server 启动这个应用程序来代替默认的窗口管理器。
|
||||
这可以通过编辑 <filename>.xinitrc</filename> 文件来完成:</para>
|
||||
|
||||
<para>对于 KDE3:</para>
|
||||
<para>对于 <application>KDE3</application>:</para>
|
||||
|
||||
<screen>&prompt.user; <userinput>echo "exec startkde" > ~/.xinitrc</userinput></screen>
|
||||
|
||||
<para>对于 KDE4:</para>
|
||||
<para>对于 <application>KDE4</application>:</para>
|
||||
|
||||
<screen>&prompt.user; <userinput>echo "exec /usr/local/kde4/bin/startkde" > ~/.xinitrc</userinput></screen>
|
||||
|
||||
|
@ -1412,11 +1426,11 @@ DisplayManager.requestPort: 0</screen>
|
|||
<filename>/etc/ttys</filename> 中的 <literal>ttyv8</literal> 项。
|
||||
将其改为类似下面的样子:</para>
|
||||
|
||||
<para>对于 KDE3</para>
|
||||
<para>对于 <application>KDE3</application></para>
|
||||
|
||||
<programlisting>ttyv8 "/usr/local/bin/kdm -nodaemon" xterm on secure</programlisting>
|
||||
|
||||
<para>对于 KDE4</para>
|
||||
<para>对于 <application>KDE4</application></para>
|
||||
|
||||
<programlisting>ttyv8 "/usr/local/kde4/bin/kdm -nodaemon" xterm on secure</programlisting>
|
||||
</sect3>
|
||||
|
|
Loading…
Reference in a new issue