- remove 4.X documentation

PR:		docs/99992
Submitted by:	clsung@
This commit is contained in:
Vanilla I. Shu 2006-07-10 05:38:05 +00:00
parent b7a0dc1f12
commit 780fb79509
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=28232
2 changed files with 215 additions and 387 deletions

View file

@ -3,6 +3,7 @@
$FreeBSD$
Original revision: 1.213
Chased revision: 1.217
-->
<chapter id="config-tuning">
@ -102,7 +103,7 @@
<sect3>
<title>Base Partitions</title>
<para>用 &man.disklabel.8; 或 &man.sysinstall.8; 來規劃檔案系統時,請記住:
<para>用 &man.bsdlabel.8; 或 &man.sysinstall.8; 來規劃檔案系統時,請記住:
硬碟在傳輸資料方面,(由於結構為碟片因素)外圈會比內圈來得快些。
因此,建議把較小、常會存取的分割區儘量放外圈,而較大的分割區像是
<filename>/usr</filename> 則應放在較內圈。
@ -370,7 +371,7 @@ stop)
kill -9 `cat /var/run/utility.pid`
;;
*)
echo "Usage: `basename $0` {start|stop}" >&2
echo "Usage: `basename $0` {start|stop}" &gt;&2
exit 64
;;
esac
@ -830,15 +831,6 @@ sshd is running as pid 433.</screen>
the supported hardware and even the possible problems that
could occur.</para>
<note>
<para><filename>NOTES</filename> does not exist on
&os;&nbsp;4.X. Instead, check the <filename>LINT</filename>
file for information about various network interfaces. See
<xref linkend="kernelconfig-config"> for a more detailed
summary of <filename>NOTES</filename> versus
<filename>LINT</filename>.</para>
</note>
<para>If you own a common card, most of the time you will not
have to look very hard for a driver. Drivers for common
network cards are present in the <filename>GENERIC</filename>
@ -1578,7 +1570,7 @@ kern.maxproc: 1044</screen>
syntax:</para>
<screen>&prompt.root; <userinput>sysctl kern.maxfiles=5000</userinput>
kern.maxfiles: 2088 -> 5000</screen>
kern.maxfiles: 2088 -&gt; 5000</screen>
<para>Settings of sysctl variables are usually either strings,
numbers, or booleans (a boolean being <literal>1</literal> for yes
@ -1698,8 +1690,8 @@ device_probe_and_attach: cbb0 attach returned 12</screen>
</para>
<para>There are various other buffer-cache and VM page cache
related sysctls. We do not recommend modifying these values. As
of &os;&nbsp;4.3, the VM system does an extremely good job of
related sysctls. We do not recommend modifying these values,
the VM system does an extremely good job of
automatically tuning itself.</para>
</sect3>
@ -1801,10 +1793,6 @@ device_probe_and_attach: cbb0 attach returned 12</screen>
it is mounted. A good time to enable Soft Updates is before any
partitions have been mounted, in single-user mode.</para>
<note><para>As of &os;&nbsp;4.5, it is possible to enable Soft Updates
at filesystem creation time, through use of the <literal>-U</literal>
option to &man.newfs.8;.</para></note>
<para>Soft Updates drastically improves meta-data performance, mainly
file creation and deletion, through the use of a memory cache. We
recommend to use Soft Updates on all of your file systems. There
@ -2011,16 +1999,13 @@ device_probe_and_attach: cbb0 attach returned 12</screen>
connected at once, the resources needed may be similar to a
high-scale web server.</para>
<para>Starting with &os;&nbsp;4.5, the system will auto-tune
<para>The system will auto-tune
<literal>maxusers</literal> for you if you explicitly set it to
<literal>0</literal><footnote>
<para>The auto-tuning algorithm sets
<literal>maxusers</literal> equal to the amount of memory in the
system, with a minimum of 32, and a maximum of 384.</para>
</footnote>. In &os;&nbsp;5.X and above, <literal>maxusers</literal>
will default to <literal>0</literal> if not specified. If you
are using an version of &os; earlier than 4.5, or you want to
manage it yourself you will want to set
</footnote>. When setting this option, you will want to set
<literal>maxusers</literal> to at least 4, especially if you are
using the X Window System or compiling software. The reason is that
the most important table set by <literal>maxusers</literal> is the
@ -2207,17 +2192,6 @@ device_probe_and_attach: cbb0 attach returned 12</screen>
3500) to get the desired effect. Reducing these parameters
should be done as a last resort only.</para>
<note>
<para>In 4.X and earlier releases of &os; the
<literal>inflight</literal> sysctl variables are directly under
<varname>net.inet.tcp</varname>. Their names were
(in alphabetic order):
<varname>net.inet.tcp.inflight_debug</varname>,
<varname>net.inet.tcp.inflight_enable</varname>,
<varname>net.inet.tcp.inflight_max</varname>,
<varname>net.inet.tcp.inflight_min</varname>,
<varname>net.inet.tcp.inflight_stab</varname>.</para>
</note>
</sect3>
</sect2>
@ -2267,6 +2241,10 @@ kern.maxvnodes: 100000</programlisting>
space: adding a new hard drive, enabling swap over NFS, and
creating a swap file on an existing partition.</para>
<para>For information on how to encrypt swap space, what options
for this task exist and why it should be done, please refer to
<xref linkend="swap-encrypting"> of the Handbook.</para>
<sect2 id="new-drive-swap">
<title>Swap on a New Hard Drive</title>
@ -2283,10 +2261,7 @@ kern.maxvnodes: 100000</programlisting>
<title>Swapping over NFS</title>
<para>Swapping over NFS is only recommended if you do not have a
local hard disk to swap to. Swapping over NFS is slow and
inefficient in versions of &os; prior to 4.X. It is
reasonably fast and efficient in 4.0-RELEASE and newer. Even
with newer versions of &os;, NFS swapping will be limited
local hard disk to swap to; NFS swapping will be limited
by the available network bandwidth and puts an additional
burden on the NFS server.</para>
</sect2>
@ -2300,53 +2275,7 @@ kern.maxvnodes: 100000</programlisting>
want, of course.</para>
<example>
<title>Creating a Swapfile on &os; 4.X</title>
<orderedlist>
<listitem>
<para>Be certain that your kernel configuration includes
the vnode driver. It is <emphasis>not</emphasis> in recent versions of
<filename>GENERIC</filename>.</para>
<programlisting>pseudo-device vn 1 #Vnode driver (turns a file into a device)</programlisting>
</listitem>
<listitem>
<para>Create a vn-device:</para>
<screen>&prompt.root; <userinput>cd /dev</userinput>
&prompt.root; <userinput>sh MAKEDEV vn0</userinput></screen>
</listitem>
<listitem>
<para>Create a swapfile (<filename>/usr/swap0</filename>):</para>
<screen>&prompt.root; <userinput>dd if=/dev/zero of=/usr/swap0 bs=1024k count=64</userinput></screen>
</listitem>
<listitem>
<para>Set proper permissions on (<filename>/usr/swap0</filename>):</para>
<screen>&prompt.root; <userinput>chmod 0600 /usr/swap0</userinput></screen>
</listitem>
<listitem>
<para>Enable the swap file in <filename>/etc/rc.conf</filename>:</para>
<programlisting>swapfile="/usr/swap0" # Set to name of swapfile if aux swapfile desired.</programlisting>
</listitem>
<listitem>
<para>Reboot the machine or to enable the swap file immediately,
type:</para>
<screen>&prompt.root; <userinput>vnconfig -e /dev/vn0b /usr/swap0 swap</userinput></screen>
</listitem>
</orderedlist>
</example>
<example>
<title>Creating a Swapfile on &os; 5.X</title>
<title>Creating a Swapfile on &os;</title>
<orderedlist>
<listitem>
@ -2380,7 +2309,7 @@ kern.maxvnodes: 100000</programlisting>
<para>Reboot the machine or to enable the swap file immediately,
type:</para>
<screen>&prompt.root; <userinput>mdconfig -a -t vnode -f /usr/swap0 -u 0 && swapon /dev/md0</userinput></screen>
<screen>&prompt.root; <userinput>mdconfig -a -t vnode -f /usr/swap0 -u 0 &amp;&amp; swapon /dev/md0</userinput></screen>
</listitem>
</orderedlist>
@ -2419,12 +2348,7 @@ kern.maxvnodes: 100000</programlisting>
<para>In this section of the &os; Handbook, we will provide
comprehensive information about <acronym>ACPI</acronym>. References
will be provided for further reading at the end. Please be aware
that <acronym>ACPI</acronym> is available on &os;&nbsp;5.X and
above systems as a default kernel module. For &os;&nbsp;4.9,
<acronym>ACPI</acronym> can be enabled by adding the line
<literal>device acpica</literal> to a kernel configuration and
rebuilding.</para>
will be provided for further reading at the end.</para>
<sect2 id="acpi-intro">
<title>What Is ACPI?</title>
@ -2446,8 +2370,7 @@ kern.maxvnodes: 100000</programlisting>
more control and flexibility to the operating system
(<acronym>OS</acronym>).
Modern systems <quote>stretched</quote> the limits of the
current Plug and Play interfaces (such as APM, which is used in
&os;&nbsp;4.X), prior to the introduction of
current Plug and Play interfaces prior to the introduction of
<acronym>ACPI</acronym>. <acronym>ACPI</acronym> is the direct
successor to <acronym>APM</acronym>
(Advanced Power Management).</para>

