1 <?xml version="1.0" encoding="UTF-8"?>
3 <title>The Demand-Attach File Server</title>
5 <para>This chapter explains and describes the Demand-Attach File Server (DAFS
6 for short), a new feature in OpenAFS 1.6. A few things are different when
7 setting up and maintaining a DAFS fileserver vs a traditional fileserver, so
8 it is important to know which one you are running.</para>
10 <para>If you are trying to decide whether or not to run DAFS on a fileserver,
11 note that you can switch between DAFS and the traditional fileserver fairly
12 easily at any time. Aside from performance differences, the two fileservers
13 generally look and act similarly, so choosing one over the other in the
14 beginning should not hurt you later on. So, if you are not overly concerned
15 with performance, you can just pick one and follow the directions for it, and
16 you should be fine.</para>
19 <title>Justification and Background</title>
21 <para>DAFS changes many things with how the fileserver and other server
22 processes access volumes on disk. Most of these changes are only of concern
23 to developers, as there are no visible differences to users or
24 administrators. A few changes are only of concern to administrators while
25 debugging a problem, and only one or two changes affect the day-to-day
26 administration of a fileserver. See the sections on <link
27 linkend="DAFS002">DAFS Binaries</link> and <link
28 linkend="DAFS003">Salvaging</link> for the main functional
31 <para>Among other things, DAFS provides a new way for the fileserver and
32 other server programs to access volumes. It does not change how file data is
33 accessed inside a volume (like namei or inode do), but rather how a volume
34 as a whole is accessed by the fileserver. When a traditional fileserver is
35 started, it will locate and attach all AFS volumes it can find on all AFS
36 partitions on the server. This attachment process involves reading the
37 volume header and setting a flag to say that the volume is in use. On a
38 clean shutdown, the fileserver detach all volumes it attached by clearing
39 that flag. If the fileserver encounters a volume where the flag is already
40 set before it attached the volume, it will know that volume was not detached
41 cleanly, and that it needs to be salvaged.</para>
43 <para>This process of attaching and detaching at startup and shutdown takes
44 time. When fileservers start to have thousands of volumes, it can take
45 several minutes to start or cleanly shutdown. Additionally, when a
46 fileserver is shutdown uncleanly, all of the volumes on the server must be
47 salvaged before the fileserver can be brought up again. Even volumes that
48 nobody has ever accessed must be salvaged.</para>
50 <para>To improve this situation, DAFS does not attach all volumes on
51 startup. Instead, volumes are only attached when they are first accessed,
52 and are detached if idle for a long period of time (see the -vlru* options
53 for the fileserver; this is configurable but is generally several
56 <para>Thus, after an unclean shutdown with DAFS, only the volumes in use at
57 the time of the shutdown need to be salvaged. In addition, the fileserver
58 does not need to wait for salvaging to finish before starting up. Instead of
59 salvaging everything before the fileserver starts, the fileserver causes
60 salvages to be issued on a volume when a damanged volume is accessed (called
61 "demand-salvages").</para>
63 <para>The result of all of this is that a fileserver running DAFS can
64 generally be started and stopped in a manner of seconds, where a traditional
65 fileserver could take dozens of minutes, or even hours in the case of an
66 unclean shutdown.</para>
69 <title>DAFS Binaries</title>
71 <para>OpenAFS ships with binaries for DAFS and non-DAFS alongside each
72 other. Programs that exist in both DAFS and non-DAFS variants typically have
73 a <emphasis role="bold">da</emphasis> prefix to indicate the DAFS variant.
74 For example, <emphasis role="bold">dafileserver</emphasis> is the DAFS
75 version of the traditional <emphasis role="bold">fileserver</emphasis>
76 binary. Similarly for <emphasis role="bold">davolserver</emphasis> and
77 <emphasis role="bold">volserver</emphasis>, <emphasis
78 role="bold">dasalvager</emphasis> and <emphasis
79 role="bold">salvager</emphasis>, and even some other tools like <emphasis
80 role="bold">dafssync-debug</emphasis> and <emphasis
81 role="bold">fssync-debug</emphasis>.</para>
83 <para>A DAFS-enabled fileserver will run the <emphasis
84 role="bold">dafs</emphasis> bnode in bosserver, instead of the traditional
85 fileserver's <emphasis role="bold">fs</emphasis> bnode. The <emphasis
86 role="bold">dafs</emphasis> bnode runs four different binaries as opposed to
87 the <emphasis role="bold">fs</emphasis> bnode's three. Three of the programs
88 in the <emphasis role="bold">dafs</emphasis> bnode are just DAFS equivalents
89 of the corresponding <emphasis role="bold">fs</emphasis> bnode programs, but
90 the fourth one is an entirely new daemon that has no non-DAFS equivalent:
91 the salvageserver.</para>
95 <colspec colwidth="50*" />
96 <colspec colwidth="50*" />
99 <entry><emphasis role="bold">Traditional binary</emphasis></entry>
100 <entry><emphasis role="bold">DAFS binary</emphasis></entry>
106 <entry><emphasis role="bold">/usr/afs/bin/fileserver</emphasis></entry>
107 <entry><emphasis role="bold">/usr/afs/bin/dafileserver</emphasis></entry>
110 <entry><emphasis role="bold">/usr/afs/bin/volserver</emphasis></entry>
111 <entry><emphasis role="bold">/usr/afs/bin/davolserver</emphasis></entry>
114 <entry>No equivalent</entry>
115 <entry><emphasis role="bold">/usr/afs/bin/salvageserver</emphasis></entry>
118 <entry><emphasis role="bold">/usr/afs/bin/salvager</emphasis></entry>
119 <entry><emphasis role="bold">/usr/afs/bin/dasalvager</emphasis></entry>
127 <title>Salvaging</title>
129 <para>With a traditional fileserver, salvages usually occur in two
133 <para>The fileserver shuts down uncleanly, and when brought back up,
134 all partitions are salvaged before the fileserver is available.</para>
137 <para>A volume experiences some corruption after it has been brought
138 online, and an administrator manually schedules a salvage for an
139 individual volume with <emphasis role="bold">bos salvage</emphasis>.
140 Usually the way you notice this is that the fileserver noticed a
141 volume has become corrupt and has taken it offline.</para>
146 <para>With DAFS, neither of these occur in normal operation. With DAFS, a
147 volume will be salvaged automatically when a problem is detected in a
148 volume. This occurs whether the fileserver detects the volume was not
149 detached cleanly, or if the fileserver detects corrupt volume data.</para>
151 <para>In normal DAFS operation, you should not need to ever run <emphasis
152 role="bold">bos salvage</emphasis>. However, if you suspect a bug, or that
153 there is corruption in a volume that the fileserver has not detected, you
154 can run <emphasis role="bold">bos salvage</emphasis> to manually issue a
157 <para>All salvages scheduled from the salvageserver will be logged in
158 <emphasis role="bold">/usr/afs/logs/SalsrvLog</emphasis>, in the same format
159 as salvages for traditional fileservers are logged. If you issue a
160 whole-partition or whole-server salvage, the logs for that will still be
161 located in <emphasis role="bold">/usr/afs/logs/SalvageLog</emphasis>.</para>
165 <title>Converting a Fileserver to DAFS</title>
167 <para>If you have an existing traditional fileserver, you can convert it to
168 DAFS fairly easily. The conversion is in-place, but there is at least a
169 small amount of downtime involved even if nothing goes wrong, since the
170 fileserver processes must be restarted. If you want to avoid any downtime,
171 move any volumes on the fileserver to another fileserver before performing
172 the conversion.</para>
176 <para>If the fileserver is currently running a version of OpenAFS
177 earlier than 1.6.0, upgrade the fileserver to a version in the 1.6
178 series or later. This is not strictly necessary, but if you encounter
179 problems here, it is helpful to catch them before converting to DAFS so
180 as to isolate the problem.</para>
182 <para>If you do not upgrade the fileserver before converting to DAFS,
183 install the new OpenAFS binaries somewhere on the server.</para>
187 <para>If the current bosserver process running on the fileserver is
188 older than OpenAFS 1.6.0, you must upgrade it first. This can be done by
189 replacing the bosserver binary and running <emphasis role="bold">bos
190 restart -bosserver</emphasis>. This will cause <emphasis>all</emphasis>
191 AFS processes controlled by the bosserver to be restarted. You can do
192 this at the same as upgrading the fileserver in the previous step if
193 desired, to avoid restarting the fileserver twice.</para>
197 <para>Shutdown and stop the old <emphasis role="bold">fs</emphasis> bnode:
199 # <emphasis role="bold">bos stop </emphasis><<replaceable>machine name</replaceable>> <emphasis role="bold">fs -wait -cell </emphasis><<replaceable>cell name</replaceable>>
205 <para>Create and start the new <emphasis role="bold">dafs</emphasis> bnode.
207 # <emphasis role="bold">bos create </emphasis><<replaceable>machine name</replaceable>> <emphasis role="bold">dafs dafs</emphasis> \
208 <emphasis role="bold">-cmd</emphasis> '<emphasis role="bold">/usr/afs/bin/dafileserver</emphasis> <<replaceable>dafileserver options</replaceable>>' \
209 <emphasis role="bold">-cmd</emphasis> '<emphasis role="bold">/usr/afs/bin/davolserver</emphasis> <<replaceable>davolserver options</replaceable>>' \
210 <emphasis role="bold">-cmd</emphasis> '<emphasis role="bold">/usr/afs/bin/salvageserver</emphasis> <<replaceable>salvageserver options</replaceable>>' \
211 <emphasis role="bold">-cmd</emphasis> '<emphasis role="bold">/usr/afs/bin/dasalvager</emphasis> <<replaceable>dasalvager options</replaceable>>' \
212 <emphasis role="bold">-cell</emphasis> <<replaceable>cell name</replaceable>>
214 You can use the same options for the <emphasis
215 role="bold">dafileserver</emphasis> process as you did for the <emphasis
216 role="bold">fileserver</emphasis> process, and the same options for
217 <emphasis role="bold">davolserver</emphasis> as you did for <emphasis
218 role="bold">volserver</emphasis>.</para>
220 <para>You can also use most of the same options for the <emphasis
221 role="bold">salvageserver</emphasis> and <emphasis
222 role="bold">dasalvager</emphasis> processes as you did for the <emphasis
223 role="bold">salvager</emphasis> process; see their respective man pages.
224 However, if you are upgrading from the 1.4.x series of OpenAFS, be aware
225 that the <emphasis role="bold">-DontSalvage</emphasis> option does not
226 exist anymore for the salvager (with or without DAFS).</para>
228 <para>Also note that the <emphasis role="bold">dafileserver</emphasis>
229 process has many more options to tune dafs-specific parameters. See the
230 <emphasis role="bold">dafileserver</emphasis> man page for information
235 <para>After you have performed these steps, switching back and forth between
236 running a DAFS and a traditional fileserver is as simple a running <emphasis
237 role="bold">bos stop</emphasis> on one bnode, and <emphasis role="bold">bos
238 start</emphasis> on the other. Once you are confident that the DAFS
239 processes are running smoothly and you do not anticipate switching back to
240 the traditional fileserver, you can <emphasis role="bold">bos
241 delete</emphasis> the <emphasis role="bold">fs</emphasis> bnode.</para>