View file

@ -100,12 +100,7 @@
<row>
<entry>非標準規格光碟機</entry>
<entry>Mitsumi 光碟機用 <literal>mcd</literal>
Sony 光碟機用 <literal>scd</literal>
Matsushita/Pansonic 光碟機用 <literal>matcd</literal>
<footnote>
<para>2002 年 10 月 5 日 FreeBSD 4.X 移除了 &man.matcd.4; 驅動程式,
因此 FreeBSD 5.0 及以後的版本不再支援。</para>
</footnote>
Sony 光碟機用 <literal>scd</literal>。
</entry>
</row>
<row>
@ -164,8 +159,7 @@
看一下 <filename>/var/run/dmesg.boot</filename> 以確認系統是否抓到新硬碟。
繼續剛才的範例,新增的硬碟會是 <devicename>da1</devicename>
假設我們想將它掛載到 <filename>/1</filename> 這個位置
(如果您新增的是 IDE 硬碟的話4.0 之前的系統是
<devicename>wd1</devicename>4.X 及之後的系統則是
(如果您新增的是 IDE 硬碟的話,請用
<devicename>ad1</devicename>)。</para>
<indexterm><primary>partitions</primary></indexterm>
@ -194,7 +188,7 @@
及 <filename>e</filename> BSD partition。在 dedicated 模式的話,
新硬碟則是 <filename>/dev/da1e</filename>。</para>
<para>因為 &man.bsdlabel.8;(在 &os;&nbsp;4.X 稱為 &man.disklabel.8;)
<para>因為 &man.bsdlabel.8;
用 32-bit 整數來儲存 sector(磁區) 數,
因此限制一個硬碟最大只能有 2^32-1 個 sector亦即 2TB 的空間。
而 &man.fdisk.8; 的格式容許起始 sector 編號不超過 2^32-1
@ -216,8 +210,7 @@
<title>操作 <application>Sysinstall</application></title>
<para>透過 <command>sysinstall</command>
(<command>/stand/sysinstall</command> in &os; versions older
than 5.2) 的選單介面,您可以輕易為硬碟分割 BIOS partition(slice)
的選單介面,您可以輕易為硬碟分割 BIOS partition(slice)
和 BSD patition。您必須以 root 身份使用 <command>sysinstall</command>
要嘛用 root 登入,要嘛用 <command>su</command> 切換到 root。
執行 <command>sysinstall</command> 後,選 <Literal>Configure</literal>
@ -300,8 +293,8 @@
<screen>&prompt.root; <userinput>dd if=/dev/zero of=/dev/da1 bs=1k count=1</userinput>
&prompt.root; <userinput>fdisk -BI da1</userinput> # 初始您的硬碟。
&prompt.root; <userinput>disklabel -B -w -r da1s1 auto</userinput> # 建立 disklabel。
&prompt.root; <userinput>disklabel -e da1s1</userinput> # 編輯 disklabel 以新增 label。
&prompt.root; <userinput>bsdlabel -B -w -r da1s1 auto</userinput> # 建立 bsdlabel。
&prompt.root; <userinput>bsdlabel -e da1s1</userinput> # 編輯 bsdlabel 以新增 label。
&prompt.root; <userinput>mkdir -p /1</userinput>
&prompt.root; <userinput>newfs /dev/da1s1e</userinput> # 如果您新增了多個 label對每個 label 重覆這個步驟。
&prompt.root; <userinput>mount /dev/da1s1e /1</userinput> # 掛載這些新 label。
@ -309,8 +302,7 @@
<para>如果您新增的是 IDE 硬碟,將 <filename>da</filename>
改成 <filename>da</filename> 即可
<footnote><para>譯註da 是 direct accessad 則是 ata disk。</para></footnote>。
而如果是 4.X 之前的系統,用 <filename>wd</filename>。</para>
<footnote><para>譯註da 是 direct access。</para></footnote>。</para>
</sect3>
<sect3>
@ -326,8 +318,8 @@
not understand.</para></footnote>。</para>
<screen>&prompt.root; <userinput>dd if=/dev/zero of=/dev/da1 bs=1k count=1</userinput>
&prompt.root; <userinput>disklabel -Brw da1 auto</userinput>
&prompt.root; <userinput>disklabel -e da1</userinput> # 建立 `e' partition。
&prompt.root; <userinput>bsdlabel -Brw da1 auto</userinput>
&prompt.root; <userinput>bsdlabel -e da1</userinput> # 建立 `e' partition。
&prompt.root; <userinput>newfs -d0 /dev/da1e</userinput>
&prompt.root; <userinput>mkdir -p /1</userinput>
&prompt.root; <userinput>vi /etc/fstab</userinput> # 新增一筆 /dev/da1e 的資訊。
@ -336,17 +328,12 @@
<para>另一種方法:</para>
<screen>&prompt.root; <userinput>dd if=/dev/zero of=/dev/da1 count=2</userinput>
&prompt.root; <userinput>disklabel /dev/da1 | disklabel -BrR da1 /dev/stdin</userinput>
&prompt.root; <userinput>bsdlabel /dev/da1 | bsdlabel -BrR da1 /dev/stdin</userinput>
&prompt.root; <userinput>newfs /dev/da1e</userinput>
&prompt.root; <userinput>mkdir -p /1</userinput>
&prompt.root; <userinput>vi /etc/fstab</userinput> # 新增一筆 /dev/da1e 的資訊。
&prompt.root; <userinput>mount /1</userinput></screen>
<note><para>從 &os;&nbsp;5.1-RELEASE 開始,&man.bsdlabel.8; 取代原本的
&man.disklabel.8; 程式,某些指令參數已經廢棄不用。
上面範例裡,如果用的是 &man.bsdlabel.8;<option>-r</option>
參數應該拿掉。更多的資訊請參考 &man.bsdlabel.8; manual page。
</para></note>
</sect3>
</sect2>
</sect1>
@ -430,47 +417,28 @@ ad3: 29333MB &lt;WDC WD307AA&gt; [59598/16/63] at ata1-slave UDMA33</programlist
Add this line to your kernel configuration file, rebuild, and
reinstall the kernel:</para>
<programlisting>pseudo-device ccd 4</programlisting>
<para>On 5.X systems, you have to use instead the following
line:</para>
<programlisting>device ccd</programlisting>
<note><para>In FreeBSD&nbsp;5.X, it is not necessary to specify
a number of &man.ccd.4; devices, as the &man.ccd.4; device driver is now
self-cloning &mdash; new device instances will automatically be
created on demand.</para></note>
<para>The &man.ccd.4; support can also be
loaded as a kernel loadable module in FreeBSD 3.0 or
later.</para>
loaded as a kernel loadable module.</para>
<para>To set up &man.ccd.4;, you must first use
&man.disklabel.8; to label the disks:</para>
&man.bsdlabel.8; to label the disks:</para>
<programlisting>disklabel -r -w ad1 auto
disklabel -r -w ad2 auto
disklabel -r -w ad3 auto</programlisting>
<programlisting>bsdlabel -r -w ad1 auto
bsdlabel -r -w ad2 auto
bsdlabel -r -w ad3 auto</programlisting>
<para>This creates a disklabel for <devicename>ad1c</devicename>, <devicename>ad2c</devicename> and <devicename>ad3c</devicename> that
<para>This creates a bsdlabel for <devicename>ad1c</devicename>, <devicename>ad2c</devicename> and <devicename>ad3c</devicename> that
spans the entire disk.</para>
<note><para>Since &os;&nbsp;5.1-RELEASE, the &man.bsdlabel.8;
utility replaces the old &man.disklabel.8; program. With
&man.bsdlabel.8; a number of obsolete options and parameters
have been retired; in the examples above the option
<option>-r</option> should be removed. For more
information, please refer to the &man.bsdlabel.8;
manual page.</para></note>
<para>The next step is to change the disk label type. You
can use &man.disklabel.8; to edit the
can use &man.bsdlabel.8; to edit the
disks:</para>
<programlisting>disklabel -e ad1
disklabel -e ad2
disklabel -e ad3</programlisting>
<programlisting>bsdlabel -e ad1
bsdlabel -e ad2
bsdlabel -e ad3</programlisting>
<para>This opens up the current disk label on each disk with
the editor specified by the <envar>EDITOR</envar>
@ -499,17 +467,6 @@ disklabel -e ad3</programlisting>
<sect4 id="ccd-buildingfs">
<title>Building the File System</title>
<para>The device node for
<devicename>ccd0c</devicename> may not exist yet, so to
create it, perform the following commands:</para>
<programlisting>cd /dev
sh MAKEDEV ccd0</programlisting>
<note><para>In FreeBSD 5.0, &man.devfs.5; will automatically
manage device nodes in <filename>/dev</filename>, so use of
<command>MAKEDEV</command> is not necessary.</para></note>
<para>Now that you have all the disks labeled, you must
build the &man.ccd.4;. To do that,
use &man.ccdconfig.8;, with options similar to the following:</para>
@ -788,22 +745,13 @@ device umass</programlisting>
</note>
<para>Support for USB 2.0 controllers is provided on
&os;&nbsp;5.X, and on the 4.X branch since &os;&nbsp;4.10-RELEASE.
You have to add:</para>
&os;; however, you must add:</para>
<programlisting>device ehci</programlisting>
<para>to your configuration file for USB 2.0 support. Note
&man.uhci.4; and &man.ohci.4; drivers are still needed if you
want USB 1.X support.</para>
<note>
<para>On &os;&nbsp;4.X, the USB daemon (&man.usbd.8;) must be
running to be able to see some USB devices. To enable it,
add <literal>usbd_enable="YES"</literal> to your
<filename>/etc/rc.conf</filename> file and reboot the
machine.</para>
</note>
</sect2>
<sect2>
@ -1020,16 +968,9 @@ umass0: detached</screen>
<screen>&prompt.root; <userinput>mkisofs -R -no-emul-boot -b boot/cdboot -o /tmp/bootable.iso /tmp/myboot</userinput></screen>
<para>Having done that, if you have <devicename>vn</devicename>
(FreeBSD&nbsp;4.X), or <devicename>md</devicename>
(FreeBSD&nbsp;5.X)
<para>Having done that, if you have <devicename>md</devicename>
configured in your kernel, you can mount the file system with:</para>
<screen>&prompt.root; <userinput>vnconfig -e vn0c /tmp/bootable.iso</userinput>
&prompt.root; <userinput>mount -t cd9660 /dev/vn0c /mnt</userinput></screen>
<para>for FreeBSD&nbsp;4.X, and for FreeBSD&nbsp;5.X:</para>
<screen>&prompt.root; <userinput>mdconfig -a -t vnode -f /tmp/bootable.iso -u 0</userinput>
&prompt.root; <userinput>mount -t cd9660 /dev/md0 /mnt</userinput></screen>
@ -1058,7 +999,7 @@ umass0: detached</screen>
<para>Will burn a copy of <replaceable>imagefile.iso</replaceable> on
<replaceable>cddevice</replaceable>. The default device is
<filename>/dev/acd0</filename> (or <filename>/dev/acd0c</filename> under &os;&nbsp;4.X). See &man.burncd.8; for options to
<filename>/dev/acd0</filename>. See &man.burncd.8; for options to
set the write speed, eject the CD after burning, and write audio
data.</para>
</sect2>
@ -1093,7 +1034,7 @@ umass0: detached</screen>
<secondary>burning</secondary>
</indexterm>
<screen>&prompt.root; <userinput>cdrecord -scanbus</userinput>
Cdrecord 1.9 (i386-unknown-freebsd4.2) Copyright (C) 1995-2000 J&ouml;rg Schilling
Cdrecord-Clone 2.01 (i386-unknown-freebsd7.0) Copyright (C) 1995-2004 J&ouml;rg Schilling
Using libscg version 'schily-0.1'
scsibus0:
0,0,0 0) 'SEAGATE ' 'ST39236LW ' '0004' Disk
@ -1173,15 +1114,6 @@ scsibus1:
<screen>&prompt.root; <userinput>dd if=/dev/acd0 of=/dev/null count=1</userinput></screen>
<note><para>In &os; 4.X, the entries are not prefixed with
zero. If the necessary entries in <filename>/dev</filename>
are missing, use <command>MAKEDEV</command> to create
them:</para>
<screen>&prompt.root; <userinput>cd /dev</userinput>
&prompt.root; <userinput>sh MAKEDEV acd0t99</userinput></screen>
</note>
</step>
<step>
@ -1213,9 +1145,7 @@ scsibus1:
&man.mkisofs.8;, and you can use it to duplicate
any data CD. The example given here assumes that your CDROM
device is <devicename>acd0</devicename>. Substitute your
correct CDROM device. Under &os;&nbsp;4.X, a <literal>c</literal> must be appended
to the end of the device name to indicate the entire partition
or, in the case of CDROMs, the entire disc.</para>
correct CDROM device.</para>
<screen>&prompt.root; <userinput>dd if=/dev/acd0 of=file.iso bs=2048</userinput></screen>
@ -1260,7 +1190,7 @@ scsibus1:
oddly, however. For example, Joliet disks store all filenames
in two-byte Unicode characters. The FreeBSD kernel does not
speak Unicode (yet!), so non-English characters show up as
question marks. (If you are running FreeBSD 4.3 or later, the
question marks. (The FreeBSD
CD9660 driver includes hooks to load an appropriate Unicode
conversion table on the fly. Modules for some of the common
encodings are available via the
@ -1797,44 +1727,9 @@ cd0: Attempt to query device size failed: NOT READY, Medium not present - tray c
<para>Floppy disks are accessed through entries in
<filename>/dev</filename>, just like other devices. To
access the raw floppy disk in 4.X and earlier releases, one
uses
<filename>/dev/fd<replaceable>N</replaceable></filename>,
where <replaceable>N</replaceable> stands for the drive
number, usually 0, or
<filename>/dev/fd<replaceable>NX</replaceable></filename>,
where <replaceable>X</replaceable> stands for a
letter.</para>
<para>In 5.0 or newer releases, simply use
access the raw floppy disk, simply use
<filename>/dev/fd<replaceable>N</replaceable></filename>.</para>
<sect4>
<title>The Disk Size in 4.X and Earlier Releases</title>
<para>There are also <filename>/dev/fd<replaceable>N</replaceable>.<replaceable>size</replaceable></filename>
devices, where <replaceable>size</replaceable> is a floppy disk
size in kilobytes. These entries are used at low-level format
time to determine the disk size. 1440kB is the size that will be
used in the following examples.</para>
<para>Sometimes the entries under <filename>/dev</filename> will
have to be (re)created. To do that, issue:</para>
<screen>&prompt.root; <userinput>cd /dev &amp;&amp; ./MAKEDEV "fd*"</userinput></screen>
</sect4>
<sect4>
<title>The Disk Size in 5.0 and Newer Releases</title>
<para>In 5.0, &man.devfs.5; will automatically
manage device nodes in <filename>/dev</filename>, so use of
<command>MAKEDEV</command> is not necessary.</para>
<para>The desired disk size is passed to &man.fdformat.1; through
the <option>-f</option> flag. Supported sizes are listed in
&man.fdcontrol.8;, but be advised that 1440kB is what works best.</para>
</sect4>
</sect3>
<sect3>
@ -1854,19 +1749,7 @@ cd0: Attempt to query device size failed: NOT READY, Medium not present - tray c
determine if the disk is good or bad.</para>
<sect4>
<title>Formatting in 4.X and Earlier Releases</title>
<para>Use the
<filename>/dev/fd<replaceable>N</replaceable>.<replaceable>size</replaceable></filename>
devices to format the floppy. Insert a new 3.5inch floppy
disk in your drive and issue:</para>
<screen>&prompt.root; <userinput>/usr/sbin/fdformat /dev/fd0.1440</userinput></screen>
</sect4>
<sect4>
<title>Formatting in 5.0 and Newer Releases</title>
<title>Formatting Floppy Disks</title>
<para>Use the
<filename>/dev/fd<replaceable>N</replaceable></filename>
@ -1879,8 +1762,6 @@ cd0: Attempt to query device size failed: NOT READY, Medium not present - tray c
</sect3>
</sect2>
<sect2>
<title>The Disk Label</title>
@ -1894,12 +1775,12 @@ cd0: Attempt to query device size failed: NOT READY, Medium not present - tray c
floppy. The geometry values for the disk label are listed in
<filename>/etc/disktab</filename>.</para>
<para>You can run now &man.disklabel.8; like so:</para>
<para>You can run now &man.bsdlabel.8; like so:</para>
<screen>&prompt.root; <userinput>/sbin/disklabel -B -r -w /dev/fd0 fd1440</userinput></screen>
<screen>&prompt.root; <userinput>/sbin/bsdlabel -B -r -w /dev/fd0 fd1440</userinput></screen>
<note><para>Since &os;&nbsp;5.1-RELEASE, the &man.bsdlabel.8;
utility replaces the old &man.disklabel.8; program. With
utility replaces the old &man.bsdlabel.8; program. With
&man.bsdlabel.8; a number of obsolete options and parameters
have been retired; in the example above the option
<option>-r</option> should be removed. For more
@ -1931,9 +1812,7 @@ cd0: Attempt to query device size failed: NOT READY, Medium not present - tray c
<sect2>
<title>Using the Floppy</title>
<para>To use the floppy, mount it with &man.mount.msdos.8; (in
4.X and earlier releases) or &man.mount.msdosfs.8; (in 5.0 or
newer releases). One can also use
<para>To use the floppy, mount it with &man.mount.msdos.8;. One can also use
<filename role="package">emulators/mtools</filename> from the ports
collection.</para>
</sect2>
@ -2607,11 +2486,11 @@ sa0(ncr1:4:0): Logical unit is in process of becoming ready</screen>
<para>There are only four steps that you need to perform in
preparation for any disaster that may occur.</para>
<indexterm>
<primary><command>disklabel</command></primary>
<primary><command>bsdlabel</command></primary>
</indexterm>
<para>First, print the disklabel from each of your disks
(e.g. <command>disklabel da0 | lpr</command>), your file system table
<para>First, print the bsdlabel from each of your disks
(e.g. <command>bsdlabel da0 | lpr</command>), your file system table
(<filename>/etc/fstab</filename>) and all boot messages,
two copies of
each.</para>
@ -2627,7 +2506,7 @@ sa0(ncr1:4:0): Logical unit is in process of becoming ready</screen>
<para>Otherwise, you have to create two custom bootable
floppies which have a kernel that can mount all of your disks
and access your tape drive. These floppies must contain:
<command>fdisk</command>, <command>disklabel</command>,
<command>fdisk</command>, <command>bsdlabel</command>,
<command>newfs</command>, <command>mount</command>, and
whichever backup program you use. These programs must be
statically linked. If you use <command>dump</command>, the
@ -2674,7 +2553,7 @@ fi
# place boot blocks on the floppy
#
disklabel -w -B /dev/fd0c fd1440
bsdlabel -w -B /dev/fd0c fd1440
#
# newfs the one and only partition
@ -2848,14 +2727,14 @@ echo "The floppy has been unmounted and is now ready."]]></programlisting>
</indexterm>
<indexterm><primary>root partition</primary></indexterm>
<indexterm>
<primary><command>disklabel</command></primary>
<primary><command>bsdlabel</command></primary>
</indexterm>
<indexterm>
<primary><command>newfs</command></primary>
</indexterm>
<para>Try to <command>mount</command> (e.g. <command>mount /dev/da0a
/mnt</command>) the root partition of your first disk. If the
disklabel was damaged, use <command>disklabel</command> to re-partition and
bsdlabel was damaged, use <command>bsdlabel</command> to re-partition and
label the disk to match the label that you printed and saved. Use
<command>newfs</command> to re-create the file systems. Re-mount the root
partition of the floppy read-write (<command>mount -u -o rw
@ -2920,73 +2799,19 @@ echo "The floppy has been unmounted and is now ready."]]></programlisting>
memory-based file systems.</para>
<note>
<para>The FreeBSD&nbsp;4.X users will have to use &man.MAKEDEV.8;
to create the required devices. FreeBSD&nbsp;5.0 and later use
&man.devfs.5; to allocate device nodes transparently for the
<para>Use &man.devfs.5; to allocate device nodes transparently for the
user.</para>
</note>
<sect2 id="disks-vnconfig">
<title>File-Backed File System under FreeBSD&nbsp;4.X</title>
<indexterm>
<primary>disks</primary>
<secondary>file-backed (4.X)</secondary>
</indexterm>
<para>The utility &man.vnconfig.8; configures and enables vnode pseudo-disk
devices. A <firstterm>vnode</firstterm> is a representation
of a file, and is the focus of file activity. This means that
&man.vnconfig.8; uses files to create and operate a
file system. One possible use is the mounting of floppy or CD
images kept in files.</para>
<para>To use &man.vnconfig.8;, you need &man.vn.4; support in your
kernel configuration file:</para>
<programlisting>pseudo-device vn</programlisting>
<para>To mount an existing file system image:</para>
<example>
<title>Using vnconfig to Mount an Existing File System
Image under FreeBSD&nbsp;4.X</title>
<screen>&prompt.root; <userinput>vnconfig vn<replaceable>0</replaceable> <replaceable>diskimage</replaceable></userinput>
&prompt.root; <userinput>mount /dev/vn<replaceable>0</replaceable>c <replaceable>/mnt</replaceable></userinput></screen>
</example>
<para>To create a new file system image with &man.vnconfig.8;:</para>
<example>
<title>Creating a New File-Backed Disk with <command>vnconfig</command></title>
<screen>&prompt.root; <userinput>dd if=/dev/zero of=<replaceable>newimage</replaceable> bs=1k count=<replaceable>5</replaceable>k</userinput>
5120+0 records in
5120+0 records out
&prompt.root; <userinput>vnconfig -s labels -c vn<replaceable>0</replaceable> <replaceable>newimage</replaceable></userinput>
&prompt.root; <userinput>disklabel -r -w vn<replaceable>0</replaceable> auto</userinput>
&prompt.root; <userinput>newfs vn<replaceable>0</replaceable>c</userinput>
Warning: 2048 sector(s) in last cylinder unallocated
/dev/vn0c: 10240 sectors in 3 cylinders of 1 tracks, 4096 sectors
5.0MB in 1 cyl groups (16 c/g, 32.00MB/g, 1280 i/g)
super-block backups (for fsck -b #) at:
32
&prompt.root; <userinput>mount /dev/vn<replaceable>0</replaceable>c <replaceable>/mnt</replaceable></userinput>
&prompt.root; <userinput>df <replaceable>/mnt</replaceable></userinput>
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/vn0c 4927 1 4532 0% /mnt</screen>
</example>
</sect2>
<sect2 id="disks-mdconfig">
<title>File-Backed File System under FreeBSD&nbsp;5.X</title>
<title>File-Backed File System</title>
<indexterm>
<primary>disks</primary>
<secondary>file-backed (5.X)</secondary>
<secondary>file-backed</secondary>
</indexterm>
<para>The utility &man.mdconfig.8; is used to configure and enable
memory disks, &man.md.4;, under FreeBSD&nbsp;5.X. To use
memory disks, &man.md.4;, under FreeBSD. To use
&man.mdconfig.8;, you have to load &man.md.4; module or to add
the support in your kernel configuration file:</para>
@ -3002,7 +2827,7 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
<example>
<title>Using <command>mdconfig</command> to Mount an Existing File System
Image under FreeBSD&nbsp;5.X</title>
Image</title>
<screen>&prompt.root; <userinput>mdconfig -a -t vnode -f <replaceable>diskimage</replaceable> -u <replaceable>0</replaceable></userinput>
&prompt.root; <userinput>mount /dev/md<replaceable>0</replaceable> <replaceable>/mnt</replaceable></userinput></screen>
@ -3017,16 +2842,16 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
5120+0 records in
5120+0 records out
&prompt.root; <userinput>mdconfig -a -t vnode -f <replaceable>newimage</replaceable> -u <replaceable>0</replaceable></userinput>
&prompt.root; <userinput>disklabel -r -w md<replaceable>0</replaceable> auto</userinput>
&prompt.root; <userinput>newfs md<replaceable>0</replaceable>c</userinput>
/dev/md0c: 5.0MB (10240 sectors) block size 16384, fragment size 2048
using 4 cylinder groups of 1.27MB, 81 blks, 256 inodes.
&prompt.root; <userinput>bsdlabel -w md<replaceable>0</replaceable> auto</userinput>
&prompt.root; <userinput>newfs md<replaceable>0</replaceable>a</userinput>
/dev/md0a: 5.0MB (10224 sectors) block size 16384, fragment size 2048
using 4 cylinder groups of 1.25MB, 80 blks, 192 inodes.
super-block backups (for fsck -b #) at:
32, 2624, 5216, 7808
&prompt.root; <userinput>mount /dev/md<replaceable>0</replaceable>c <replaceable>/mnt</replaceable></userinput>
160, 2720, 5280, 7840
&prompt.root; <userinput>mount /dev/md<replaceable>0</replaceable>a <replaceable>/mnt</replaceable></userinput>
&prompt.root; <userinput>df <replaceable>/mnt</replaceable></userinput>
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/md0c 4846 2 4458 0% /mnt</screen>
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/md0a 4710 4 4330 0% /mnt</screen>
</example>
<para>If you do not specify the unit number with the
@ -3036,17 +2861,9 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
<devicename>md4</devicename>. For more details about
&man.mdconfig.8;, please refer to the manual page.</para>
<note><para>Since &os;&nbsp;5.1-RELEASE, the &man.bsdlabel.8;
utility replaces the old &man.disklabel.8; program. With
&man.bsdlabel.8; a number of obsolete options and parameters
have been retired; in the example above the option
<option>-r</option> should be removed. For more
information, please refer to the &man.bsdlabel.8;
manual page.</para></note>
<para>The utility &man.mdconfig.8; is very useful, however it
asks many command lines to create a file-backed file system.
FreeBSD&nbsp;5.0 also comes with a tool called &man.mdmfs.8;,
FreeBSD also comes with a tool called &man.mdmfs.8;,
this program configures a &man.md.4; disk using
&man.mdconfig.8;, puts a UFS file system on it using
&man.newfs.8;, and mounts it using &man.mount.8;. For example,
@ -3061,7 +2878,7 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
&prompt.root; <userinput>mdmfs -F <replaceable>newimage</replaceable> -s <replaceable>5</replaceable>m md<replaceable>0</replaceable> <replaceable>/mnt</replaceable></userinput>
&prompt.root; <userinput>df <replaceable>/mnt</replaceable></userinput>
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/md0 4846 2 4458 0% /mnt</screen>
/dev/md0 4718 4 4338 0% /mnt</screen>
</example>
<para>If you use the option <option>md</option> without unit
@ -3071,47 +2888,23 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
</sect2>
<sect2 id="disks-md-freebsd4">
<title>Memory-Based File System under FreeBSD&nbsp;4.X</title>
<indexterm>
<primary>disks</primary>
<secondary>memory file system (4.X)</secondary>
</indexterm>
<para>The &man.md.4; driver is a simple, efficient means to create memory
file systems under FreeBSD&nbsp;4.X. &man.malloc.9; is used
to allocate the memory.</para>
<para>Simply take a file system you have prepared with, for
example, &man.vnconfig.8;, and:</para>
<example>
<title>md Memory Disk under FreeBSD&nbsp;4.X</title>
<screen>&prompt.root; <userinput>dd if=<replaceable>newimage</replaceable> of=/dev/md<replaceable>0</replaceable></userinput>
5120+0 records in
5120+0 records out
&prompt.root; <userinput>mount /dev/md<replaceable>0c</replaceable> <replaceable>/mnt</replaceable></userinput>
&prompt.root; <userinput>df <replaceable>/mnt</replaceable></userinput>
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/md0c 4927 1 4532 0% /mnt</screen>
</example>
<para>For more details, please refer to &man.md.4; manual
page.</para>
</sect2>
<sect2 id="disks-md-freebsd5">
<title>Memory-Based File System under FreeBSD&nbsp;5.X</title>
<title>Memory-Based File System</title>
<indexterm>
<primary>disks</primary>
<secondary>memory file system (5.X)</secondary>
<secondary>memory file system</secondary>
</indexterm>
<para>The same tools are used for memory-based and file-backed
file systems: &man.mdconfig.8; or &man.mdmfs.8;. The storage
for memory-based file system is allocated with
&man.malloc.9;.</para>
<para>For a
memory-based file system the <quote>swap backing</quote>
should normally be used. Using swap backing does not mean
that the memory disk will be swapped out to disk by default,
but merely that the memory disk will be allocated from a
memory pool which can be swapped out to disk if needed. It is
also possible to create memory-based disk which are
&man.malloc.9; backed, but using malloc backed memory disks,
especially large ones, can result in a system panic if the
kernel runs out of memory.</para>
<example>
<title>Creating a New Memory-Based Disk with
@ -3170,13 +2963,6 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
&man.md.4; devices in using the command <command>mdconfig
-l</command>.</para>
<para>For FreeBSD&nbsp;4.X, &man.vnconfig.8; is used to detach
the device. For example to detach and free all resources
used by <filename>/dev/vn4</filename>:</para>
<screen>&prompt.root; <userinput>vnconfig -u vn<replaceable>4</replaceable></userinput></screen>
</sect2>
</sect1>
@ -3199,7 +2985,7 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
<secondary>snapshots</secondary>
</indexterm>
<para>FreeBSD&nbsp;5.0 offers a new feature in conjunction with
<para>FreeBSD offers a feature in conjunction with
<link linkend="soft-updates">Soft Updates</link>: File system snapshots.</para>
<para>Snapshots allow a user to create images of specified file
@ -3593,15 +3379,6 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
Password:</screen>
</step>
<step>
<title>Verify the Operating System Version</title>
<para>&man.gbde.4; requires FreeBSD 5.0 or higher.</para>
<screen>&prompt.root; <userinput>uname -r</userinput>
5.0-RELEASE</screen>
</step>
<step>
<title>Add &man.gbde.4; Support to the Kernel Configuration File</title>
@ -3742,9 +3519,6 @@ sector_size = 2048
initialize the old UFS1 file system, using &man.newfs.8; with
the <option>-O2</option> option is recommended.</para>
<note><para>The <option>-O2</option> option is the default
with &os;&nbsp;5.1-RELEASE and later.</para></note>
<screen>&prompt.root; <userinput>newfs -U -O2 /dev/ad4s1c.bde</userinput></screen>
<note>
@ -4100,6 +3874,137 @@ geli_da2_flags="-p -k /root/da2.key"</screen>
</sect3>
</sect2>
</sect1>
<sect1 id="swap-encrypting">
<sect1info>
<authorgroup>
<author>
<firstname>Christian</firstname>
<surname>Br&uuml;ffer</surname>
<contrib>Written by </contrib>
</author>
</authorgroup>
</sect1info>
<title>Encrypting Swap Space</title>
<indexterm>
<primary>swap</primary>
<secondary>encrypting</secondary>
</indexterm>
<para>Swap encryption in &os; is easy to configure and has been
available since &os; 5.3-RELEASE. Depending on which version
of &os; is being used, different options are available
and configuration can vary slightly. From &os; 6.0-RELEASE onwards,
the &man.gbde.8; or &man.geli.8; encryption systems can be used
for swap encryption. With earlier versions, only &man.gbde.8; is
available. Both systems use the <filename>encswap</filename>
<link linkend="configtuning-rcd">rc.d</link> script.</para>
<para>The previous section, <link linkend="disks-encrypting">Encrypting
Disk Partitions</link>, includes a short discussion on the different
encryption systems.</para>
<sect2>
<title>Why should Swap be Encrypted?</title>
<para>Like the encryption of disk partitions, encryption of swap space
is done to protect sensitive information. Imagine an application
that e.g. deals with passwords. As long as these passwords stay in
physical memory, all is well. However, if the operating system starts
swapping out memory pages to free space for other applications, the
passwords may be written to the disk platters unencrypted and easy to
retrieve for an adversary. Encrypting swap space can be a solution for
this scenario.</para>
</sect2>
<sect2>
<title>Preparation</title>
<note>
<para>For the remainder of this section, <devicename>ad0s1b</devicename>
will be the swap partition.</para>
</note>
<para>Up to this point the swap has been unencrypted. It is possible that
there are already passwords or other sensitive data on the disk platters
in cleartext. To rectify this, the data on the swap partition should be
overwritten with random garbage:</para>
<screen>&prompt.root; <userinput>dd if=/dev/random of=/dev/ad0s1b bs=1m</userinput></screen>
</sect2>
<sect2>
<title>Swap Encryption with &man.gbde.8;</title>
<para>If &os; 6.0-RELEASE or newer is being used, the
<literal>.bde</literal> suffix should be added to the device in the
respective <filename>/etc/fstab</filename> swap line:</para>
<screen>
# Device Mountpoint FStype Options Dump Pass#
/dev/ad0s1b.bde none swap sw 0 0
</screen>
<para>For systems prior to &os; 6.0-RELEASE, the following line
in <filename>/etc/rc.conf</filename> is also needed:</para>
<programlisting>gbde_swap_enable="YES"</programlisting>
</sect2>
<sect2>
<title>Swap Encryption with &man.geli.8;</title>
<para>Alternatively, the procedure for using &man.geli.8; for swap
encryption is similar to that of using &man.gbde.8;. The
<literal>.eli</literal> suffix should be added to the device in the
respective <filename>/etc/fstab</filename> swap line:</para>
<screen>
# Device Mountpoint FStype Options Dump Pass#
/dev/ad0s1b.eli none swap sw 0 0
</screen>
<para>&man.geli.8; uses the <acronym>AES</acronym> algorithm with
a key length of 256 bit by default.</para>
<para>Optionally, these defaults can be altered using the
<literal>geli_swap_flags</literal> option in
<filename>/etc/rc.conf</filename>. The following line tells the
<filename>encswap</filename> rc.d script to create &man.geli.8; swap
partitions using the Blowfish algorithm with a key length of 128 bit,
a sectorsize of 4 kilobytes and the <quote>detach on last close</quote>
option set:</para>
<programlisting>geli_swap_flags="-a blowfish -l 128 -s 4096 -d"</programlisting>
<para>Please refer to the description of the <command>onetime</command> command
in the &man.geli.8; manual page for a list of possible options.</para>
</sect2>
<sect2>
<title>Verifying that it Works</title>
<para>Once the system has been rebooted, proper operation of the
encrypted swap can be verified using the
<command>swapinfo</command> command.</para>
<para>If &man.gbde.8; is being used:</para>
<screen>&prompt.user; <userinput>swapinfo</userinput>
Device 1K-blocks Used Avail Capacity
/dev/ad0s1b.bde 542720 0 542720 0%
</screen>
<para>If &man.geli.8; is being used:</para>
<screen>&prompt.user; <userinput>swapinfo</userinput>
Device 1K-blocks Used Avail Capacity
/dev/ad0s1b.eli 542720 0 542720 0%
</screen>
</sect2>
</sect1>
</chapter>
<!--