This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /upstream/2.1.0/doc/BackupPC.html

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1 - (show annotations)
Wed Jun 22 19:12:04 2005 UTC (17 years, 3 months ago) by dpavlin
File MIME type: text/html
File size: 211614 byte(s)
import of version 2.1.0

1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <title>BackupPC</title>
5 <link rev="made" href="mailto:craig@atheros.com" />
6 </head>
8 <body style="background-color: white">
9 <table border="0" width="100%" cellspacing="0" cellpadding="3">
10 <tr><td class="block" style="background-color: #cccccc" valign="middle">
11 <big><strong><span class="block">&nbsp;BackupPC</span></strong></big>
12 </td></tr>
13 </table>
15 <p><a name="__index__"></a></p>
16 <!-- INDEX BEGIN -->
18 <ul>
20 <li><a href="#backuppc_introduction">BackupPC Introduction</a></li>
21 <ul>
23 <li><a href="#overview">Overview</a></li>
24 <li><a href="#backup_basics">Backup basics</a></li>
25 <li><a href="#resources">Resources</a></li>
26 <li><a href="#road_map">Road map</a></li>
27 <li><a href="#you_can_help">You can help</a></li>
28 </ul>
30 <li><a href="#installing_backuppc">Installing BackupPC</a></li>
31 <ul>
33 <li><a href="#requirements">Requirements</a></li>
34 <li><a href="#how_much_disk_space_do_i_need">How much disk space do I need?</a></li>
35 <li><a href="#step_1__getting_backuppc">Step 1: Getting BackupPC</a></li>
36 <li><a href="#step_2__installing_the_distribution">Step 2: Installing the distribution</a></li>
37 <li><a href="#step_3__setting_up_config_pl">Step 3: Setting up config.pl</a></li>
38 <li><a href="#step_4__setting_up_the_hosts_file">Step 4: Setting up the hosts file</a></li>
39 <li><a href="#step_5__client_setup">Step 5: Client Setup</a></li>
40 <li><a href="#step_6__running_backuppc">Step 6: Running BackupPC</a></li>
41 <li><a href="#step_7__talking_to_backuppc">Step 7: Talking to BackupPC</a></li>
42 <li><a href="#step_8__cgi_interface">Step 8: CGI interface</a></li>
43 <li><a href="#how_backuppc_finds_hosts">How BackupPC Finds Hosts</a></li>
44 <li><a href="#other_installation_topics">Other installation topics</a></li>
45 <li><a href="#fixing_installation_problems">Fixing installation problems</a></li>
46 </ul>
48 <li><a href="#restore_functions">Restore functions</a></li>
49 <ul>
51 <li><a href="#cgi_restore_options">CGI restore options</a></li>
52 <li><a href="#commandline_restore_options">Command-line restore options</a></li>
53 </ul>
55 <li><a href="#archive_functions">Archive functions</a></li>
56 <ul>
58 <li><a href="#configuring_an_archive_host">Configuring an Archive Host</a></li>
59 <li><a href="#starting_an_archive">Starting an Archive</a></li>
60 </ul>
62 <li><a href="#backuppc_design">BackupPC Design</a></li>
63 <ul>
65 <li><a href="#some_design_issues">Some design issues</a></li>
66 <li><a href="#backuppc_operation">BackupPC operation</a></li>
67 <li><a href="#storage_layout">Storage layout</a></li>
68 <li><a href="#compressed_file_format">Compressed file format</a></li>
69 <li><a href="#rsync_checksum_caching">Rsync checksum caching</a></li>
70 <li><a href="#file_name_mangling">File name mangling</a></li>
71 <li><a href="#special_files">Special files</a></li>
72 <li><a href="#attribute_file_format">Attribute file format</a></li>
73 <li><a href="#optimizations">Optimizations</a></li>
74 <li><a href="#limitations">Limitations</a></li>
75 <li><a href="#security_issues">Security issues</a></li>
76 </ul>
78 <li><a href="#configuration_file">Configuration File</a></li>
79 <ul>
81 <li><a href="#modifying_the_main_configuration_file">Modifying the main configuration file</a></li>
82 <li><a href="#configuration_file_includes">Configuration file includes</a></li>
83 </ul>
85 <li><a href="#configuration_parameters">Configuration Parameters</a></li>
86 <ul>
88 <li><a href="#general_server_configuration">General server configuration</a></li>
89 <li><a href="#what_to_backup_and_when_to_do_it">What to backup and when to do it</a></li>
90 <li><a href="#general_perpc_configuration_settings">General per-PC configuration settings</a></li>
91 <li><a href="#email_reminders__status_and_messages">Email reminders, status and messages</a></li>
92 <li><a href="#cgi_user_interface_configuration_settings">CGI user interface configuration settings</a></li>
93 </ul>
95 <li><a href="#version_numbers">Version Numbers</a></li>
96 <li><a href="#author">Author</a></li>
97 <li><a href="#copyright">Copyright</a></li>
98 <li><a href="#credits">Credits</a></li>
99 <li><a href="#license">License</a></li>
100 </ul>
101 <!-- INDEX END -->
103 <hr />
104 <p>
105 </p>
106 <h1><a name="backuppc_introduction">BackupPC Introduction</a></h1>
107 <p>This documentation describes BackupPC version 2.1.0,
108 released on 20 Jun 2004.</p>
109 <p>
110 </p>
111 <h2><a name="overview">Overview</a></h2>
112 <p>BackupPC is a high-performance, enterprise-grade system for backing up
113 Unix, Linux and WinXX PCs, desktops and laptops to a server's disk.
114 BackupPC is highly configurable and easy to install and maintain.</p>
115 <p>Given the ever decreasing cost of disks and raid systems, it is now
116 practical and cost effective to backup a large number of machines onto
117 a server's local disk or network storage. For some sites this might be
118 the complete backup solution. For other sites additional permanent
119 archives could be created by periodically backing up the server to tape.</p>
120 <p>Features include:</p>
121 <ul>
122 <li>
123 A clever pooling scheme minimizes disk storage and disk I/O.
124 Identical files across multiple backups of the same or different PC
125 are stored only once (using hard links), resulting in substantial
126 savings in disk storage and disk writes.
127 <p></p>
128 <li>
129 Optional compression provides additional reductions in storage
130 (around 40%). The CPU impact of compression is low since only
131 new files (those not already in the pool) need to be compressed.
132 <p></p>
133 <li>
134 A powerful http/cgi user interface allows administrators to view log
135 files, configuration, current status and allows users to initiate and
136 cancel backups and browse and restore files from backups.
137 <p></p>
138 <li>
139 The http/cgi user interface has internationalization (i18n) support,
140 currently providing English, French, German, Spanish, Italian
141 and Dutch.
142 <p></p>
143 <li>
144 No client-side software is needed. On WinXX the standard smb
145 protocol is used to extract backup data. On linux or unix clients,
146 rsync or tar (over ssh/rsh/nfs) is used to extract backup data.
147 Alternatively, rsync can also be used on WinXX (using cygwin),
148 and Samba could be installed on the linux or unix client to
149 provide smb shares).
150 <p></p>
151 <li>
152 Flexible restore options. Single files can be downloaded from
153 any backup directly from the CGI interface. Zip or Tar archives
154 for selected files or directories from any backup can also be
155 downloaded from the CGI interface. Finally, direct restore to
156 the client machine (using smb or tar) for selected files or
157 directories is also supported from the CGI interface.
158 <p></p>
159 <li>
160 BackupPC supports mobile environments where laptops are only
161 intermittently connected to the network and have dynamic IP addresses
162 (DHCP). Configuration settings allow machines connected via slower WAN
163 connections (eg: dial up, DSL, cable) to not be backed up, even if they
164 use the same fixed or dynamic IP address as when they are connected
165 directly to the LAN.
166 <p></p>
167 <li>
168 Flexible configuration parameters allow multiple backups to be performed
169 in parallel, specification of which shares to backup, which directories
170 to backup or not backup, various schedules for full and incremental
171 backups, schedules for email reminders to users and so on. Configuration
172 parameters can be set system-wide or also on a per-PC basis.
173 <p></p>
174 <li>
175 Users are sent periodic email reminders if their PC has not
176 recently been backed up. Email content, timing and policies
177 are configurable.
178 <p></p>
179 <li>
180 BackupPC is Open Source software hosted by SourceForge.
181 <p></p></ul>
182 <p>
183 </p>
184 <h2><a name="backup_basics">Backup basics</a></h2>
185 <dl>
186 <dt><strong><a name="item_full_backup">Full Backup</a></strong><br />
187 </dt>
188 <dd>
189 A full backup is a complete backup of a share. BackupPC can be
190 configured to do a full backup at a regular interval (typically
191 weekly). BackupPC can be configured to keep a certain number
192 of full backups. Exponential expiry is also supported, allowing
193 full backups with various vintages to be kept (for example, a
194 settable number of most recent weekly fulls, plus a settable
195 number of older fulls that are 2, 4, 8, or 16 weeks apart).
196 </dd>
197 <p></p>
198 <dt><strong><a name="item_incremental_backup">Incremental Backup</a></strong><br />
199 </dt>
200 <dd>
201 An incremental backup is a backup of files that have changed (based on
202 their modification time) since the last successful full backup. For
203 SMB and tar, BackupPC backups all files that have changed since one
204 hour prior to the start of the last successful full backup. Rsync is
205 more clever: any files whose attributes have changed (ie: uid, gid,
206 mtime, modes, size) since the last full are backed up. Deleted, new
207 files and renamed files are detected by Rsync incrementals.
208 In constrast, SMB and tar incrementals are not able to detect deleted
209 files, renamed files or new files whose modification time is prior to
210 the last full dump.
211 </dd>
212 <dd>
213 <p>BackupPC can also be configured to keep a certain number of incremental
214 backups, and to keep a smaller number of very old incremental backups.
215 (BackupPC does not support multi-level incremental backups, although it
216 will in a future version.)</p>
217 </dd>
218 <dd>
219 <p>BackupPC's CGI interface ``fills-in'' incremental backups based on the
220 last full backup, giving every backup a ``full'' appearance. This makes
221 browsing and restoring backups easier.</p>
222 </dd>
223 <p></p>
224 <dt><strong><a name="item_partial_backup">Partial Backup</a></strong><br />
225 </dt>
226 <dd>
227 When a full backup fails or is canceled, and some files have already
228 been backed up, BackupPC keeps a partial backup containing just the
229 files that were backed up successfully. The partial backup is removed
230 when the next successful backup completes, or if another full backup
231 fails resulting in a newer partial backup. A failed full backup
232 that has not backed up any files, or any failed incremental backup,
233 is removed; no partial backup is saved in these cases.
234 </dd>
235 <dd>
236 <p>The partial backup may be browsed or used to restore files just like
237 a successful full or incremental backup.</p>
238 </dd>
239 <dd>
240 <p>With the rsync transfer method the partial backup is used to resume
241 the next full backup, avoiding the need to retransfer the file data
242 already in the partial backup.</p>
243 </dd>
244 <p></p>
245 <dt><strong><a name="item_identical_files">Identical Files</a></strong><br />
246 </dt>
247 <dd>
248 BackupPC pools identical files using hardlinks. By ``identical
249 files'' we mean files with identical contents, not necessary the
250 same permissions, ownership or modification time. Two files might
251 have different permissions, ownership, or modification time but
252 will still be pooled whenever the contents are identical. This
253 is possible since BackupPC stores the file meta-data (permissions,
254 ownership, and modification time) separately from the file contents.
255 </dd>
256 <p></p>
257 <dt><strong><a name="item_backup_policy">Backup Policy</a></strong><br />
258 </dt>
259 <dd>
260 Based on your site's requirements you need to decide what your backup
261 policy is. BackupPC is not designed to provide exact re-imaging of
262 failed disks. See <a href="#limitations">Limitations</a> for more information.
263 However, the addition of tar transport for linux/unix clients, plus
264 full support for special file types and unix attributes in v1.4.0
265 likely means an exact image of a linux/unix file system can be made.
266 </dd>
267 <dd>
268 <p>BackupPC saves backups onto disk. Because of pooling you can relatively
269 economically keep several weeks of old backups.</p>
270 </dd>
271 <dd>
272 <p>At some sites the disk-based backup will be adequate, without a
273 secondary tape backup. This system is robust to any single failure: if a
274 client disk fails or loses files, the BackupPC server can be used to
275 restore files. If the server disk fails, BackupPC can be restarted on a
276 fresh file system, and create new backups from the clients. The chance
277 of the server disk failing can be made very small by spending more money
278 on increasingly better RAID systems. However, there is still the risk
279 of catastrophic events like fires or earthquakes that can destroy
280 both the BackupPC server and the clients it is backing up if they
281 are physically nearby.</p>
282 </dd>
283 <dd>
284 <p>Some sites might choose to do periodic backups to tape or cd/dvd.
285 This backup can be done perhaps weekly using the archive function of
286 BackupPC.</p>
287 </dd>
288 <dd>
289 <p>Other users have reported success with removable disks to rotate the
290 BackupPC data drives, or using rsync to mirror the BackupPC data pool
291 offsite.</p>
292 </dd>
293 <p></p></dl>
294 <p>
295 </p>
296 <h2><a name="resources">Resources</a></h2>
297 <dl>
298 <dt><strong><a name="item_backuppc_home_page">BackupPC home page</a></strong><br />
299 </dt>
300 <dd>
301 The BackupPC Open Source project is hosted on SourceForge. The
302 home page can be found at:
303 </dd>
304 <dd>
305 <pre>
306 <a href="http://backuppc.sourceforge.net">http://backuppc.sourceforge.net</a></pre>
307 </dd>
308 <dd>
309 <p>This page has links to the current documentation, the SourceForge
310 project page and general information.</p>
311 </dd>
312 <p></p>
313 <dt><strong><a name="item_sourceforge_project">SourceForge project</a></strong><br />
314 </dt>
315 <dd>
316 The SourceForge project page is at:
317 </dd>
318 <dd>
319 <pre>
320 <a href="http://sourceforge.net/projects/backuppc">http://sourceforge.net/projects/backuppc</a></pre>
321 </dd>
322 <dd>
323 <p>This page has links to the current releases of BackupPC.</p>
324 </dd>
325 <p></p>
326 <dt><strong><a name="item_backuppc_faq">BackupPC FAQ</a></strong><br />
327 </dt>
328 <dd>
329 BackupPC has a FAQ at <a href="http://backuppc.sourceforge.net/faq">http://backuppc.sourceforge.net/faq</a>.
330 </dd>
331 <p></p>
332 <dt><strong><a name="item_mail_lists">Mail lists</a></strong><br />
333 </dt>
334 <dd>
335 Three BackupPC mailing lists exist for announcements (backuppc-announce),
336 developers (backuppc-devel), and a general user list for support, asking
337 questions or any other topic relevant to BackupPC (backuppc-users).
338 </dd>
339 <dd>
340 <p>The lists are archived on SourceForge and Gmane. The SourceForge lists
341 are not always up to date and the searching is limited, so Gmane is
342 a good alternative. See:</p>
343 </dd>
344 <dd>
345 <pre>
346 <a href="http://news.gmane.org/index.php?prefix=gmane.comp.sysutils.backup.backuppc">http://news.gmane.org/index.php?prefix=gmane.comp.sysutils.backup.backuppc</a>
347 <a href="http://sourceforge.net/mailarchive/forum.php?forum_id=503">http://sourceforge.net/mailarchive/forum.php?forum_id=503</a></pre>
348 </dd>
349 <dd>
350 <p>You can subscribe to these lists by visiting:</p>
351 </dd>
352 <dd>
353 <pre>
354 <a href="http://lists.sourceforge.net/lists/listinfo/backuppc-announce">http://lists.sourceforge.net/lists/listinfo/backuppc-announce</a>
355 <a href="http://lists.sourceforge.net/lists/listinfo/backuppc-users">http://lists.sourceforge.net/lists/listinfo/backuppc-users</a>
356 <a href="http://lists.sourceforge.net/lists/listinfo/backuppc-devel">http://lists.sourceforge.net/lists/listinfo/backuppc-devel</a></pre>
357 </dd>
358 <dd>
359 <p>The backuppc-announce list is moderated and is used only for
360 important announcements (eg: new versions). It is low traffic.
361 You only need to subscribe to one of backuppc-announce and
362 backuppc-users: backuppc-users also receives any messages on
363 backuppc-announce.</p>
364 </dd>
365 <dd>
366 <p>The backuppc-devel list is only for developers who are working on BackupPC.
367 Do not post questions or support requests there. But detailed technical
368 discussions should happen on this list.</p>
369 </dd>
370 <dd>
371 <p>To post a message to the backuppc-users list, send an email to</p>
372 </dd>
373 <dd>
374 <pre>
375 backuppc-users@lists.sourceforge.net</pre>
376 </dd>
377 <dd>
378 <p>Do not send subscription requests to this address!</p>
379 </dd>
380 <p></p>
381 <dt><strong><a name="item_other_programs_of_interest">Other Programs of Interest</a></strong><br />
382 </dt>
383 <dd>
384 If you want to mirror linux or unix files or directories to a remote server
385 you should consider rsync, <a href="http://rsync.samba.org">http://rsync.samba.org</a>. BackupPC now uses
386 rsync as a transport mechanism; if you are already an rsync user you
387 can think of BackupPC as adding efficient storage (compression and
388 pooling) and a convenient user interface to rsync.
389 </dd>
390 <dd>
391 <p>Unison is a utility that can do two-way, interactive, synchronization.
392 See <a href="http://www.cis.upenn.edu/~bcpierce/unison">http://www.cis.upenn.edu/~bcpierce/unison</a>.</p>
393 </dd>
394 <dd>
395 <p>Three popular open source packages that do tape backup are
396 Amanda (<a href="http://www.amanda.org">http://www.amanda.org</a>),
397 afbackup (<a href="http://sourceforge.net/projects/afbackup">http://sourceforge.net/projects/afbackup</a>), and
398 Bacula (<a href="http://www.bacula.org">http://www.bacula.org</a>).
399 Amanda can also backup WinXX machines to tape using samba.
400 These packages can be used as back ends to BackupPC to backup the
401 BackupPC server data to tape.</p>
402 </dd>
403 <dd>
404 <p>Various programs and scripts use rsync to provide hardlinked backups.
405 See, for example, Mike Rubel's site (<a href="http://www.mikerubel.org/computers/rsync_snapshots">http://www.mikerubel.org/computers/rsync_snapshots</a>),
406 JW Schultz's dirvish (<a href="http://www.pegasys.ws/dirvish">http://www.pegasys.ws/dirvish</a> (although as of
407 June 2004 this link doesn't work)),
408 Ben Escoto's rdiff-backup (<a href="http://rdiff-backup.stanford.edu">http://rdiff-backup.stanford.edu</a>),
409 and John Bowman's rlbackup (<a href="http://www.math.ualberta.ca/imaging/rlbackup">http://www.math.ualberta.ca/imaging/rlbackup</a>).</p>
410 </dd>
411 <dd>
412 <p>BackupPC provides many additional features, such as compressed storage,
413 hardlinking any matching files (rather than just files with the same name),
414 and storing special files without root privileges. But these other scripts
415 provide simple and effective solutions and are worthy of consideration.</p>
416 </dd>
417 <p></p></dl>
418 <p>
419 </p>
420 <h2><a name="road_map">Road map</a></h2>
421 <p>The new features planned for future releases of BackupPC
422 are at <a href="http://backuppc.sourceforge.net/faq/roadMap.html">http://backuppc.sourceforge.net/faq/roadMap.html</a>.</p>
423 <p>Comments and suggestions are welcome.</p>
424 <p>
425 </p>
426 <h2><a name="you_can_help">You can help</a></h2>
427 <p>BackupPC is free. I work on BackupPC because I enjoy doing it and I like
428 to contribute to the open source community.</p>
429 <p>BackupPC already has more than enough features for my own needs. The
430 main compensation for continuing to work on BackupPC is knowing that
431 more and more people find it useful. So feedback is certainly
432 appreciated, both positive and negative.</p>
433 <p>Beyond being a satisfied user and telling other people about it, everyone
434 is encouraged to add links to <a href="http://backuppc.sourceforge.net">http://backuppc.sourceforge.net</a>
435 (I'll see then via Google) or otherwise publicize BackupPC. Unlike
436 the commercial products in this space, I have a zero budget (in both
437 time and money) for marketing, PR and advertising, so it's up to
438 all of you! Feel free to vote for BackupPC at
439 <a href="http://freshmeat.net/projects/backuppc">http://freshmeat.net/projects/backuppc</a>.</p>
440 <p>Also, everyone is encouraged to contribute patches, bug reports, feature
441 and design suggestions, new code, FAQs, and documentation corrections or
442 improvements. Answering questions on the mail list is a big help too.</p>
443 <p>
444 <a href="#__index__"><small>Back to Top</small></a>
445 </p>
446 <hr />
447 <h1><a name="installing_backuppc">Installing BackupPC</a></h1>
448 <p>
449 </p>
450 <h2><a name="requirements">Requirements</a></h2>
451 <p>BackupPC requires:</p>
452 <ul>
453 <li>
454 A linux, solaris, or unix based server with a substantial amount of free
455 disk space (see the next section for what that means). The CPU and disk
456 performance on this server will determine how many simultaneous backups
457 you can run. You should be able to run 4-8 simultaneous backups on a
458 moderately configured server.
459 <p>Several users have reported significantly better performance using
460 reiser compared to ext3 for the BackupPC data file system. It is
461 also recommended you consider either an LVM or raid setup (either
462 in HW or SW; eg: 3Ware RAID5) so that you can expand the
463 file system as necessary.</p>
464 <p>When BackupPC starts with an empty pool, all the backup data will be
465 written to the pool on disk. After more backups are done, a higher
466 percentage of incoming files will already be in the pool. BackupPC is
467 able to avoid writing to disk new files that are already in the pool.
468 So over time disk writes will reduce significantly (by perhaps a factor
469 of 20 or more), since eventually 95% or more of incoming backup files
470 are typically in the pool. Disk reads from the pool are still needed to
471 do file compares to verify files are an exact match. So, with a mature
472 pool, if a relatively fast client generates data at say 1MB/sec, and you
473 run 4 simultaneous backups, there will be an average server disk load of
474 about 4MB/sec reads and 0.2MB/sec writes (assuming 95% of the incoming
475 files are in the pool). These rates will be perhaps 40% lower if
476 compression is on.</p>
477 <p></p>
478 <li>
479 Perl version 5.6.0 or later. BackupPC has been tested with
480 version 5.6.x, and 5.8.x. If you don't have perl, please
481 see <a href="http://www.cpan.org">http://www.cpan.org</a>.
482 <p></p>
483 <li>
484 Perl modules Compress::Zlib, Archive::Zip and File::RsyncP. Try ``perldoc
485 Compress::Zlib'' and ``perldoc Archive::Zip'' to see if you have these
486 modules. If not, fetch them from <a href="http://www.cpan.org">http://www.cpan.org</a> and see the
487 instructions below for how to build and install them.
488 <p>The File::RsyncP module is available from <a href="http://perlrsync.sourceforge.net">http://perlrsync.sourceforge.net</a>
489 or CPAN. You'll need to install the File::RsyncP module if you want to use
490 Rsync as a transport method.</p>
491 <p></p>
492 <li>
493 If you are using smb to backup WinXX machines you need smbclient and
494 nmblookup from the samba package. You will also need nmblookup if
495 you are backing up linux/unix DHCP machines. See <a href="http://www.samba.org">http://www.samba.org</a>.
496 Version 2.2.0 or later of Samba is required.
497 Samba versions 3.x are stable and now recommended instead of 2.x.
498 <p>See <a href="http://www.samba.org">http://www.samba.org</a> for source and binaries. It's pretty easy to
499 fetch and compile samba, and just grab smbclient and nmblookup, without
500 doing the installation. Alternatively, <a href="http://www.samba.org">http://www.samba.org</a> has binary
501 distributions for most platforms.</p>
502 <p></p>
503 <li>
504 If you are using tar to backup linux/unix machines you should have version
505 1.13.7 at a minimum, with version 1.13.20 or higher recommended. Use
506 ``tar --version'' to check your version. Various GNU mirrors have the newest
507 versions of tar, see for example <a href="http://www.funet.fi/pub/gnu/alpha/gnu/tar">http://www.funet.fi/pub/gnu/alpha/gnu/tar</a>.
508 As of June 2003 the latest version is 1.13.25.
509 <p></p>
510 <li>
511 If you are using rsync to backup linux/unix machines you should have
512 version 2.5.5 or higher on each client machine. See
513 <a href="http://rsync.samba.org">http://rsync.samba.org</a>. Use ``rsync --version'' to check your version.
514 <p>For BackupPC to use Rsync you will also need to install the perl
515 File::RsyncP module, which is available from
516 <a href="http://perlrsync.sourceforge.net">http://perlrsync.sourceforge.net</a>.
517 Version 0.52 or later is required.</p>
518 <p></p>
519 <li>
520 The Apache web server, see <a href="http://www.apache.org">http://www.apache.org</a>, preferably built
521 with mod_perl support.
522 <p></p></ul>
523 <p>
524 </p>
525 <h2><a name="how_much_disk_space_do_i_need">How much disk space do I need?</a></h2>
526 <p>Here's one real example for an environment that is backing up 65 laptops
527 with compression off. Each full backup averages 3.2GB. Each incremental
528 backup averages about 0.2GB. Storing one full backup and two incremental
529 backups per laptop is around 240GB of raw data. But because of the
530 pooling of identical files, only 87GB is used. This is without
531 compression.</p>
532 <p>Another example, with compression on: backing up 95 laptops, where
533 each backup averages 3.6GB and each incremental averages about 0.3GB.
534 Keeping three weekly full backups, and six incrementals is around
535 1200GB of raw data. Because of pooling and compression, only 150GB
536 is needed.</p>
537 <p>Here's a rule of thumb. Add up the disk usage of all the machines you
538 want to backup (210GB in the first example above). This is a rough
539 minimum space estimate that should allow a couple of full backups and at
540 least half a dozen incremental backups per machine. If compression is on
541 you can reduce the storage requirements by maybe 30-40%. Add some margin
542 in case you add more machines or decide to keep more old backups.</p>
543 <p>Your actual mileage will depend upon the types of clients, operating
544 systems and applications you have. The more uniform the clients and
545 applications the bigger the benefit from pooling common files.</p>
546 <p>For example, the Eudora email tool stores each mail folder in a separate
547 file, and attachments are extracted as separate files. So in the sadly
548 common case of a large attachment emailed to many recipients, Eudora
549 will extract the attachment into a new file. When these machines are
550 backed up, only one copy of the file will be stored on the server, even
551 though the file appears in many different full or incremental backups. In
552 this sense Eudora is a ``friendly'' application from the point of view of
553 backup storage requirements.</p>
554 <p>An example at the other end of the spectrum is Outlook. Everything
555 (email bodies, attachments, calendar, contact lists) is stored in a
556 single file, which often becomes huge. Any change to this file requires
557 a separate copy of the file to be saved during backup. Outlook is even
558 more troublesome, since it keeps this file locked all the time, so it
559 cannot be read by smbclient whenever Outlook is running. See the
560 <a href="#limitations">Limitations</a> section for more discussion of this problem.</p>
561 <p>In addition to total disk space, you shold make sure you have
562 plenty of inodes on your BackupPC data partition. Some users have
563 reported running out of inodes on their BackupPC data partition.
564 So even if you have plenty of disk space, BackupPC will report
565 failures when the inodes are exhausted. This is a particular
566 problem with ext2/ext3 file systems that have a fixed number of
567 inodes when the file system is built. Use ``df -i'' to see your
568 inode usage.</p>
569 <p>
570 </p>
571 <h2><a name="step_1__getting_backuppc">Step 1: Getting BackupPC</a></h2>
572 <p>Some linux distributions now include BackupPC. The Debian
573 distribution, supprted by Ludovic Drolez, can be found at
574 <a href="http://packages.debian.org/backuppc">http://packages.debian.org/backuppc</a>; it should be included
575 in the next stable Debian release. On Debian, BackupPC can
576 be installed with the command:</p>
577 <pre>
578 apt-get install backuppc</pre>
579 <p>In the future there might be packages for Gentoo and other
580 linux flavors. If the packaged version is older than the
581 released version then you will probably want to install the
582 lastest version as described below.</p>
583 <p>Otherwise, manually fetching and installing BackupPC is easy.
584 Start by downloading the latest version from
585 <a href="http://backuppc.sourceforge.net">http://backuppc.sourceforge.net</a>. Hit the ``Code'' button,
586 then select the ``backuppc'' or ``backuppc-beta'' package and
587 download the latest version.</p>
588 <p>
589 </p>
590 <h2><a name="step_2__installing_the_distribution">Step 2: Installing the distribution</a></h2>
591 <p>First off, there are three perl modules you should install.
592 These are all optional, but highly recommended:</p>
593 <dl>
594 <dt><strong><a name="item_compress_3a_3azlib">Compress::Zlib</a></strong><br />
595 </dt>
596 <dd>
597 To enable compression, you will need to install Compress::Zlib
598 from <a href="http://www.cpan.org">http://www.cpan.org</a>.
599 You can run ``perldoc Compress::Zlib'' to see if this module is installed.
600 </dd>
601 <p></p>
602 <dt><strong><a name="item_archive_3a_3azip">Archive::Zip</a></strong><br />
603 </dt>
604 <dd>
605 To support restore via Zip archives you will need to install
606 Archive::Zip, also from <a href="http://www.cpan.org">http://www.cpan.org</a>.
607 You can run ``perldoc Archive::Zip'' to see if this module is installed.
608 </dd>
609 <p></p>
610 <dt><strong><a name="item_file_3a_3arsyncp">File::RsyncP</a></strong><br />
611 </dt>
612 <dd>
613 To use rsync and rsyncd with BackupPC you will need to install File::RsyncP.
614 You can run ``perldoc File::RsyncP'' to see if this module is installed.
615 File::RsyncP is available from <a href="http://perlrsync.sourceforge.net">http://perlrsync.sourceforge.net</a>.
616 Version 0.52 or later is required.
617 </dd>
618 <p></p></dl>
619 <p>To build and install these packages, fetch the tar.gz file and
620 then run these commands:</p>
621 <pre>
622 tar zxvf Archive-Zip-1.01.tar.gz
623 cd Archive-Zip-1.01
624 perl Makefile.PL
625 make
626 make test
627 make install</pre>
628 <p>The same sequence of commands can be used for each module.</p>
629 <p>Now let's move onto BackupPC itself. After fetching
630 BackupPC-2.1.0.tar.gz, run these commands as root:</p>
631 <pre>
632 tar zxf BackupPC-2.1.0.tar.gz
633 cd BackupPC-2.1.0
634 perl configure.pl</pre>
635 <p>In the future this release might also have patches available on the
636 SourceForge site. These patch files are text files, with a name of
637 the form</p>
638 <pre>
639 BackupPC-2.1.0plN.diff</pre>
640 <p>where N is the patch level, eg: pl5 is patch-level 5. These
641 patch files are cumulative: you only need apply the last patch
642 file, not all the earlier patch files. If a patch file is
643 available, eg: BackupPC-2.1.0pl5.diff, you should apply
644 the patch after extracting the tar file:</p>
645 <pre>
646 # fetch BackupPC-2.1.0.tar.gz
647 # fetch BackupPC-2.1.0pl5.diff
648 tar zxf BackupPC-2.1.0.tar.gz
649 cd BackupPC-2.1.0
650 patch -p0 &lt; ../BackupPC-2.1.0pl5.diff
651 perl configure.pl</pre>
652 <p>A patch file includes comments that describe that bug fixes
653 and changes. Feel free to review it before you apply the patch.</p>
654 <p>The configure.pl script also accepts command-line options if you
655 wish to run it in a non-interactive manner. It has self-contained
656 documentation for all the command-line options, which you can
657 read with perldoc:</p>
658 <pre>
659 perldoc configure.pl</pre>
660 <p>When you run configure.pl you will be prompted for the full paths
661 of various executables, and you will be prompted for the following
662 information:</p>
663 <dl>
664 <dt><strong><a name="item_backuppc_user">BackupPC User</a></strong><br />
665 </dt>
666 <dd>
667 It is best if BackupPC runs as a special user, eg backuppc, that has
668 limited privileges. It is preferred that backuppc belongs to a system
669 administrator group so that sys admin members can browse backuppc files,
670 edit the configuration files and so on. Although configurable, the
671 default settings leave group read permission on pool files, so make
672 sure the BackupPC user's group is chosen restrictively.
673 </dd>
674 <dd>
675 <p>On this installation, this is __BACKUPPCUSER__.</p>
676 </dd>
677 <p></p>
678 <dt><strong><a name="item_data_directory">Data Directory</a></strong><br />
679 </dt>
680 <dd>
681 You need to decide where to put the data directory, below which
682 all the BackupPC data is stored. This needs to be a big file system.
683 </dd>
684 <dd>
685 <p>On this installation, this is __TOPDIR__.</p>
686 </dd>
687 <p></p>
688 <dt><strong><a name="item_install_directory">Install Directory</a></strong><br />
689 </dt>
690 <dd>
691 You should decide where the BackupPC scripts, libraries and documentation
692 should be installed, eg: /opt/local/BackupPC.
693 </dd>
694 <dd>
695 <p>On this installation, this is __INSTALLDIR__.</p>
696 </dd>
697 <p></p>
698 <dt><strong><a name="item_cgi_bin_directory">CGI bin Directory</a></strong><br />
699 </dt>
700 <dd>
701 You should decide where the BackupPC CGI script resides. This will
702 usually below Apache's cgi-bin directory.
703 </dd>
704 <dd>
705 <p>On this installation, this is __CGIDIR__.</p>
706 </dd>
707 <p></p>
708 <dt><strong><a name="item_apache_image_directory">Apache image directory</a></strong><br />
709 </dt>
710 <dd>
711 A directory where BackupPC's images are stored so that Apache can
712 serve them. This should be somewhere under Apache's DocumentRoot
713 directory.
714 </dd>
715 <p></p></dl>
716 <p>
717 </p>
718 <h2><a name="step_3__setting_up_config_pl">Step 3: Setting up config.pl</a></h2>
719 <p>After running configure.pl, browse through the config file,
720 __INSTALLDIR__/conf/config.pl, and make sure all the default settings
721 are correct. In particular, you will need to decide whether to use
722 smb, tar or rsync transport (or whether to set it on a per-PC basis)
723 and set the relevant parameters for that transport method.
724 See the section <a href="#step_5__client_setup">Client Setup</a> for more details.</p>
725 <p>
726 </p>
727 <h2><a name="step_4__setting_up_the_hosts_file">Step 4: Setting up the hosts file</a></h2>
728 <p>The file __TOPDIR__/conf/hosts contains the list of clients to backup.
729 BackupPC reads this file in three cases:</p>
730 <ul>
731 <li>
732 Upon startup.
733 <p></p>
734 <li>
735 When BackupPC is sent a HUP (-1) signal. Assuming you installed the
736 init.d script, you can also do this with ``/etc/init.d/backuppc reload''.
737 <p></p>
738 <li>
739 When the modification time of the hosts file changes. BackupPC
740 checks the modification time once during each regular wakeup.
741 <p></p></ul>
742 <p>Whenever you change the hosts file (to add or remove a host) you can
743 either do a kill -HUP BackupPC_pid or simply wait until the next regular
744 wakeup period.</p>
745 <p>Each line in the hosts file contains three fields, separated
746 by white space:</p>
747 <dl>
748 <dt><strong><a name="item_host_name">Host name</a></strong><br />
749 </dt>
750 <dd>
751 This is typically the host name or NetBios name of the client machine
752 and should be in lower case. The host name can contain spaces (escape
753 with a backslash), but it is not recommended.
754 </dd>
755 <dd>
756 <p>Please read the section <a href="#how_backuppc_finds_hosts">How BackupPC Finds Hosts</a>.</p>
757 </dd>
758 <dd>
759 <p>In certain cases you might want several distinct clients to refer
760 to the same physical machine. For example, you might have a database
761 you want to backup, and you want to bracket the backup of the database
762 with shutdown/restart using <a href="#item_%24conf%7bdumppreusercmd%7d">$Conf{DumpPreUserCmd}</A> and <a href="#item_%24conf%7bdumppostusercmd%7d">$Conf{DumpPostUserCmd}</A>.
763 But you also want to backup the rest of the machine while the database
764 is still running. In the case you can specify two different clients in
765 the host file, using any mnemonic name (eg: myhost_mysql and myhost), and
766 use <a href="#item_%24conf%7bclientnamealias%7d">$Conf{ClientNameAlias}</A> in myhost_mysql's config.pl to specify the
767 real host name of the machine.</p>
768 </dd>
769 <p></p>
770 <dt><strong><a name="item_dhcp_flag">DHCP flag</a></strong><br />
771 </dt>
772 <dd>
773 Starting with v2.0.0 the way hosts are discovered has changed and now
774 in most cases you should specify 0 for the DHCP flag, even if the host
775 has a dynamically assigned IP address.
776 Please read the section <a href="#how_backuppc_finds_hosts">How BackupPC Finds Hosts</a>
777 to understand whether you need to set the DHCP flag.
778 </dd>
779 <dd>
780 <p>You only need to set DHCP to 1 if your client machine doesn't
781 respond to the NetBios multicast request:</p>
782 </dd>
783 <dd>
784 <pre>
785 nmblookup myHost</pre>
786 </dd>
787 <dd>
788 <p>but does respond to a request directed to its IP address:</p>
789 </dd>
790 <dd>
791 <pre>
792 nmblookup -A W.X.Y.Z</pre>
793 </dd>
794 <dd>
795 <p>If you do set DHCP to 1 on any client you will need to specify the range of
796 DHCP addresses to search is specified in <a href="#item_%24conf%7bdhcpaddressranges%7d">$Conf{DHCPAddressRanges}</A>.</p>
797 </dd>
798 <dd>
799 <p>Note also that the <a href="#item_%24conf%7bclientnamealias%7d">$Conf{ClientNameAlias}</A> feature does not work for
800 clients with DHCP set to 1.</p>
801 </dd>
802 <p></p>
803 <dt><strong><a name="item_user_name">User name</a></strong><br />
804 </dt>
805 <dd>
806 This should be the unix login/email name of the user who ``owns'' or uses
807 this machine. This is the user who will be sent email about this
808 machine, and this user will have permission to stop/start/browse/restore
809 backups for this host. Leave this blank if no specific person should
810 receive email or be allowed to stop/start/browse/restore backups
811 for this host. Administrators will still have full permissions.
812 </dd>
813 <p></p>
814 <dt><strong><a name="item_more_users">More users</a></strong><br />
815 </dt>
816 <dd>
817 Additional user names, separate by commas and with no white space,
818 can be specified. These users will also have full permission in
819 the CGI interface to stop/start/browse/restore backups for this host.
820 These users will not be sent email about this host.
821 </dd>
822 <p></p></dl>
823 <p>The first non-comment line of the hosts file is special: it contains
824 the names of the columns and should not be edited.</p>
825 <p>Here's a simple example of a hosts file:</p>
826 <pre>
827 host dhcp user moreUsers
828 farside 0 craig jim,dave
829 larson 1 gary andy</pre>
830 <p>
831 </p>
832 <h2><a name="step_5__client_setup">Step 5: Client Setup</a></h2>
833 <p>Two methods for getting backup data from a client are supported: smb and
834 tar. Smb or rsync are the preferred methods for WinXX clients and rsync or
835 tar are the preferred methods for linux/unix clients.</p>
836 <p>The transfer method is set using the <a href="#item_%24conf%7bxfermethod%7d">$Conf{XferMethod}</A> configuration
837 setting. If you have a mixed environment (ie: you will use smb for some
838 clients and tar for others), you will need to pick the most common
839 choice for <a href="#item_%24conf%7bxfermethod%7d">$Conf{XferMethod}</A> for the main config.pl file, and then
840 override it in the per-PC config file for those hosts that will use
841 the other method. (Or you could run two completely separate instances
842 of BackupPC, with different data directories, one for WinXX and the
843 other for linux/unix, but then common files between the different
844 machine types will duplicated.)</p>
845 <p>Here are some brief client setup notes:</p>
846 <dl>
847 <dt><strong><a name="item_winxx">WinXX</a></strong><br />
848 </dt>
849 <dd>
850 The preferred setup for WinXX clients is to set <a href="#item_%24conf%7bxfermethod%7d">$Conf{XferMethod}</A> to ``smb''.
851 (Actually, for v2.0.0, rsyncd is the better method for WinXX if you are
852 prepared to run rsync/cygwin on your WinXX client. More information
853 about this will be provided via the FAQ.)
854 </dd>
855 <dd>
856 <p>If you want to use rsyncd for WinXX clients you can find a pre-packaged
857 zip file on <a href="http://backuppc.sourceforge.net">http://backuppc.sourceforge.net</a>. The package is called
858 cygwin-rsync. It contains rsync.exe, template setup files and the
859 minimal set of cygwin libraries for everything to run. The README file
860 contains instructions for running rsync as a service, so it starts
861 automatically everytime you boot your machine.</p>
862 </dd>
863 <dd>
864 <p>If you build your own rsync, for rsync 2.6.2 it is strongly
865 recommended you apply the patch in the cygwin-rsync package on
866 <a href="http://backuppc.sourceforge.net">http://backuppc.sourceforge.net</a>. This patch adds the --checksum-seed
867 option for checksum caching, and also sends all errors to the client,
868 which is important so BackupPC can log all file access errors.</p>
869 </dd>
870 <dd>
871 <p>Otherwise, to use SMB, you need to create shares for the data you want
872 to backup. Open ``My Computer'', right click on the drive (eg: C), and
873 select ``Sharing...'' (or select ``Properties'' and select the ``Sharing''
874 tab). In this dialog box you can enable sharing, select the share name
875 and permissions. Many machines will be configured by default to share
876 the entire C drive as C$ using the administrator password.</p>
877 </dd>
878 <dd>
879 <p>If this machine uses DHCP you will also need to make sure the
880 NetBios name is set. Go to Control Panel|System|Network Identification
881 (on Win2K) or Control Panel|System|Computer Name (on WinXP).
882 Also, you should go to Control Panel|Network Connections|Local Area
883 Connection|Properties|Internet Protocol (TCP/IP)|Properties|Advanced|WINS
884 and verify that NetBios is not disabled.</p>
885 </dd>
886 <dd>
887 <p>The relevant configuration settings are <a href="#item_%24conf%7bsmbsharename%7d">$Conf{SmbShareName}</A>,
888 <a href="#item_%24conf%7bsmbshareusername%7d">$Conf{SmbShareUserName}</A>, <a href="#item_%24conf%7bsmbsharepasswd%7d">$Conf{SmbSharePasswd}</A>, <a href="#item_%24conf%7bsmbclientpath%7d">$Conf{SmbClientPath}</A>,
889 <a href="#item_%24conf%7bsmbclientfullcmd%7d">$Conf{SmbClientFullCmd}</A>, <a href="#item_%24conf%7bsmbclientincrcmd%7d">$Conf{SmbClientIncrCmd}</A> and
890 <a href="#item_%24conf%7bsmbclientrestorecmd%7d">$Conf{SmbClientRestoreCmd}</A>.</p>
891 </dd>
892 <dd>
893 <p>BackupPC needs to know the smb share user name and password for a
894 client machine that uses smb. The user name is specified in
895 <a href="#item_%24conf%7bsmbshareusername%7d">$Conf{SmbShareUserName}</A>. There are four ways to tell BackupPC the
896 smb share password:</p>
897 </dd>
898 <ul>
899 <li>
900 As an environment variable BPC_SMB_PASSWD set before BackupPC starts.
901 If you start BackupPC manually the BPC_SMB_PASSWD variable must be set
902 manually first. For backward compatibility for v1.5.0 and prior, the
903 environment variable PASSWD can be used if BPC_SMB_PASSWD is not set.
904 Warning: on some systems it is possible to see environment variables of
905 running processes.
906 <p></p>
907 <li>
908 Alternatively the BPC_SMB_PASSWD setting can be included in
909 /etc/init.d/backuppc, in which case you must make sure this file
910 is not world (other) readable.
911 <p></p>
912 <li>
913 As a configuration variable <a href="#item_%24conf%7bsmbsharepasswd%7d">$Conf{SmbSharePasswd}</A> in
914 __TOPDIR__/conf/config.pl. If you put the password
915 here you must make sure this file is not world (other) readable.
916 <p></p>
917 <li>
918 As a configuration variable <a href="#item_%24conf%7bsmbsharepasswd%7d">$Conf{SmbSharePasswd}</A> in the per-PC
919 configuration file, __TOPDIR__/pc/$host/config.pl. You will have to
920 use this option if the smb share password is different for each host.
921 If you put the password here you must make sure this file is not
922 world (other) readable.
923 <p></p></ul>
924 <p>Placement and protection of the smb share password is a possible
925 security risk, so please double-check the file and directory
926 permissions. In a future version there might be support for
927 encryption of this password, but a private key will still have to
928 be stored in a protected place. Suggestions are welcome.</p>
929 <p>As an alternative to setting <a href="#item_%24conf%7bxfermethod%7d">$Conf{XferMethod}</A> to ``smb'' (using
930 smbclient) for WinXX clients, you can use an smb network filesystem (eg:
931 ksmbfs or similar) on your linux/unix server to mount the share,
932 and then set <a href="#item_%24conf%7bxfermethod%7d">$Conf{XferMethod}</A> to ``tar'' (use tar on the network
933 mounted file system).</p>
934 <p>Also, to make sure that file names with 8-bit characters are correctly
935 transferred by smbclient you should add this to samba's smb.conf file
936 for samba 2.x:</p>
937 <pre>
938 [global]
939 # Accept the windows charset
940 client code page = 850
941 character set = ISO8859-1</pre>
942 <p>For samba 3.x this should instead be:</p>
943 <pre>
944 [global]
945 unix charset = ISO8859-1</pre>
946 <p>This setting should work for western europe.
947 See <a href="http://www.oreilly.com/catalog/samba/chapter/book/ch08_03.html">http://www.oreilly.com/catalog/samba/chapter/book/ch08_03.html</a>
948 for more information about settings for other languages.</p>
949 <dt><strong><a name="item_linux_2funix">Linux/Unix</a></strong><br />
950 </dt>
951 <dd>
952 The preferred setup for linux/unix clients is to set <a href="#item_%24conf%7bxfermethod%7d">$Conf{XferMethod}</A>
953 to ``rsync'', ``rsyncd'' or ``tar''.
954 </dd>
955 <dd>
956 <p>You can use either rsync, smb, or tar for linux/unix machines. Smb requires
957 that the Samba server (smbd) be run to provide the shares. Since the smb
958 protocol can't represent special files like symbolic links and fifos,
959 tar and rsync are the better transport methods for linux/unix machines.
960 (In fact, by default samba makes symbolic links look like the file or
961 directory that they point to, so you could get an infinite loop if a
962 symbolic link points to the current or parent directory. If you really
963 need to use Samba shares for linux/unix backups you should turn off the
964 ``follow symlinks'' samba config setting. See the smb.conf manual page.)</p>
965 </dd>
966 <dd>
967 <p>The requirements for each Xfer Method are:</p>
968 </dd>
969 <dl>
970 <dt><strong><a name="item_tar">tar</a></strong><br />
971 </dt>
972 <dd>
973 You must have GNU tar on the client machine. Use ``tar --version''
974 or ``gtar --version'' to verify. The version should be at least
975 1.13.7, and 1.13.20 or greater is recommended. Tar is run on
976 the client machine via rsh or ssh.
977 </dd>
978 <dd>
979 <p>The relevant configuration settings are <a href="#item_%24conf%7btarclientpath%7d">$Conf{TarClientPath}</A>,
980 <a href="#item_%24conf%7btarsharename%7d">$Conf{TarShareName}</A>, <a href="#item_%24conf%7btarclientcmd%7d">$Conf{TarClientCmd}</A>, <a href="#item_%24conf%7btarfullargs%7d">$Conf{TarFullArgs}</A>,
981 <a href="#item_%24conf%7btarincrargs%7d">$Conf{TarIncrArgs}</A>, and <a href="#item_%24conf%7btarclientrestorecmd%7d">$Conf{TarClientRestoreCmd}</A>.</p>
982 </dd>
983 <p></p>
984 <dt><strong><a name="item_rsync">rsync</a></strong><br />
985 </dt>
986 <dd>
987 You should have at least rsync 2.5.5, and the latest version 2.5.6
988 is recommended. Rsync is run on the remote client via rsh or ssh.
989 </dd>
990 <dd>
991 <p>The relevant configuration settings are <a href="#item_%24conf%7brsyncclientpath%7d">$Conf{RsyncClientPath}</A>,
992 <a href="#item_%24conf%7brsyncclientcmd%7d">$Conf{RsyncClientCmd}</A>, <a href="#item_%24conf%7brsyncclientrestorecmd%7d">$Conf{RsyncClientRestoreCmd}</A>, <a href="#item_%24conf%7brsyncsharename%7d">$Conf{RsyncShareName}</A>,
993 <a href="#item_%24conf%7brsyncargs%7d">$Conf{RsyncArgs}</A>, and <a href="#item_%24conf%7brsyncrestoreargs%7d">$Conf{RsyncRestoreArgs}</A>.</p>
994 </dd>
995 <p></p>
996 <dt><strong><a name="item_rsyncd">rsyncd</a></strong><br />
997 </dt>
998 <dd>
999 You should have at least rsync 2.5.5, and the latest version 2.6.2
1000 is recommended. In this case the rsync daemon should be running on
1001 the client machine and BackupPC connects directly to it.
1002 </dd>
1003 <dd>
1004 <p>The relevant configuration settings are <a href="#item_%24conf%7brsyncdclientport%7d">$Conf{RsyncdClientPort}</A>,
1005 <a href="#item_%24conf%7brsyncdusername%7d">$Conf{RsyncdUserName}</A>, <a href="#item_%24conf%7brsyncdpasswd%7d">$Conf{RsyncdPasswd}</A>, <a href="#item_%24conf%7brsyncdauthrequired%7d">$Conf{RsyncdAuthRequired}</A>,
1006 <a href="#item_%24conf%7brsyncsharename%7d">$Conf{RsyncShareName}</A>, <a href="#item_%24conf%7brsyncargs%7d">$Conf{RsyncArgs}</A>, and <a href="#item_%24conf%7brsyncrestoreargs%7d">$Conf{RsyncRestoreArgs}</A>.
1007 <a href="#item_%24conf%7brsyncsharename%7d">$Conf{RsyncShareName}</A> is the name of an rsync module (ie: the thing
1008 in square brackets in rsyncd's conf file -- see rsyncd.conf), not a
1009 file system path.</p>
1010 </dd>
1011 <dd>
1012 <p>Be aware that rsyncd will remove the leading '/' from path names in
1013 symbolic links if you specify ``use chroot = no'' in the rsynd.conf file.
1014 See the rsyncd.conf manual page for more information.</p>
1015 </dd>
1016 <p></p></dl>
1017 <p>For linux/unix machines you should not backup ``/proc''. This directory
1018 contains a variety of files that look like regular files but they are
1019 special files that don't need to be backed up (eg: /proc/kcore is a
1020 regular file that contains physical memory). See <a href="#item_%24conf%7bbackupfilesexclude%7d">$Conf{BackupFilesExclude}</A>.
1021 It is safe to back up /dev since it contains mostly character-special
1022 and block-special files, which are correctly handed by BackupPC
1023 (eg: backing up /dev/hda5 just saves the block-special file information,
1024 not the contents of the disk).</p>
1025 <p>Alternatively, rather than backup all the file systems as a single
1026 share (``/''), it is easier to restore a single file system if you backup
1027 each file system separately. To do this you should list each file system
1028 mount point in <a href="#item_%24conf%7btarsharename%7d">$Conf{TarShareName}</A> or <a href="#item_%24conf%7brsyncsharename%7d">$Conf{RsyncShareName}</A>, and add the
1029 --one-file-system option to <a href="#item_%24conf%7btarclientcmd%7d">$Conf{TarClientCmd}</A> or add --one-file-system
1030 (note the different punctuation) to <a href="#item_%24conf%7brsyncargs%7d">$Conf{RsyncArgs}</A>. In this case there
1031 is no need to exclude /proc explicitly since it looks like a different
1032 file system.</p>
1033 <p>Next you should decide whether to run tar over ssh, rsh or nfs. Ssh is
1034 the preferred method. Rsh is not secure and therefore not recommended.
1035 Nfs will work, but you need to make sure that the BackupPC user (running
1036 on the server) has sufficient permissions to read all the files below
1037 the nfs mount.</p>
1038 <p>Ssh allows BackupPC to run as a privileged user on the client (eg:
1039 root), since it needs sufficient permissions to read all the backup
1040 files. Ssh is setup so that BackupPC on the server (an otherwise low
1041 privileged user) can ssh as root on the client, without being prompted
1042 for a password. There are two common versions of ssh: v1 and v2. Here
1043 are some instructions for one way to setup ssh. (Check which version
1044 of SSH you have by typing ``ssh'' or ``man ssh''.)</p>
1045 <dt><strong><a name="item_mac_os_x">Mac OS X</a></strong><br />
1046 </dt>
1047 <dd>
1048 In general this should be similar to Linux/Unix machines.
1049 Mark Stosberg reports that you can also use hfstar.
1050 See <a href="http://fink.sourceforge.net/pdb/package.php/hfstar">http://fink.sourceforge.net/pdb/package.php/hfstar</a>.
1051 </dd>
1052 <p></p>
1053 <dt><strong><a name="item_ssh_setup">SSH Setup</a></strong><br />
1054 </dt>
1055 <dd>
1056 SSH is a secure way to run tar or rsync on a backup client to extract
1057 the data. SSH provides strong authentication and encryption of
1058 the network data.
1059 </dd>
1060 <dd>
1061 <p>Note that if you run rsyncd (rsync daemon), ssh is not used.
1062 In this case, rsyncd provides its own authentication, but there
1063 is no encryption of network data. If you want encryption of
1064 network data you can use ssh to create a tunnel, or use a
1065 program like stunnel. If someone submits instructions I</p>
1066 </dd>
1067 <dd>
1068 <p>Setup instructions for ssh are at
1069 <a href="http://backuppc.sourceforge.net/faq/ssh.html">http://backuppc.sourceforge.net/faq/ssh.html</a>.</p>
1070 </dd>
1071 <p></p>
1072 <dt><strong><a name="item_clients_that_use_dhcp">Clients that use DHCP</a></strong><br />
1073 </dt>
1074 <dd>
1075 If a client machine uses DHCP BackupPC needs some way to find the
1076 IP address given the host name. One alternative is to set dhcp
1077 to 1 in the hosts file, and BackupPC will search a pool of IP
1078 addresses looking for hosts. More efficiently, it is better to
1079 set dhcp = 0 and provide a mechanism for BackupPC to find the
1080 IP address given the host name.
1081 </dd>
1082 <dd>
1083 <p>For WinXX machines BackupPC uses the NetBios name server to determine
1084 the IP address given the host name.
1085 For unix machines you can run nmbd (the NetBios name server) from
1086 the Samba distribution so that the machine responds to a NetBios
1087 name request. See the manual page and Samba documentation for more
1088 information.</p>
1089 </dd>
1090 <dd>
1091 <p>Alternatively, you can set <a href="#item_%24conf%7bnmblookupfindhostcmd%7d">$Conf{NmbLookupFindHostCmd}</A> to any command
1092 that returns the IP address given the host name.</p>
1093 </dd>
1094 <dd>
1095 <p>Please read the section <a href="#how_backuppc_finds_hosts">How BackupPC Finds Hosts</a>
1096 for more details.</p>
1097 </dd>
1098 <p></p></dl>
1099 <p>
1100 </p>
1101 <h2><a name="step_6__running_backuppc">Step 6: Running BackupPC</a></h2>
1102 <p>The installation contains an init.d backuppc script that can be copied
1103 to /etc/init.d so that BackupPC can auto-start on boot.
1104 See init.d/README for further instructions.</p>
1105 <p>BackupPC should be ready to start. If you installed the init.d script,
1106 then you should be able to run BackupPC with:</p>
1107 <pre>
1108 /etc/init.d/backuppc start</pre>
1109 <p>(This script can also be invoked with ``stop'' to stop BackupPC and ``reload''
1110 to tell BackupPC to reload config.pl and the hosts file.)</p>
1111 <p>Otherwise, just run</p>
1112 <pre>
1113 __INSTALLDIR__/bin/BackupPC -d</pre>
1114 <p>as user __BACKUPPCUSER__. The -d option tells BackupPC to run as a daemon
1115 (ie: it does an additional fork).</p>
1116 <p>Any immediate errors will be printed to stderr and BackupPC will quit.
1117 Otherwise, look in __TOPDIR__/log/LOG and verify that BackupPC reports
1118 it has started and all is ok.</p>
1119 <p>
1120 </p>
1121 <h2><a name="step_7__talking_to_backuppc">Step 7: Talking to BackupPC</a></h2>
1122 <p>Note: as of version 1.5.0, BackupPC no longer supports telnet
1123 to its TCP port. First off, a unix domain socket is used
1124 instead of a TCP port. (The TCP port can still be re-enabled
1125 if your installation has apache and BackupPC running on different
1126 machines.) Secondly, even if you still use the TCP port, the
1127 messages exchanged over this interface are now protected by
1128 an MD5 digest based on a shared secret (see <a href="#item_%24conf%7bservermesgsecret%7d">$Conf{ServerMesgSecret}</A>)
1129 as well as sequence numbers and per-session unique keys, preventing
1130 forgery and replay attacks.</p>
1131 <p>You should verify that BackupPC is running by using BackupPC_serverMesg.
1132 This sends a message to BackupPC via the unix (or TCP) socket and prints
1133 the response.</p>
1134 <p>You can request status information and start and stop backups using this
1135 interface. This socket interface is mainly provided for the CGI interface
1136 (and some of the BackupPC sub-programs use it too). But right now we just
1137 want to make sure BackupPC is happy. Each of these commands should
1138 produce some status output:</p>
1139 <pre>
1140 __INSTALLDIR__/bin/BackupPC_serverMesg status info
1141 __INSTALLDIR__/bin/BackupPC_serverMesg status jobs
1142 __INSTALLDIR__/bin/BackupPC_serverMesg status hosts</pre>
1143 <p>The output should be some hashes printed with Data::Dumper. If it
1144 looks cryptic and confusing, and doesn't look like an error message,
1145 then all is ok.</p>
1146 <p>The jobs status should initially show just BackupPC_trashClean.
1147 The hosts status should produce a list of every host you have listed
1148 in __TOPDIR__/conf/hosts as part of a big cryptic output line.</p>
1149 <p>You can also request that all hosts be queued:</p>
1150 <pre>
1151 __INSTALLDIR__/bin/BackupPC_serverMesg backup all</pre>
1152 <p>At this point you should make sure the CGI interface works since
1153 it will be much easier to see what is going on. That's our
1154 next subject.</p>
1155 <p>
1156 </p>
1157 <h2><a name="step_8__cgi_interface">Step 8: CGI interface</a></h2>
1158 <p>The CGI interface script, BackupPC_Admin, is a powerful and flexible
1159 way to see and control what BackupPC is doing. It is written for an
1160 Apache server. If you don't have Apache, see <a href="http://www.apache.org">http://www.apache.org</a>.</p>
1161 <p>There are two options for setting up the CGI interface: standard
1162 mode and using mod_perl. Mod_perl provides much higher performance
1163 (around 15x) and is the best choice if your Apache was built with
1164 mod_perl support. To see if your apache was built with mod_perl
1165 run this command:</p>
1166 <pre>
1167 httpd -l | egrep mod_perl</pre>
1168 <p>If this prints mod_perl.c then your Apache supports mod_perl.</p>
1169 <p>Using mod_perl with BackupPC_Admin requires a dedicated Apache
1170 to be run as the BackupPC user (__BACKUPPCUSER__). This is
1171 because BackupPC_Admin needs permission to access various files
1172 in BackupPC's data directories. In contrast, the standard
1173 installation (without mod_perl) solves this problem by having
1174 BackupPC_Admin installed as setuid to the BackupPC user, so that
1175 BackupPC_Admin runs as the BackuPC user.</p>
1176 <p>Here are some specifics for each setup:</p>
1177 <dl>
1178 <dt><strong><a name="item_standard_setup">Standard Setup</a></strong><br />
1179 </dt>
1180 <dd>
1181 The CGI interface should have been installed by the configure.pl script
1182 in __CGIDIR__/BackupPC_Admin. BackupPC_Admin should have been installed
1183 as setuid to the BackupPC user (__BACKUPPCUSER__), in addition to user
1184 and group execute permission.
1185 </dd>
1186 <dd>
1187 <p>You should be very careful about permissions on BackupPC_Admin and
1188 the directory __CGIDIR__: it is important that normal users cannot
1189 directly execute or change BackupPC_Admin, otherwise they can access
1190 backup files for any PC. You might need to change the group ownership
1191 of BackupPC_Admin to a group that Apache belongs to so that Apache
1192 can execute it (don't add ``other'' execute permission!).
1193 The permissions should look like this:</p>
1194 </dd>
1195 <dd>
1196 <pre>
1197 ls -l __CGIDIR__/BackupPC_Admin
1198 -swxr-x--- 1 __BACKUPPCUSER__ web 82406 Jun 17 22:58 __CGIDIR__/BackupPC_Admin</pre>
1199 </dd>
1200 <dd>
1201 <p>The setuid script won't work unless perl on your machine was installed
1202 with setuid emulation. This is likely the problem if you get an error
1203 saying such as ``Wrong user: my userid is 25, instead of 150'', meaning
1204 the script is running as the httpd user, not the BackupPC user.
1205 This is because setuid scripts are disabled by the kernel in most
1206 flavors of unix and linux.</p>
1207 </dd>
1208 <dd>
1209 <p>To see if your perl has setuid emulation, see if there is a program
1210 called sperl5.6.0 (or sperl5.8.2 etc, based on your perl version)
1211 in the place where perl is installed. If you can't find this program,
1212 then you have two options: rebuild and reinstall perl with the setuid
1213 emulation turned on (answer ``y'' to the question ``Do you want to do
1214 setuid/setgid emulation?'' when you run perl's configure script), or
1215 switch to the mod_perl alternative for the CGI script (which doesn't
1216 need setuid to work).</p>
1217 </dd>
1218 <p></p>
1219 <dt><strong><a name="item_mod_perl_setup">Mod_perl Setup</a></strong><br />
1220 </dt>
1221 <dd>
1222 The advantage of the mod_perl setup is that no setuid script is needed,
1223 and there is a huge performance advantage. Not only does all the perl
1224 code need to be parsed just once, the config.pl and hosts files, plus
1225 the connection to the BackupPC server are cached between requests. The
1226 typical speedup is around 15 times.
1227 </dd>
1228 <dd>
1229 <p>To use mod_perl you need to run Apache as user __BACKUPPCUSER__.
1230 If you need to run multiple Apache's for different services then
1231 you need to create multiple top-level Apache directories, each
1232 with their own config file. You can make copies of /etc/init.d/httpd
1233 and use the -d option to httpd to point each http to a different
1234 top-level directory. Or you can use the -f option to explicitly
1235 point to the config file. Multiple Apache's will run on different
1236 Ports (eg: 80 is standard, 8080 is a typical alternative port accessed
1237 via <a href="http://yourhost.com:8080).">http://yourhost.com:8080).</a></p>
1238 </dd>
1239 <dd>
1240 <p>Inside BackupPC's Apache http.conf file you should check the
1241 settings for ServerRoot, DocumentRoot, User, Group, and Port. See
1242 <a href="http://httpd.apache.org/docs/server-wide.html">http://httpd.apache.org/docs/server-wide.html</a> for more details.</p>
1243 </dd>
1244 <dd>
1245 <p>For mod_perl, BackupPC_Admin should not have setuid permission, so
1246 you should turn it off:</p>
1247 </dd>
1248 <dd>
1249 <pre>
1250 chmod u-s __CGIDIR__/BackupPC_Admin</pre>
1251 </dd>
1252 <dd>
1253 <p>To tell Apache to use mod_perl to execute BackupPC_Admin, add this
1254 to Apache's 1.x httpd.conf file:</p>
1255 </dd>
1256 <dd>
1257 <pre>
1258 &lt;IfModule mod_perl.c&gt;
1259 PerlModule Apache::Registry
1260 PerlTaintCheck On
1261 &lt;Location /cgi-bin/BackupPC/BackupPC_Admin&gt; # &lt;--- change path as needed
1262 SetHandler perl-script
1263 PerlHandler Apache::Registry
1264 Options ExecCGI
1265 PerlSendHeader On
1266 &lt;/Location&gt;
1267 &lt;/IfModule&gt;</pre>
1268 </dd>
1269 <dd>
1270 <p>Apache 2.0.44 with Perl 5.8.0 on RedHat 7.1, Don Silvia reports that
1271 this works (with tweaks from Michael Tuzi):</p>
1272 </dd>
1273 <dd>
1274 <pre>
1275 LoadModule perl_module modules/mod_perl.so
1276 PerlModule Apache2</pre>
1277 </dd>
1278 <dd>
1279 <pre>
1280 &lt;Directory /path/to/cgi/&gt;
1281 SetHandler perl-script
1282 PerlResponseHandler ModPerl::Registry
1283 PerlOptions +ParseHeaders
1284 Options +ExecCGI
1285 Order deny,allow
1286 Deny from all
1287 Allow from 192.168.0
1288 AuthName &quot;Backup Admin&quot;
1289 AuthType Basic
1290 AuthUserFile /path/to/user_file
1291 Require valid-user
1292 &lt;/Directory&gt;</pre>
1293 </dd>
1294 <dd>
1295 <p>There are other optimizations and options with mod_perl. For
1296 example, you can tell mod_perl to preload various perl modules,
1297 which saves memory compared to loading separate copies in every
1298 Apache process after they are forked. See Stas's definitive
1299 mod_perl guide at <a href="http://perl.apache.org/guide">http://perl.apache.org/guide</a>.</p>
1300 </dd>
1301 <p></p></dl>
1302 <p>BackupPC_Admin requires that users are authenticated by Apache.
1303 Specifically, it expects that Apache sets the REMOTE_USER environment
1304 variable when it runs. There are several ways to do this. One way
1305 is to create a .htaccess file in the cgi-bin directory that looks like:</p>
1306 <pre>
1307 AuthGroupFile /etc/httpd/conf/group # &lt;--- change path as needed
1308 AuthUserFile /etc/http/conf/passwd # &lt;--- change path as needed
1309 AuthType basic
1310 AuthName &quot;access&quot;
1311 require valid-user</pre>
1312 <p>You will also need ``AllowOverride Indexes AuthConfig'' in the Apache
1313 httpd.conf file to enable the .htaccess file. Alternatively, everything
1314 can go in the Apache httpd.conf file inside a Location directive. The
1315 list of users and password file above can be extracted from the NIS
1316 passwd file.</p>
1317 <p>One alternative is to use LDAP. In Apache's http.conf add these lines:</p>
1318 <pre>
1319 LoadModule auth_ldap_module modules/auth_ldap.so
1320 AddModule auth_ldap.c</pre>
1321 <pre>
1322 # cgi-bin - auth via LDAP (for BackupPC)
1323 &lt;Location /cgi-binBackupPC/BackupPC_Admin&gt; # &lt;--- change path as needed
1324 AuthType Basic
1325 AuthName &quot;BackupPC login&quot;
1326 # replace MYDOMAIN, PORT, ORG and CO as needed
1327 AuthLDAPURL ldap://ldap.MYDOMAIN.com:PORT/o=ORG,c=CO?uid?sub?(objectClass=*)
1328 require valid-user
1329 &lt;/Location&gt;</pre>
1330 <p>If you want to disable the user authentication you can set
1331 <a href="#item_%24conf%7bcgiadminusers%7d">$Conf{CgiAdminUsers}</A> to '*', which allows any user to have
1332 full access to all hosts and backups. In this case the REMOTE_USER
1333 environment variable does not have to be set by Apache.</p>
1334 <p>Alternatively, you can force a particular user name by getting Apache
1335 to set REMOTE_USER, eg, to hardcode the user to www you could add
1336 this to Apache's httpd.conf:</p>
1337 <pre>
1338 &lt;Location /cgi-bin/BackupPC/BackupPC_Admin&gt; # &lt;--- change path as needed
1339 Setenv REMOTE_USER www
1340 &lt;/Location&gt;</pre>
1341 <p>Finally, you should also edit the config.pl file and adjust, as necessary,
1342 the CGI-specific settings. They're near the end of the config file. In
1343 particular, you should specify which users or groups have administrator
1344 (privileged) access: see the config settings <a href="#item_%24conf%7bcgiadminusergroup%7d">$Conf{CgiAdminUserGroup}</A>
1345 and <a href="#item_%24conf%7bcgiadminusers%7d">$Conf{CgiAdminUsers}</A>. Also, the configure.pl script placed various
1346 images into <a href="#item_%24conf%7bcgiimagedir%7d">$Conf{CgiImageDir}</A> that BackupPC_Admin needs to serve
1347 up. You should make sure that <a href="#item_%24conf%7bcgiimagedirurl%7d">$Conf{CgiImageDirURL}</A> is the correct
1348 URL for the image directory.</p>
1349 <p>See the section <a href="#fixing_installation_problems">Fixing installation problems</a> for suggestions on debugging the Apache authentication setup.</p>
1350 <p>
1351 </p>
1352 <h2><a name="how_backuppc_finds_hosts">How BackupPC Finds Hosts</a></h2>
1353 <p>Starting with v2.0.0 the way hosts are discovered has changed. In most
1354 cases you should specify 0 for the DHCP flag in the conf/hosts file,
1355 even if the host has a dynamically assigned IP address.</p>
1356 <p>BackupPC (starting with v2.0.0) looks up hosts with DHCP = 0 in this manner:</p>
1357 <ul>
1358 <li>
1359 First DNS is used to lookup the IP address given the client's name
1360 using perl's <code>gethostbyname()</code> function. This should succeed for machines
1361 that have fixed IP addresses that are known via DNS. You can manually
1362 see whether a given host have a DNS entry according to perls'
1363 gethostbyname function with this command:
1364 <pre>
1365 perl -e 'print(gethostbyname(&quot;myhost&quot;) ? &quot;ok\n&quot; : &quot;not found\n&quot;);'</pre>
1366 <p></p>
1367 <li>
1368 If <code>gethostbyname()</code> fails, BackupPC then attempts a NetBios multicast to
1369 find the host. Provided your client machine is configured properly,
1370 it should respond to this NetBios multicast request. Specifically,
1371 BackupPC runs a command of this form:
1372 <pre>
1373 nmblookup myhost</pre>
1374 <p>If this fails you will see output like:</p>
1375 <pre>
1376 querying myhost on
1377 name_query failed to find name myhost</pre>
1378 <p>If this success you will see output like:</p>
1379 <pre>
1380 querying myhost on
1381 myhost&lt;00&gt;</pre>
1382 <p>Depending on your netmask you might need to specify the -B option to
1383 nmblookup. For example:</p>
1384 <pre>
1385 nmblookup -B myhost</pre>
1386 <p>If necessary, experiment on the nmblookup command that will return the
1387 IP address of the client given its name. Then update
1388 <a href="#item_%24conf%7bnmblookupfindhostcmd%7d">$Conf{NmbLookupFindHostCmd}</A> with any necessary options to nmblookup.</p>
1389 <p></p></ul>
1390 <p>For hosts that have the DHCP flag set to 1, these machines are
1391 discovered as follows:</p>
1392 <ul>
1393 <li>
1394 A DHCP address pool (<a href="#item_%24conf%7bdhcpaddressranges%7d">$Conf{DHCPAddressRanges}</A>) needs to be specified.
1395 BackupPC will check the NetBIOS name of each machine in the range using
1396 a command of the form:
1397 <pre>
1398 nmblookup -A W.X.Y.Z</pre>
1399 <p>where W.X.Y.Z is each candidate address from <a href="#item_%24conf%7bdhcpaddressranges%7d">$Conf{DHCPAddressRanges}</A>.
1400 Any host that has a valid NetBIOS name returned by this command (ie:
1401 matching an entry in the hosts file) will be backed up. You can
1402 modify the specific nmblookup command if necessary via <a href="#item_%24conf%7bnmblookupcmd%7d">$Conf{NmbLookupCmd}</A>.</p>
1403 <p></p>
1404 <li>
1405 You only need to use this DHCP feature if your client machine doesn't
1406 respond to the NetBios multicast request:
1407 <pre>
1408 nmblookup myHost</pre>
1409 <p>but does respond to a request directed to its IP address:</p>
1410 <pre>
1411 nmblookup -A W.X.Y.Z</pre>
1412 <p></p></ul>
1413 <p>
1414 </p>
1415 <h2><a name="other_installation_topics">Other installation topics</a></h2>
1416 <dl>
1417 <dt><strong><a name="item_removing_a_client">Removing a client</a></strong><br />
1418 </dt>
1419 <dd>
1420 If there is a machine that no longer needs to be backed up (eg: a retired
1421 machine) you have two choices. First, you can keep the backups accessible
1422 and browsable, but disable all new backups. Alternatively, you can
1423 completely remove the client and all its backups.
1424 </dd>
1425 <dd>
1426 <p>To disable backups for a client there are two special values for
1427 <a href="#item_%24conf%7bfullperiod%7d">$Conf{FullPeriod}</A> in that client's per-PC config.pl file:</p>
1428 </dd>
1429 <dl>
1430 <dt><strong><a name="item__2d1">-1</a></strong><br />
1431 </dt>
1432 <dd>
1433 Don't do any regular backups on this machine. Manually
1434 requested backups (via the CGI interface) will still occur.
1435 </dd>
1436 <p></p>
1437 <dt><strong><a name="item__2d2">-2</a></strong><br />
1438 </dt>
1439 <dd>
1440 Don't do any backups on this machine. Manually requested
1441 backups (via the CGI interface) will be ignored.
1442 </dd>
1443 <p></p></dl>
1444 <p>This will still allow that client's old backups to be browsable
1445 and restorable.</p>
1446 <p>To completely remove a client and all its backups, you should remove its
1447 entry in the conf/hosts file, and then delete the __TOPDIR__/pc/$host
1448 directory. Whenever you change the hosts file, you should send
1449 BackupPC a HUP (-1) signal so that it re-reads the hosts file.
1450 If you don't do this, BackupPC will automatically re-read the
1451 hosts file at the next regular wakeup.</p>
1452 <p>Note that when you remove a client's backups you won't initially recover
1453 a lot of disk space. That's because the client's files are still in
1454 the pool. Overnight, when BackupPC_nightly next runs, all the unused
1455 pool files will be deleted and this will recover the disk space used
1456 by the client's backups.</p>
1457 <dt><strong><a name="item_copying_the_pool">Copying the pool</a></strong><br />
1458 </dt>
1459 <dd>
1460 If the pool disk requirements grow you might need to copy the entire
1461 data directory to a new (bigger) file system. Hopefully you are lucky
1462 enough to avoid this by having the data directory on a RAID file system
1463 or LVM that allows the capacity to be grown in place by adding disks.
1464 </dd>
1465 <dd>
1466 <p>The backup data directories contain large numbers of hardlinks. If
1467 you try to copy the pool the target directory will occupy a lot more
1468 space if the hardlinks aren't re-established.</p>
1469 </dd>
1470 <dd>
1471 <p>The GNU cp program with the -a option is aware of hardlinks and knows
1472 to re-establish them. So GNU cp -a is the recommended way to copy
1473 the data directory and pool. Don't forget to stop BackupPC while
1474 the copy runs.</p>
1475 </dd>
1476 <p></p>
1477 <dt><strong><a name="item_compressing_an_existing_pool">Compressing an existing pool</a></strong><br />
1478 </dt>
1479 <dd>
1480 If you are upgrading BackupPC and want to turn compression on you have
1481 two choices:
1482 </dd>
1483 <ul>
1484 <li>
1485 Simply turn on compression. All new backups will be compressed. Both old
1486 (uncompressed) and new (compressed) backups can be browsed and viewed.
1487 Eventually, the old backups will expire and all the pool data will be
1488 compressed. However, until the old backups expire, this approach could
1489 require 60% or more additional pool storage space to store both
1490 uncompressed and compressed versions of the backup files.
1491 <p></p>
1492 <li>
1493 Convert all the uncompressed pool files and backups to compressed.
1494 The script __INSTALLDIR__/bin/BackupPC_compressPool does this.
1495 BackupPC must not be running when you run BackupPC_compressPool.
1496 Also, there must be no existing compressed backups when you
1497 run BackupPC_compressPool.
1498 <p>BackupPC_compressPool compresses all the files in the uncompressed pool
1499 (__TOPDIR__/pool) and moves them to the compressed pool
1500 (__TOPDIR__/cpool). It rewrites the files in place, so that the
1501 existing hardlinks are not disturbed.</p>
1502 <p></p></ul>
1503 <p>The rest of this section discusses how to run BackupPC_compressPool.</p>
1504 <p>BackupPC_compressPool takes three command line options:</p>
1505 <dl>
1506 <dt><strong><a name="item__2dt">-t</a></strong><br />
1507 </dt>
1508 <dd>
1509 Test mode: do everything except actually replace the pool files.
1510 Useful for estimating total run time without making any real
1511 changes.
1512 </dd>
1513 <p></p>
1514 <dt><strong><a name="item__2dr">-r</a></strong><br />
1515 </dt>
1516 <dd>
1517 Read check: re-read the compressed file and compare it against
1518 the original uncompressed file. Can only be used in test mode.
1519 </dd>
1520 <p></p>
1521 <dt><strong><a name="item__2dc__23">-c #</a></strong><br />
1522 </dt>
1523 <dd>
1524 Number of children to fork. BackupPC_compressPool can take a long time
1525 to run, so to speed things up it spawns four children, each working on a
1526 different part of the pool. You can change the number of children with
1527 the -c option.
1528 </dd>
1529 <p></p></dl>
1530 <p>Here are the recommended steps for running BackupPC_compressPool:</p>
1531 <ul>
1532 <li>
1533 Stop BackupPC (eg: ``/etc/init.d/backuppc stop'').
1534 <p></p>
1535 <li>
1536 Set <a href="#item_%24conf%7bcompresslevel%7d">$Conf{CompressLevel}</A> to a non-zero number (eg: 3).
1537 <p></p>
1538 <li>
1539 Do a dry run of BackupPC_compressPool. Make sure you run this as
1540 the BackupPC user (__BACKUPPCUSER__):
1541 <pre>
1542 BackupPC_compressPool -t -r</pre>
1543 <p>The -t option (test mode) makes BackupPC_compressPool do all the steps,
1544 but not actually change anything. The -r option re-reads the compressed
1545 file and compares it against the original.</p>
1546 <p>BackupPC_compressPool gives a status as it completes each 1% of the job.
1547 It also shows the cumulative compression ratio and estimated completion
1548 time. Once you are comfortable that things look ok, you can kill
1549 BackupPC_compressPool or wait for it to finish.</p>
1550 <p></p>
1551 <li>
1552 Now you are ready to run BackupPC_compressPool for real. Once again,
1553 as the BackupPC user (__BACKUPPCUSER__), run:
1554 <pre>
1555 BackupPC_compressPool</pre>
1556 <p>You should put the output into a file and tail this file. (The running
1557 time could be twice as long as the test mode since the test mode file
1558 writes are immediately followed by an unlink, so in test mode it is
1559 likely the file writes never make it to disk.)</p>
1560 <p>It is <strong>critical</strong> that BackupPC_compressPool runs to completion before
1561 re-starting BackupPC. Before BackupPC_compressPool completes, none of
1562 the existing backups will be in a consistent state. If you must stop
1563 BackupPC_compressPool for some reason, send it an INT or TERM signal
1564 and give it several seconds (or more) to clean up gracefully.
1565 After that, you can re-run BackupPC_compressPool and it will start
1566 again where it left off. Once again, it is critical that it runs
1567 to 100% completion.</p>
1568 <p></p></ul>
1569 <p>After BackupPC_compressPool completes you should have a complete set
1570 of compressed backups (and your disk usage should be lower). You
1571 can now re-start BackupPC.</p>
1572 </dl>
1573 <p>
1574 </p>
1575 <h2><a name="fixing_installation_problems">Fixing installation problems</a></h2>
1576 <p>Please see the FAQ at <a href="http://backuppc.sourceforge.net/faq">http://backuppc.sourceforge.net/faq</a> for
1577 debugging suggestions.</p>
1578 <p>
1579 <a href="#__index__"><small>Back to Top</small></a>
1580 </p>
1581 <hr />
1582 <h1><a name="restore_functions">Restore functions</a></h1>
1583 <p>BackupPC supports several different methods for restoring files. The
1584 most convenient restore options are provided via the CGI interface.
1585 Alternatively, backup files can be restored using manual commands.</p>
1586 <p>
1587 </p>
1588 <h2><a name="cgi_restore_options">CGI restore options</a></h2>
1589 <p>By selecting a host in the CGI interface, a list of all the backups
1590 for that machine will be displayed. By selecting the backup number
1591 you can navigate the shares and directory tree for that backup.</p>
1592 <p>BackupPC's CGI interface automatically fills incremental backups
1593 with the corresponding full backup, which means each backup has
1594 a filled appearance. Therefore, there is no need to do multiple
1595 restores from the incremental and full backups: BackupPC does all
1596 the hard work for you. You simply select the files and directories
1597 you want from the correct backup vintage in one step.</p>
1598 <p>You can download a single backup file at any time simply by selecting
1599 it. Your browser should prompt you with the file name and ask you
1600 whether to open the file or save it to disk.</p>
1601 <p>Alternatively, you can select one or more files or directories in
1602 the currently selected directory and select ``Restore selected files''.
1603 (If you need to restore selected files and directories from several
1604 different parent directories you will need to do that in multiple
1605 steps.)</p>
1606 <p>If you select all the files in a directory, BackupPC will replace
1607 the list of files with the parent directory. You will be presented
1608 with a screen that has three options:</p>
1609 <dl>
1610 <dt><strong><a name="item_option_1_3a_direct_restore">Option 1: Direct Restore</a></strong><br />
1611 </dt>
1612 <dd>
1613 With this option the selected files and directories are restored
1614 directly back onto the host, by default in their original location.
1615 Any old files with the same name will be overwritten, so use caution.
1616 You can optionally change the target host name, target share name,
1617 and target path prefix for the restore, allowing you to restore the
1618 files to a different location.
1619 </dd>
1620 <dd>
1621 <p>Once you select ``Start Restore'' you will be prompted one last time
1622 with a summary of the exact source and target files and directories
1623 before you commit. When you give the final go ahead the restore
1624 operation will be queued like a normal backup job, meaning that it
1625 will be deferred if there is a backup currently running for that host.
1626 When the restore job is run, smbclient, tar, rsync or rsyncd is used
1627 (depending upon <a href="#item_%24conf%7bxfermethod%7d">$Conf{XferMethod}</A>) to actually restore the files.
1628 Sorry, there is currently no option to cancel a restore that has been
1629 started.</p>
1630 </dd>
1631 <dd>
1632 <p>A record of the restore request, including the result and list of
1633 files and directories, is kept. It can be browsed from the host's
1634 home page. <a href="#item_%24conf%7brestoreinfokeepcnt%7d">$Conf{RestoreInfoKeepCnt}</A> specifies how many old restore
1635 status files to keep.</p>
1636 </dd>
1637 <dd>
1638 <p>Note that for direct restore to work, the <a href="#item_%24conf%7bxfermethod%7d">$Conf{XferMethod}</A> must
1639 be able to write to the client. For example, that means an SMB
1640 share for smbclient needs to be writable, and the rsyncd module
1641 needs ``read only'' set to ``yes''. This creates additional security
1642 risks. If you only create read-only SMB shares (which is a good
1643 idea), then the direct restore will fail. You can disable the
1644 direct restore option by setting <a href="#item_%24conf%7bsmbclientrestorecmd%7d">$Conf{SmbClientRestoreCmd}</A>,
1645 <a href="#item_%24conf%7btarclientrestorecmd%7d">$Conf{TarClientRestoreCmd}</A> and <a href="#item_%24conf%7brsyncrestoreargs%7d">$Conf{RsyncRestoreArgs}</A> to undef.</p>
1646 </dd>
1647 <p></p>
1648 <dt><strong><a name="item_option_2_3a_download_zip_archive">Option 2: Download Zip archive</a></strong><br />
1649 </dt>
1650 <dd>
1651 With this option a zip file containing the selected files and directories
1652 is downloaded. The zip file can then be unpacked or individual files
1653 extracted as necessary on the host machine. The compression level can be
1654 specified. A value of 0 turns off compression.
1655 </dd>
1656 <dd>
1657 <p>When you select ``Download Zip File'' you should be prompted where to
1658 save the restore.zip file.</p>
1659 </dd>
1660 <dd>
1661 <p>BackupPC does not consider downloading a zip file as an actual
1662 restore operation, so the details are not saved for later browsing
1663 as in the first case. However, a mention that a zip file was
1664 downloaded by a particular user, and a list of the files, does
1665 appear in BackupPC's log file.</p>
1666 </dd>
1667 <p></p>
1668 <dt><strong><a name="item_option_3_3a_download_tar_archive">Option 3: Download Tar archive</a></strong><br />
1669 </dt>
1670 <dd>
1671 This is identical to the previous option, except a tar file is downloaded
1672 rather than a zip file (and there is currently no compression option).
1673 </dd>
1674 <p></p></dl>
1675 <p>
1676 </p>
1677 <h2><a name="commandline_restore_options">Command-line restore options</a></h2>
1678 <p>Apart from the CGI interface, BackupPC allows you to restore files
1679 and directories from the command line. The following programs can
1680 be used:</p>
1681 <dl>
1682 <dt><strong><a name="item_backuppc_zcat">BackupPC_zcat</a></strong><br />
1683 </dt>
1684 <dd>
1685 For each file name argument it inflates (uncompresses) the file and
1686 writes it to stdout. To use BackupPC_zcat you could give it the
1687 full file name, eg:
1688 </dd>
1689 <dd>
1690 <pre>
1691 __INSTALLDIR__/bin/BackupPC_zcat __TOPDIR__/pc/host/5/fc/fcraig/fexample.txt &gt; example.txt</pre>
1692 </dd>
1693 <dd>
1694 <p>It's your responsibility to make sure the file is really compressed:
1695 BackupPC_zcat doesn't check which backup the requested file is from.
1696 BackupPC_zcat returns a non-zero status if it fails to uncompress
1697 a file.</p>
1698 </dd>
1699 <p></p>
1700 <dt><strong><a name="item_backuppc_tarcreate">BackupPC_tarCreate</a></strong><br />
1701 </dt>
1702 <dd>
1703 BackupPC_tarCreate creates a tar file for any files or directories in
1704 a particular backup. Merging of incrementals is done automatically,
1705 so you don't need to worry about whether certain files appear in the
1706 incremental or full backup.
1707 </dd>
1708 <dd>
1709 <p>The usage is:</p>
1710 </dd>
1711 <dd>
1712 <pre>
1713 BackupPC_tarCreate [-t] [-h host] [-n dumpNum] [-s shareName]
1714 [-r pathRemove] [-p pathAdd] [-b BLOCKS] [-w writeBufSz]
1715 files/directories...</pre>
1716 </dd>
1717 <dd>
1718 <p>The command-line files and directories are relative to the specified
1719 shareName. The tar file is written to stdout.</p>
1720 </dd>
1721 <dd>
1722 <p>The required options are:</p>
1723 </dd>
1724 <dl>
1725 <dt><strong><a name="item__2dh_host">-h host</a></strong><br />
1726 </dt>
1727 <dd>
1728 host from which the tar archive is created
1729 </dd>
1730 <p></p>
1731 <dt><strong><a name="item__2dn_dumpnum">-n dumpNum</a></strong><br />
1732 </dt>
1733 <dd>
1734 dump number from which the tar archive is created
1735 </dd>
1736 <p></p>
1737 <dt><strong><a name="item__2ds_sharename">-s shareName</a></strong><br />
1738 </dt>
1739 <dd>
1740 share name from which the tar archive is created
1741 </dd>
1742 <p></p></dl>
1743 <p>Other options are:</p>
1744 <dl>
1745 <dt><strong>-t</strong><br />
1746 </dt>
1747 <dd>
1748 print summary totals
1749 </dd>
1750 <p></p>
1751 <dt><strong><a name="item__2dr_pathremove">-r pathRemove</a></strong><br />
1752 </dt>
1753 <dd>
1754 path prefix that will be replaced with pathAdd
1755 </dd>
1756 <p></p>
1757 <dt><strong><a name="item__2dp_pathadd">-p pathAdd</a></strong><br />
1758 </dt>
1759 <dd>
1760 new path prefix
1761 </dd>
1762 <p></p>
1763 <dt><strong><a name="item__2db_blocks">-b BLOCKS</a></strong><br />
1764 </dt>
1765 <dd>
1766 the tar block size, default is 20, meaning tar writes data in 20 * 512
1767 bytes chunks.
1768 </dd>
1769 <p></p>
1770 <dt><strong><a name="item__2dw_writebufsz">-w writeBufSz</a></strong><br />
1771 </dt>
1772 <dd>
1773 write buffer size, default 1048576 (1MB). You can increase this if
1774 you are trying to stream to a fast tape device.
1775 </dd>
1776 <p></p></dl>
1777 <p>The -h, -n and -s options specify which dump is used to generate
1778 the tar archive. The -r and -p options can be used to relocate
1779 the paths in the tar archive so extracted files can be placed
1780 in a location different from their original location.</p>
1781 <dt><strong><a name="item_backuppc_zipcreate">BackupPC_zipCreate</a></strong><br />
1782 </dt>
1783 <dd>
1784 BackupPC_zipCreate creates a zip file for any files or directories in
1785 a particular backup. Merging of incrementals is done automatically,
1786 so you don't need to worry about whether certain files appear in the
1787 incremental or full backup.
1788 </dd>
1789 <dd>
1790 <p>The usage is:</p>
1791 </dd>
1792 <dd>
1793 <pre>
1794 BackupPC_zipCreate [-t] [-h host] [-n dumpNum] [-s shareName]
1795 [-r pathRemove] [-p pathAdd] [-c compressionLevel]
1796 files/directories...</pre>
1797 </dd>
1798 <dd>
1799 <p>The command-line files and directories are relative to the specified
1800 shareName. The zip file is written to stdout.</p>
1801 </dd>
1802 <dd>
1803 <p>The required options are:</p>
1804 </dd>
1805 <dl>
1806 <dt><strong>-h host</strong><br />
1807 </dt>
1808 <dd>
1809 host from which the zip archive is created
1810 </dd>
1811 <p></p>
1812 <dt><strong>-n dumpNum</strong><br />
1813 </dt>
1814 <dd>
1815 dump number from which the zip archive is created
1816 </dd>
1817 <p></p>
1818 <dt><strong>-s shareName</strong><br />
1819 </dt>
1820 <dd>
1821 share name from which the zip archive is created
1822 </dd>
1823 <p></p></dl>
1824 <p>Other options are:</p>
1825 <dl>
1826 <dt><strong>-t</strong><br />
1827 </dt>
1828 <dd>
1829 print summary totals
1830 </dd>
1831 <p></p>
1832 <dt><strong>-r pathRemove</strong><br />
1833 </dt>
1834 <dd>
1835 path prefix that will be replaced with pathAdd
1836 </dd>
1837 <p></p>
1838 <dt><strong>-p pathAdd</strong><br />
1839 </dt>
1840 <dd>
1841 new path prefix
1842 </dd>
1843 <p></p>
1844 <dt><strong><a name="item__2dc_level">-c level</a></strong><br />
1845 </dt>
1846 <dd>
1847 compression level (default is 0, no compression)
1848 </dd>
1849 <p></p></dl>
1850 <p>The -h, -n and -s options specify which dump is used to generate
1851 the zip archive. The -r and -p options can be used to relocate
1852 the paths in the zip archive so extracted files can be placed
1853 in a location different from their original location.</p>
1854 </dl>
1855 <p>Each of these programs reside in __INSTALLDIR__/bin.</p>
1856 <p>
1857 <a href="#__index__"><small>Back to Top</small></a>
1858 </p>
1859 <hr />
1860 <h1><a name="archive_functions">Archive functions</a></h1>
1861 <p>BackupPC supports archiving to removable media. For users that require
1862 offsite backups, BackupPC can create archives that stream to tape
1863 devices, or create files of specified sizes to fit onto cd or dvd media.</p>
1864 <p>Each archive type is specified by a BackupPC host with its XferMethod
1865 set to 'archive'. This allows for multiple configurations at sites where
1866 there might be a combination of tape and cd/dvd backups being made.</p>
1867 <p>BackupPC provides a menu that allows one or more hosts to be archived.
1868 The most recent backup of each host is archived using BackupPC_tarCreate,
1869 and the output is optionally compressed and split into fixed-sized
1870 files (eg: 650MB).</p>
1871 <p>The archive for each host is done by default using
1872 __INSTALLDIR__/BackupPC_archiveHost. This script can be copied
1873 and customized as needed.</p>
1874 <p>
1875 </p>
1876 <h2><a name="configuring_an_archive_host">Configuring an Archive Host</a></h2>
1877 <p>To create an Archive Host, add it to the hosts file just as any other host
1878 and call it a name that best describes the type of archive, e.g. ArchiveDLT</p>
1879 <p>To tell BackupPC that the Host is for Archives, create a config.pl file in
1880 the Archive Hosts's pc directory, adding the following line:</p>
1881 <p><a href="#item_%24conf%7bxfermethod%7d">$Conf{XferMethod}</A> = 'archive';</p>
1882 <p>To further customise the archive's parameters you can adding the changed
1883 parameters in the host's config.pl file. The parameters are explained in
1884 the config.pl file. Parameters may be fixed or the user can be allowed
1885 to change them (eg: output device).</p>
1886 <p>The per-host archive command is <a href="#item_%24conf%7barchiveclientcmd%7d">$Conf{ArchiveClientCmd}</A>. By default
1887 this invokes</p>
1888 <pre>
1889 __INSTALLDIR__/BackupPC_archiveHost</pre>
1890 <p>which you can copy and customize as necessary.</p>
1891 <p>
1892 </p>
1893 <h2><a name="starting_an_archive">Starting an Archive</a></h2>
1894 <p>In the web interface, click on the Archive Host you wish to use. You will see a
1895 list of previous archives and a summary on each. By clicking the ``Start Archive''
1896 button you are presented with the list of hosts and the approximate backup size
1897 (note this is raw size, not projected compressed size) Select the hosts you wish
1898 to archive and press the ``Archive Selected Hosts'' button.</p>
1899 <p>The next screen allows you to adjust the parameters for this archive run.
1900 Press the ``Start the Archive'' to start archiving the selected hosts with the
1901 parameters displayed.</p>
1902 <p>
1903 <a href="#__index__"><small>Back to Top</small></a>
1904 </p>
1905 <hr />
1906 <h1><a name="backuppc_design">BackupPC Design</a></h1>
1907 <p>
1908 </p>
1909 <h2><a name="some_design_issues">Some design issues</a></h2>
1910 <dl>
1911 <dt><strong><a name="item_pooling_common_files">Pooling common files</a></strong><br />
1912 </dt>
1913 <dd>
1914 To quickly see if a file is already in the pool, an MD5 digest of the
1915 file length and contents is used as the file name in the pool. This
1916 can't guarantee a file is identical: it just reduces the search to
1917 often a single file or handful of files. A complete file comparison
1918 is always done to verify if two files are really the same.
1919 </dd>
1920 <dd>
1921 <p>Identical files on multiples backups are represented by hard links.
1922 Hardlinks are used so that identical files all refer to the same
1923 physical file on the server's disk. Also, hard links maintain
1924 reference counts so that BackupPC knows when to delete unused files
1925 from the pool.</p>
1926 </dd>
1927 <dd>
1928 <p>For the computer-science majors among you, you can think of the pooling
1929 system used by BackupPC as just a chained hash table stored on a (big)
1930 file system.</p>
1931 </dd>
1932 <p></p>
1933 <dt><strong><a name="item_the_hashing_function">The hashing function</a></strong><br />
1934 </dt>
1935 <dd>
1936 There is a tradeoff between how much of file is used for the MD5 digest
1937 and the time taken comparing all the files that have the same hash.
1938 </dd>
1939 <dd>
1940 <p>Using the file length and just the first 4096 bytes of the file for the
1941 MD5 digest produces some repetitions. One example: with 900,000 unique
1942 files in the pool, this hash gives about 7,000 repeated files, and in
1943 the worst case 500 files have the same hash. That's not bad: we only
1944 have to do a single file compare 99.2% of the time. But in the worst
1945 case we have to compare as many as 500 files checking for a match.</p>
1946 </dd>
1947 <dd>
1948 <p>With a modest increase in CPU time, if we use the file length and the
1949 first 256K of the file we now only have 500 repeated files and in the
1950 worst case around 20 files have the same hash. Furthermore, if we
1951 instead use the first and last 128K of the file (more specifically, the
1952 first and eighth 128K chunks for files larger than 1MB) we get only 300
1953 repeated files and in the worst case around 20 files have the same hash.</p>
1954 </dd>
1955 <dd>
1956 <p>Based on this experimentation, this is the hash function used by BackupPC.
1957 It is important that you don't change the hash function after files
1958 are already in the pool. Otherwise your pool will grow to twice the
1959 size until all the old backups (and all the old files with old hashes)
1960 eventually expire.</p>
1961 </dd>
1962 <p></p>
1963 <dt><strong><a name="item_compression">Compression</a></strong><br />
1964 </dt>
1965 <dd>
1966 BackupPC supports compression. It uses the deflate and inflate methods
1967 in the Compress::Zlib module, which is based on the zlib compression
1968 library (see <a href="http://www.gzip.org/zlib/">http://www.gzip.org/zlib/</a>).
1969 </dd>
1970 <dd>
1971 <p>The <a href="#item_%24conf%7bcompresslevel%7d">$Conf{CompressLevel}</A> setting specifies the compression level to use.
1972 Zero (0) means no compression. Compression levels can be from 1 (least
1973 cpu time, slightly worse compression) to 9 (most cpu time, slightly
1974 better compression). The recommended value is 3. Changing it to 5, for
1975 example, will take maybe 20% more cpu time and will get another 2-3%
1976 additional compression. Diminishing returns set in above 5. See the zlib
1977 documentation for more information about compression levels.</p>
1978 </dd>
1979 <dd>
1980 <p>BackupPC implements compression with minimal CPU load. Rather than
1981 compressing every incoming backup file and then trying to match it
1982 against the pool, BackupPC computes the MD5 digest based on the
1983 uncompressed file, and matches against the candidate pool files by
1984 comparing each uncompressed pool file against the incoming backup file.
1985 Since inflating a file takes roughly a factor of 10 less CPU time than
1986 deflating there is a big saving in CPU time.</p>
1987 </dd>
1988 <dd>
1989 <p>The combination of pooling common files and compression can yield
1990 a factor of 8 or more overall saving in backup storage.</p>
1991 </dd>
1992 <p></p></dl>
1993 <p>
1994 </p>
1995 <h2><a name="backuppc_operation">BackupPC operation</a></h2>
1996 <p>BackupPC reads the configuration information from
1997 __TOPDIR__/conf/config.pl. It then runs and manages all the backup
1998 activity. It maintains queues of pending backup requests, user backup
1999 requests and administrative commands. Based on the configuration various
2000 requests will be executed simultaneously.</p>
2001 <p>As specified by <a href="#item_%24conf%7bwakeupschedule%7d">$Conf{WakeupSchedule}</A>, BackupPC wakes up periodically
2002 to queue backups on all the PCs. This is a four step process:</p>
2003 <ol>
2004 <li>
2005 For each host and DHCP address backup requests are queued on the
2006 background command queue.
2007 <p></p>
2008 <li>
2009 For each PC, BackupPC_dump is forked. Several of these may be run in
2010 parallel, based on the configuration. First a ping is done to see if
2011 the machine is alive. If this is a DHCP address, nmblookup is run to
2012 get the netbios name, which is used as the host name. If DNS lookup
2013 fails, <a href="#item_%24conf%7bnmblookupfindhostcmd%7d">$Conf{NmbLookupFindHostCmd}</A> is run to find the IP address from
2014 the host name. The file __TOPDIR__/pc/$host/backups is read to decide
2015 whether a full or incremental backup needs to be run. If no backup is
2016 scheduled, or the ping to $host fails, then BackupPC_dump exits.
2017 <p>The backup is done using the specified XferMethod. Either samba's smbclient
2018 or tar over ssh/rsh/nfs piped into BackupPC_tarExtract, or rsync over ssh/rsh
2019 is run, or rsyncd is connected to, with the incoming data
2020 extracted to __TOPDIR__/pc/$host/new. The XferMethod output is put
2021 into __TOPDIR__/pc/$host/XferLOG.</p>
2022 <p>The letter in the XferLOG file shows the type of object, similar to the
2023 first letter of the modes displayed by ls -l:</p>
2024 <pre>
2025 d -&gt; directory
2026 l -&gt; symbolic link
2027 b -&gt; block special file
2028 c -&gt; character special file
2029 p -&gt; pipe file (fifo)
2030 nothing -&gt; regular file</pre>
2031 <p>The words mean:</p>
2032 <dl>
2033 <dt><strong><a name="item_create">create</a></strong><br />
2034 </dt>
2035 <dd>
2036 new for this backup (ie: directory or file not in pool)
2037 </dd>
2038 <p></p>
2039 <dt><strong><a name="item_pool">pool</a></strong><br />
2040 </dt>
2041 <dd>
2042 found a match in the pool
2043 </dd>
2044 <p></p>
2045 <dt><strong><a name="item_same">same</a></strong><br />
2046 </dt>
2047 <dd>
2048 file is identical to previous backup (contents were
2049 checksummed and verified during full dump).
2050 </dd>
2051 <p></p>
2052 <dt><strong><a name="item_skip">skip</a></strong><br />
2053 </dt>
2054 <dd>
2055 file skipped in incremental because attributes are the
2056 same (only displayed if <a href="#item_%24conf%7bxferloglevel%7d">$Conf{XferLogLevel}</A> &gt;= 2).
2057 </dd>
2058 <p></p></dl>
2059 <p>As BackupPC_tarExtract extracts the files from smbclient or tar, or as
2060 rsync runs, it checks each file in the backup to see if it is identical
2061 to an existing file from any previous backup of any PC. It does this
2062 without needed to write the file to disk. If the file matches an
2063 existing file, a hardlink is created to the existing file in the pool.
2064 If the file does not match any existing files, the file is written to
2065 disk and the file name is saved in __TOPDIR__/pc/$host/NewFileList for
2066 later processing by BackupPC_link. BackupPC_tarExtract and rsync can handle
2067 arbitrarily large files and multiple candidate matching files without
2068 needing to write the file to disk in the case of a match. This
2069 significantly reduces disk writes (and also reads, since the pool file
2070 comparison is done disk to memory, rather than disk to disk).</p>
2071 <p>Based on the configuration settings, BackupPC_dump checks each
2072 old backup to see if any should be removed. Any expired backups
2073 are moved to __TOPDIR__/trash for later removal by BackupPC_trashClean.</p>
2074 <li>
2075 For each complete, good, backup, BackupPC_link is run.
2076 To avoid race conditions as new files are linked into the
2077 pool area, only a single BackupPC_link program runs
2078 at a time and the rest are queued.
2079 <p>BackupPC_link reads the NewFileList written by BackupPC_dump and
2080 inspects each new file in the backup. It re-checks if there is a
2081 matching file in the pool (another BackupPC_link
2082 could have added the file since BackupPC_dump checked). If so, the file
2083 is removed and replaced by a hard link to the existing file. If the file
2084 is new, a hard link to the file is made in the pool area, so that this
2085 file is available for checking against each new file and new backup.</p>
2086 <p>Then, if <a href="#item_%24conf%7bincrfill%7d">$Conf{IncrFill}</A> is set (note that the default setting is
2087 off), for each incremental backup, hard links are made in the new
2088 backup to all files that were not extracted during the incremental
2089 backups. The means the incremental backup looks like a complete
2090 image of the PC (with the exception that files that were removed on
2091 the PC since the last full backup will still appear in the backup
2092 directory tree).</p>
2093 <p>The CGI interface knows how to merge unfilled incremental backups will
2094 the most recent prior filled (full) backup, giving the incremental
2095 backups a filled appearance. The default for <a href="#item_%24conf%7bincrfill%7d">$Conf{IncrFill}</A> is off,
2096 since there is no need to fill incremental backups. This saves
2097 some level of disk activity, since lots of extra hardlinks are no
2098 longer needed (and don't have to be deleted when the backup expires).</p>
2099 <p></p>
2100 <li>
2101 BackupPC_trashClean is always run in the background to remove any
2102 expired backups. Every 5 minutes it wakes up and removes all the files
2103 in __TOPDIR__/trash.
2104 <p>Also, once each night, BackupPC_nightly is run to complete some additional
2105 administrative tasks, such as cleaning the pool. This involves removing
2106 any files in the pool that only have a single hard link (meaning no backups
2107 are using that file). Again, to avoid race conditions, BackupPC_nightly
2108 is only run when there are no BackupPC_dump or BackupPC_link processes
2109 running. Therefore, when it is time to run BackupPC_nightly, no new
2110 backups are started and BackupPC waits until all backups have finished.
2111 Then BackupPC_nightly is run, and until it finishes no new backups are
2112 started. If BackupPC_nightly is slow, the settings</p>
2113 <p></p></ol>
2114 <p>BackupPC also listens for TCP connections on <a href="#item_%24conf%7bserverport%7d">$Conf{ServerPort}</A>, which
2115 is used by the CGI script BackupPC_Admin for status reporting and
2116 user-initiated backup or backup cancel requests.</p>
2117 <p>
2118 </p>
2119 <h2><a name="storage_layout">Storage layout</a></h2>
2120 <p>BackupPC resides in three directories:</p>
2121 <dl>
2122 <dt><strong><a name="item___installdir__">__INSTALLDIR__</a></strong><br />
2123 </dt>
2124 <dd>
2125 Perl scripts comprising BackupPC reside in __INSTALLDIR__/bin,
2126 libraries are in __INSTALLDIR__/lib and documentation
2127 is in __INSTALLDIR__/doc.
2128 </dd>
2129 <p></p>
2130 <dt><strong><a name="item___cgidir__">__CGIDIR__</a></strong><br />
2131 </dt>
2132 <dd>
2133 The CGI script BackupPC_Admin resides in this cgi binary directory.
2134 </dd>
2135 <p></p>
2136 <dt><strong><a name="item___topdir__">__TOPDIR__</a></strong><br />
2137 </dt>
2138 <dd>
2139 All of BackupPC's data (PC backup images, logs, configuration information)
2140 is stored below this directory.
2141 </dd>
2142 <p></p></dl>
2143 <p>Below __TOPDIR__ are several directories:</p>
2144 <dl>
2145 <dt><strong><a name="item___topdir___2fconf">__TOPDIR__/conf</a></strong><br />
2146 </dt>
2147 <dd>
2148 The directory __TOPDIR__/conf contains:
2149 </dd>
2150 <dl>
2151 <dt><strong><a name="item_config_2epl">config.pl</a></strong><br />
2152 </dt>
2153 <dd>
2154 Configuration file. See <a href="#configuration_file">Configuration file</a>
2155 below for more details.
2156 </dd>
2157 <p></p>
2158 <dt><strong><a name="item_hosts">hosts</a></strong><br />
2159 </dt>
2160 <dd>
2161 Hosts file, which lists all the PCs to backup.
2162 </dd>
2163 <p></p></dl>
2164 <dt><strong><a name="item___topdir___2flog">__TOPDIR__/log</a></strong><br />
2165 </dt>
2166 <dd>
2167 The directory __TOPDIR__/log contains:
2168 </dd>
2169 <dl>
2170 <dt><strong><a name="item_log">LOG</a></strong><br />
2171 </dt>
2172 <dd>
2173 Current (today's) log file output from BackupPC.
2174 </dd>
2175 <p></p>
2176 <dt><strong><a name="item_log_2e0_or_log_2e0_2ez">LOG.0 or LOG.0.z</a></strong><br />
2177 </dt>
2178 <dd>
2179 Yesterday's log file output. Log files are aged daily and compressed
2180 (if compression is enabled), and old LOG files are deleted.
2181 </dd>
2182 <p></p>
2183 <dt><strong><a name="item_backuppc_2epid">BackupPC.pid</a></strong><br />
2184 </dt>
2185 <dd>
2186 Contains BackupPC's process id.
2187 </dd>
2188 <p></p>
2189 <dt><strong><a name="item_status_2epl">status.pl</a></strong><br />
2190 </dt>
2191 <dd>
2192 A summary of BackupPC's status written periodically by BackupPC so
2193 that certain state information can be maintained if BackupPC is
2194 restarted. Should not be edited.
2195 </dd>
2196 <p></p>
2197 <dt><strong><a name="item_useremailinfo_2epl">UserEmailInfo.pl</a></strong><br />
2198 </dt>
2199 <dd>
2200 A summary of what email was last sent to each user, and when the
2201 last email was sent. Should not be edited.
2202 </dd>
2203 <p></p></dl>
2204 <dt><strong><a name="item___topdir___2ftrash">__TOPDIR__/trash</a></strong><br />
2205 </dt>
2206 <dd>
2207 Any directories and files below this directory are periodically deleted
2208 whenever BackupPC_trashClean checks. When a backup is aborted or when an
2209 old backup expires, BackupPC_dump simply moves the directory to
2210 __TOPDIR__/trash for later removal by BackupPC_trashClean.
2211 </dd>
2212 <p></p>
2213 <dt><strong><a name="item___topdir___2fpool">__TOPDIR__/pool</a></strong><br />
2214 </dt>
2215 <dd>
2216 All uncompressed files from PC backups are stored below __TOPDIR__/pool.
2217 Each file's name is based on the MD5 hex digest of the file contents.
2218 Specifically, for files less than 256K, the file length and the entire
2219 file is used. For files up to 1MB, the file length and the first and
2220 last 128K are used. Finally, for files longer than 1MB, the file length,
2221 and the first and eighth 128K chunks for the file are used.
2222 </dd>
2223 <dd>
2224 <p>Each file is stored in a subdirectory X/Y/Z, where X, Y, Z are the
2225 first 3 hex digits of the MD5 digest.</p>
2226 </dd>
2227 <dd>
2228 <p>For example, if a file has an MD5 digest of 123456789abcdef0,
2229 the file is stored in __TOPDIR__/pool/1/2/3/123456789abcdef0.</p>
2230 </dd>
2231 <dd>
2232 <p>The MD5 digest might not be unique (especially since not all the file's
2233 contents are used for files bigger than 256K). Different files that have
2234 the same MD5 digest are stored with a trailing suffix ``_n'' where n is
2235 an incrementing number starting at 0. So, for example, if two additional
2236 files were identical to the first, except the last byte was different,
2237 and assuming the file was larger than 1MB (so the MD5 digests are the
2238 same but the files are actually different), the three files would be
2239 stored as:</p>
2240 </dd>
2241 <dd>
2242 <pre>
2243 __TOPDIR__/pool/1/2/3/123456789abcdef0
2244 __TOPDIR__/pool/1/2/3/123456789abcdef0_0
2245 __TOPDIR__/pool/1/2/3/123456789abcdef0_1</pre>
2246 </dd>
2247 <dd>
2248 <p>Both BackupPC_dump (actually, BackupPC_tarExtract) and BackupPC_link are
2249 responsible for checking newly backed up files against the pool. For
2250 each file, the MD5 digest is used to generate a file name in the pool
2251 directory. If the file exists in the pool, the contents are compared.
2252 If there is no match, additional files ending in ``_n'' are checked.
2253 (Actually, BackupPC_tarExtract compares multiple candidate files in
2254 parallel.) If the file contents exactly match, the file is created by
2255 simply making a hard link to the pool file (this is done by
2256 BackupPC_tarExtract as the backup proceeds). Otherwise,
2257 BackupPC_tarExtract writes the new file to disk and a new hard link is
2258 made in the pool to the file (this is done later by BackupPC_link).</p>
2259 </dd>
2260 <dd>
2261 <p>Therefore, every file in the pool will have at least 2 hard links
2262 (one for the pool file and one for the backup file below __TOPDIR__/pc).
2263 Identical files from different backups or PCs will all be linked to
2264 the same file. When old backups are deleted, some files in the pool
2265 might only have one link. BackupPC_nightly checks the entire pool
2266 and removes all files that have only a single link, thereby recovering
2267 the storage for that file.</p>
2268 </dd>
2269 <dd>
2270 <p>One other issue: zero length files are not pooled, since there are a lot
2271 of these files and on most file systems it doesn't save any disk space
2272 to turn these files into hard links.</p>
2273 </dd>
2274 <p></p>
2275 <dt><strong><a name="item___topdir___2fcpool">__TOPDIR__/cpool</a></strong><br />
2276 </dt>
2277 <dd>
2278 All compressed files from PC backups are stored below __TOPDIR__/cpool.
2279 Its layout is the same as __TOPDIR__/pool, and the hashing function
2280 is the same (and, importantly, based on the uncompressed file, not
2281 the compressed file).
2282 </dd>
2283 <p></p>
2284 <dt><strong><a name="item___topdir___2fpc_2f_24host">__TOPDIR__/pc/$host</a></strong><br />
2285 </dt>
2286 <dd>
2287 For each PC $host, all the backups for that PC are stored below
2288 the directory __TOPDIR__/pc/$host. This directory contains the
2289 following files:
2290 </dd>
2291 <dl>
2292 <dt><strong>LOG</strong><br />
2293 </dt>
2294 <dd>
2295 Current log file for this PC from BackupPC_dump.
2296 </dd>
2297 <p></p>
2298 <dt><strong>LOG.0 or LOG.0.z</strong><br />
2299 </dt>
2300 <dd>
2301 Last month's log file. Log files are aged monthly and compressed
2302 (if compression is enabled), and old LOG files are deleted.
2303 </dd>
2304 <p></p>
2305 <dt><strong><a name="item_xfererr_or_xfererr_2ez">XferERR or XferERR.z</a></strong><br />
2306 </dt>
2307 <dd>
2308 Output from the transport program (ie: smbclient, tar or rsync)
2309 for the most recent failed backup.
2310 </dd>
2311 <p></p>
2312 <dt><strong><a name="item_new">new</a></strong><br />
2313 </dt>
2314 <dd>
2315 Subdirectory in which the current backup is stored. This
2316 directory is renamed if the backup succeeds.
2317 </dd>
2318 <p></p>
2319 <dt><strong><a name="item_xferlog_or_xferlog_2ez">XferLOG or XferLOG.z</a></strong><br />
2320 </dt>
2321 <dd>
2322 Output from the transport program (ie: smbclient, tar or rsync)
2323 for the current backup.
2324 </dd>
2325 <p></p>
2326 <dt><strong><a name="item_nnn">nnn (an integer)</a></strong><br />
2327 </dt>
2328 <dd>
2329 Successful backups are in directories numbered sequentially starting at 0.
2330 </dd>
2331 <p></p>
2332 <dt><strong><a name="item_xferlog_2ennn_or_xferlog_2ennn_2ez">XferLOG.nnn or XferLOG.nnn.z</a></strong><br />
2333 </dt>
2334 <dd>
2335 Output from the transport program (ie: smbclient, tar or rsync)
2336 corresponding to backup number nnn.
2337 </dd>
2338 <p></p>
2339 <dt><strong><a name="item_restoreinfo_2ennn">RestoreInfo.nnn</a></strong><br />
2340 </dt>
2341 <dd>
2342 Information about restore request #nnn including who, what, when, and
2343 why. This file is in Data::Dumper format. (Note that the restore
2344 numbers are not related to the backup number.)
2345 </dd>
2346 <p></p>
2347 <dt><strong><a name="item_restorelog_2ennn_2ez">RestoreLOG.nnn.z</a></strong><br />
2348 </dt>
2349 <dd>
2350 Output from smbclient, tar or rsync during restore #nnn. (Note that the restore
2351 numbers are not related to the backup number.)
2352 </dd>
2353 <p></p>
2354 <dt><strong><a name="item_archiveinfo_2ennn">ArchiveInfo.nnn</a></strong><br />
2355 </dt>
2356 <dd>
2357 Information about archive request #nnn including who, what, when, and
2358 why. This file is in Data::Dumper format. (Note that the archive
2359 numbers are not related to the restore or backup number.)
2360 </dd>
2361 <p></p>
2362 <dt><strong><a name="item_archivelog_2ennn_2ez">ArchiveLOG.nnn.z</a></strong><br />
2363 </dt>
2364 <dd>
2365 Output from archive #nnn. (Note that the archive numbers are not related
2366 to the backup or restore number.)
2367 </dd>
2368 <p></p>
2369 <dt><strong>config.pl</strong><br />
2370 </dt>
2371 <dd>
2372 Optional configuration settings specific to this host. Settings in this
2373 file override the main configuration file.
2374 </dd>
2375 <p></p>
2376 <dt><strong><a name="item_backups">backups</a></strong><br />
2377 </dt>
2378 <dd>
2379 A tab-delimited ascii table listing information about each successful
2380 backup, one per row. The columns are:
2381 </dd>
2382 <dl>
2383 <dt><strong><a name="item_num">num</a></strong><br />
2384 </dt>
2385 <dd>
2386 The backup number, an integer that starts at 0 and increments
2387 for each successive backup. The corresponding backup is stored
2388 in the directory num (eg: if this field is 5, then the backup is
2389 stored in __TOPDIR__/pc/$host/5).
2390 </dd>
2391 <p></p>
2392 <dt><strong><a name="item_type">type</a></strong><br />
2393 </dt>
2394 <dd>
2395 Set to ``full'' or ``incr'' for full or incremental backup.
2396 </dd>
2397 <p></p>
2398 <dt><strong><a name="item_starttime">startTime</a></strong><br />
2399 </dt>
2400 <dd>
2401 Start time of the backup in unix seconds.
2402 </dd>
2403 <p></p>
2404 <dt><strong><a name="item_endtime">endTime</a></strong><br />
2405 </dt>
2406 <dd>
2407 Stop time of the backup in unix seconds.
2408 </dd>
2409 <p></p>
2410 <dt><strong><a name="item_nfiles">nFiles</a></strong><br />
2411 </dt>
2412 <dd>
2413 Number of files backed up (as reported by smbclient, tar or rsync).
2414 </dd>
2415 <p></p>
2416 <dt><strong><a name="item_size">size</a></strong><br />
2417 </dt>
2418 <dd>
2419 Total file size backed up (as reported by smbclient, tar or rsync).
2420 </dd>
2421 <p></p>
2422 <dt><strong><a name="item_nfilesexist">nFilesExist</a></strong><br />
2423 </dt>
2424 <dd>
2425 Number of files that were already in the pool
2426 (as determined by BackupPC_dump and BackupPC_link).
2427 </dd>
2428 <p></p>
2429 <dt><strong><a name="item_sizeexist">sizeExist</a></strong><br />
2430 </dt>
2431 <dd>
2432 Total size of files that were already in the pool
2433 (as determined by BackupPC_dump and BackupPC_link).
2434 </dd>
2435 <p></p>
2436 <dt><strong><a name="item_nfilesnew">nFilesNew</a></strong><br />
2437 </dt>
2438 <dd>
2439 Number of files that were not in the pool
2440 (as determined by BackupPC_link).
2441 </dd>
2442 <p></p>
2443 <dt><strong><a name="item_sizenew">sizeNew</a></strong><br />
2444 </dt>
2445 <dd>
2446 Total size of files that were not in the pool
2447 (as determined by BackupPC_link).
2448 </dd>
2449 <p></p>
2450 <dt><strong><a name="item_xfererrs">xferErrs</a></strong><br />
2451 </dt>
2452 <dd>
2453 Number of errors or warnings from smbclient, tar or rsync.
2454 </dd>
2455 <p></p>
2456 <dt><strong><a name="item_xferbadfile">xferBadFile</a></strong><br />
2457 </dt>
2458 <dd>
2459 Number of errors from smbclient that were bad file errors (zero otherwise).
2460 </dd>
2461 <p></p>
2462 <dt><strong><a name="item_xferbadshare">xferBadShare</a></strong><br />
2463 </dt>
2464 <dd>
2465 Number of errors from smbclient that were bad share errors (zero otherwise).
2466 </dd>
2467 <p></p>
2468 <dt><strong><a name="item_tarerrs">tarErrs</a></strong><br />
2469 </dt>
2470 <dd>
2471 Number of errors from BackupPC_tarExtract.
2472 </dd>
2473 <p></p>
2474 <dt><strong><a name="item_compress">compress</a></strong><br />
2475 </dt>
2476 <dd>
2477 The compression level used on this backup. Zero or empty means no
2478 compression.
2479 </dd>
2480 <p></p>
2481 <dt><strong><a name="item_sizeexistcomp">sizeExistComp</a></strong><br />
2482 </dt>
2483 <dd>
2484 Total compressed size of files that were already in the pool
2485 (as determined by BackupPC_dump and BackupPC_link).
2486 </dd>
2487 <p></p>
2488 <dt><strong><a name="item_sizenewcomp">sizeNewComp</a></strong><br />
2489 </dt>
2490 <dd>
2491 Total compressed size of files that were not in the pool
2492 (as determined by BackupPC_link).
2493 </dd>
2494 <p></p>
2495 <dt><strong><a name="item_nofill">noFill</a></strong><br />
2496 </dt>
2497 <dd>
2498 Set if this backup has not been filled in with the most recent
2499 previous filled or full backup. See <a href="#item_%24conf%7bincrfill%7d">$Conf{IncrFill}</A>.
2500 </dd>
2501 <p></p>
2502 <dt><strong><a name="item_fillfromnum">fillFromNum</a></strong><br />
2503 </dt>
2504 <dd>
2505 If this backup was filled (ie: noFill is 0) then this is the
2506 number of the backup that it was filled from
2507 </dd>
2508 <p></p>
2509 <dt><strong><a name="item_mangle">mangle</a></strong><br />
2510 </dt>
2511 <dd>
2512 Set if this backup has mangled file names and attributes. Always
2513 true for backups in v1.4.0 and above. False for all backups prior
2514 to v1.4.0.
2515 </dd>
2516 <p></p>
2517 <dt><strong><a name="item_xfermethod">xferMethod</a></strong><br />
2518 </dt>
2519 <dd>
2520 Set to the value of <a href="#item_%24conf%7bxfermethod%7d">$Conf{XferMethod}</A> when this dump was done.
2521 </dd>
2522 <p></p>
2523 <dt><strong><a name="item_level">level</a></strong><br />
2524 </dt>
2525 <dd>
2526 The level of this dump. A full dump is level 0. Currently incrementals
2527 are 1. But when multi-level incrementals are supported this will reflect
2528 each dump's incremental level.
2529 </dd>
2530 <p></p></dl>
2531 <dt><strong><a name="item_restores">restores</a></strong><br />
2532 </dt>
2533 <dd>
2534 A tab-delimited ascii table listing information about each requested
2535 restore, one per row. The columns are:
2536 </dd>
2537 <dl>
2538 <dt><strong>num</strong><br />
2539 </dt>
2540 <dd>
2541 Restore number (matches the suffix of the RestoreInfo.nnn and
2542 RestoreLOG.nnn.z file), unrelated to the backup number.
2543 </dd>
2544 <p></p>
2545 <dt><strong>startTime</strong><br />
2546 </dt>
2547 <dd>
2548 Start time of the restore in unix seconds.
2549 </dd>
2550 <p></p>
2551 <dt><strong>endTime</strong><br />
2552 </dt>
2553 <dd>
2554 End time of the restore in unix seconds.
2555 </dd>
2556 <p></p>
2557 <dt><strong><a name="item_result">result</a></strong><br />
2558 </dt>
2559 <dd>
2560 Result (ok or failed).
2561 </dd>
2562 <p></p>
2563 <dt><strong><a name="item_errormsg">errorMsg</a></strong><br />
2564 </dt>
2565 <dd>
2566 Error message if restore failed.
2567 </dd>
2568 <p></p>
2569 <dt><strong>nFiles</strong><br />
2570 </dt>
2571 <dd>
2572 Number of files restored.
2573 </dd>
2574 <p></p>
2575 <dt><strong>size</strong><br />
2576 </dt>
2577 <dd>
2578 Size in bytes of the restored files.
2579 </dd>
2580 <p></p>
2581 <dt><strong><a name="item_tarcreateerrs">tarCreateErrs</a></strong><br />
2582 </dt>
2583 <dd>
2584 Number of errors from BackupPC_tarCreate during restore.
2585 </dd>
2586 <p></p>
2587 <dt><strong>xferErrs</strong><br />
2588 </dt>
2589 <dd>
2590 Number of errors from smbclient, tar or rsync during restore.
2591 </dd>
2592 <p></p></dl>
2593 <dt><strong><a name="item_archives">archives</a></strong><br />
2594 </dt>
2595 <dd>
2596 A tab-delimited ascii table listing information about each requested
2597 archive, one per row. The columns are:
2598 </dd>
2599 <dl>
2600 <dt><strong>num</strong><br />
2601 </dt>
2602 <dd>
2603 Archive number (matches the suffix of the ArchiveInfo.nnn and
2604 ArchiveLOG.nnn.z file), unrelated to the backup or restore number.
2605 </dd>
2606 <p></p>
2607 <dt><strong>startTime</strong><br />
2608 </dt>
2609 <dd>
2610 Start time of the restore in unix seconds.
2611 </dd>
2612 <p></p>
2613 <dt><strong>endTime</strong><br />
2614 </dt>
2615 <dd>
2616 End time of the restore in unix seconds.
2617 </dd>
2618 <p></p>
2619 <dt><strong>result</strong><br />
2620 </dt>
2621 <dd>
2622 Result (ok or failed).
2623 </dd>
2624 <p></p>
2625 <dt><strong>errorMsg</strong><br />
2626 </dt>
2627 <dd>
2628 Error message if archive failed.
2629 </dd>
2630 <p></p></dl>
2631 </dl>
2632 </dl>
2633 <p>
2634 </p>
2635 <h2><a name="compressed_file_format">Compressed file format</a></h2>
2636 <p>The compressed file format is as generated by Compress::Zlib::deflate
2637 with one minor, but important, tweak. Since Compress::Zlib::inflate
2638 fully inflates its argument in memory, it could take large amounts of
2639 memory if it was inflating a highly compressed file. For example, a
2640 200MB file of 0x0 bytes compresses to around 200K bytes. If
2641 Compress::Zlib::inflate was called with this single 200K buffer, it
2642 would need to allocate 200MB of memory to return the result.</p>
2643 <p>BackupPC watches how efficiently a file is compressing. If a big file
2644 has very high compression (meaning it will use too much memory when it
2645 is inflated), BackupPC calls the <code>flush()</code> method, which gracefully
2646 completes the current compression. BackupPC then starts another
2647 deflate and simply appends the output file. So the BackupPC compressed
2648 file format is one or more concatenated deflations/flushes. The specific
2649 ratios that BackupPC uses is that if a 6MB chunk compresses to less
2650 than 64K then a flush will be done.</p>
2651 <p>Back to the example of the 200MB file of 0x0 bytes. Adding flushes
2652 every 6MB adds only 200 or so bytes to the 200K output. So the
2653 storage cost of flushing is negligible.</p>
2654 <p>To easily decompress a BackupPC compressed file, the script
2655 BackupPC_zcat can be found in __INSTALLDIR__/bin. For each
2656 file name argument it inflates the file and writes it to stdout.</p>
2657 <p>
2658 </p>
2659 <h2><a name="rsync_checksum_caching">Rsync checksum caching</a></h2>
2660 <p>An incremental backup with rsync compares attributes on the client
2661 with the last full backup. Any files with identical attributes
2662 are skipped. A full backup with rsync sets the --ignore-times
2663 option, which causes every file to be examined independent of
2664 attributes.</p>
2665 <p>Each file is examined by generating block checksums (default 2K
2666 blocks) on the receiving side (that's the BackupPC side), sending
2667 those checksums to the client, where the remote rsync matches those
2668 checksums with the corresponding file. The matching blocks and new
2669 data is sent back, allowing the client file to be reassembled.
2670 A checksum for the entire file is sent to as an extra check the
2671 the reconstructed file is correct.</p>
2672 <p>This results in significant disk IO and computation for BackupPC:
2673 every file in a full backup, or any file with non-matching attributes
2674 in an incremental backup, needs to be uncompressed, block checksums
2675 computed and sent. Then the receiving side reassembles the file and
2676 has to verify the whole-file checksum. Even if the file is identical,
2677 prior to 2.1.0, BackupPC had to read and uncompress the file twice,
2678 once to compute the block checksums and later to verify the whole-file
2679 checksum.</p>
2680 <p>Starting in 2.1.0, BackupPC supports optional checksum caching,
2681 which means the block and file checksums only need to be computed
2682 once for each file. This results in a significant performance
2683 improvement. This only works for compressed pool files.
2684 It is enabled by adding</p>
2685 <pre>
2686 '--checksum-seed=32761',</pre>
2687 <p>to <a href="#item_%24conf%7brsyncargs%7d">$Conf{RsyncArgs}</A> and <a href="#item_%24conf%7brsyncrestoreargs%7d">$Conf{RsyncRestoreArgs}</A>.</p>
2688 <p>Rsync versions prior to and including rsync-2.6.2 need a small patch to
2689 add support for the --checksum-seed option. This patch is available in
2690 the cygwin-rsyncd package at <a href="http://backuppc.sourceforge.net">http://backuppc.sourceforge.net</a>.
2691 This patch is already included in rsync CVS, so it will be standard
2692 in future versions of rsync.</p>
2693 <p>When this option is present, BackupPC will add block and file checksums
2694 to the compressed pool file the next time a pool file is used and it
2695 doesn't already have cached checksums. The first time a new file is
2696 written to the pool, the checksums are not appended. The next time
2697 checksums are needed for a file, they are computed and added. So the
2698 full performance benefit of checksum caching won't be noticed until the
2699 third time a pool file is used (eg: the third full backup).</p>
2700 <p>With checksum caching enabled, there is a risk that should a file's contents
2701 in the pool be corrupted due to a disk problem, but the cached checksums
2702 are still correct, the corruption will not be detected by a full backup,
2703 since the file contents are no longer read and compared. To reduce the
2704 chance that this remains undetected, BackupPC can recheck cached checksums
2705 for a fraction of the files. This fraction is set with the
2706 <a href="#item_%24conf%7brsynccsumcacheverifyprob%7d">$Conf{RsyncCsumCacheVerifyProb}</A> setting. The default value of 0.01 means
2707 that 1% of the time a file's checksums are read, the checksums are verified.
2708 This reduces performance slightly, but, over time, ensures that files
2709 contents are in sync with the cached checksums.</p>
2710 <p>The format of the cached checksum data can be discovered by looking at
2711 the code. Basically, the first byte of the compressed file is changed
2712 to denote that checksums are appended. The block and file checksum
2713 data, plus some other information and magic word, are appended to the
2714 compressed file. This allows the cache update to be done in-place.</p>
2715 <p>
2716 </p>
2717 <h2><a name="file_name_mangling">File name mangling</a></h2>
2718 <p>Backup file names are stored in ``mangled'' form. Each node of
2719 a path is preceded by ``f'' (mnemonic: file), and special characters
2720 (\n, \r, % and /) are URI-encoded as ``%xx'', where xx is the ascii
2721 character's hex value. So c:/craig/example.txt is now stored as
2722 fc/fcraig/fexample.txt.</p>
2723 <p>This was done mainly so meta-data could be stored alongside the backup
2724 files without name collisions. In particular, the attributes for the
2725 files in a directory are stored in a file called ``attrib'', and mangling
2726 avoids file name collisions (I discarded the idea of having a duplicate
2727 directory tree for every backup just to store the attributes). Other
2728 meta-data (eg: rsync checksums) could be stored in file names preceded
2729 by, eg, ``c''. There are two other benefits to mangling: the share name
2730 might contain ``/'' (eg: ``/home/craig'' for tar transport), and I wanted
2731 that represented as a single level in the storage tree. Secondly, as
2732 files are written to NewFileList for later processing by BackupPC_link,
2733 embedded newlines in the file's path will cause problems which are
2734 avoided by mangling.</p>
2735 <p>The CGI script undoes the mangling, so it is invisible to the user.
2736 Old (unmangled) backups are still supported by the CGI
2737 interface.</p>
2738 <p>
2739 </p>
2740 <h2><a name="special_files">Special files</a></h2>
2741 <p>Linux/unix file systems support several special file types: symbolic
2742 links, character and block device files, fifos (pipes) and unix-domain
2743 sockets. All except unix-domain sockets are supported by BackupPC
2744 (there's no point in backing up or restoring unix-domain sockets since
2745 they only have meaning after a process creates them). Symbolic links are
2746 stored as a plain file whose contents are the contents of the link (not
2747 the file it points to). This file is compressed and pooled like any
2748 normal file. Character and block device files are also stored as plain
2749 files, whose contents are two integers separated by a comma; the numbers
2750 are the major and minor device number. These files are compressed and
2751 pooled like any normal file. Fifo files are stored as empty plain files
2752 (which are not pooled since they have zero size). In all cases, the
2753 original file type is stored in the attrib file so it can be correctly
2754 restored.</p>
2755 <p>Hardlinks are also supported. When GNU tar first encounters a file with
2756 more than one link (ie: hardlinks) it dumps it as a regular file. When
2757 it sees the second and subsequent hardlinks to the same file, it dumps
2758 just the hardlink information. BackupPC correctly recognizes these
2759 hardlinks and stores them just like symlinks: a regular text file
2760 whose contents is the path of the file linked to. The CGI script
2761 will download the original file when you click on a hardlink.</p>
2762 <p>Also, BackupPC_tarCreate has enough magic to re-create the hardlinks
2763 dynamically based on whether or not the original file and hardlinks
2764 are both included in the tar file. For example, imagine a/b/x is a
2765 hardlink to a/c/y. If you use BackupPC_tarCreate to restore directory
2766 a, then the tar file will include a/b/x as the original file and a/c/y
2767 will be a hardlink to a/b/x. If, instead you restore a/c, then the
2768 tar file will include a/c/y as the original file, not a hardlink.</p>
2769 <p>
2770 </p>
2771 <h2><a name="attribute_file_format">Attribute file format</a></h2>
2772 <p>The unix attributes for the contents of a directory (all the files and
2773 directories in that directory) are stored in a file called attrib.
2774 There is a single attrib file for each directory in a backup.
2775 For example, if c:/craig contains a single file c:/craig/example.txt,
2776 that file would be stored as fc/fcraig/fexample.txt and there would be an
2777 attribute file in fc/fcraig/attrib (and also fc/attrib and ./attrib).
2778 The file fc/fcraig/attrib would contain a single entry containing the
2779 attributes for fc/fcraig/fexample.txt.</p>
2780 <p>The attrib file starts with a magic number, followed by the
2781 concatenation of the following information for each file:</p>
2782 <ul>
2783 <li>
2784 File name length in perl's pack ``w'' format (variable length base 128).
2785 <p></p>
2786 <li>
2787 File name.
2788 <p></p>
2789 <li>
2790 The unix file type, mode, uid, gid and file size divided by 4GB and
2791 file size modulo 4GB (type mode uid gid sizeDiv4GB sizeMod4GB),
2792 in perl's pack ``w'' format (variable length base 128).
2793 <p></p>
2794 <li>
2795 The unix mtime (unix seconds) in perl's pack ``N'' format (32 bit integer).
2796 <p></p></ul>
2797 <p>The attrib file is also compressed if compression is enabled.
2798 See the lib/BackupPC/Attrib.pm module for full details.</p>
2799 <p>Attribute files are pooled just like normal backup files. This saves
2800 space if all the files in a directory have the same attributes across
2801 multiple backups, which is common.</p>
2802 <p>
2803 </p>
2804 <h2><a name="optimizations">Optimizations</a></h2>
2805 <p>BackupPC doesn't care about the access time of files in the pool
2806 since it saves attribute meta-data separate from the files. Since
2807 BackupPC mostly does reads from disk, maintaining the access time of
2808 files generates a lot of unnecessary disk writes. So, provided
2809 BackupPC has a dedicated data disk, you should consider mounting
2810 BackupPC's data directory with the noatime attribute (see mount(1)).</p>
2811 <p>
2812 </p>
2813 <h2><a name="limitations">Limitations</a></h2>
2814 <p>BackupPC isn't perfect (but it is getting better). Please see
2815 <a href="http://backuppc.sourceforge.net/faq/limitations.html">http://backuppc.sourceforge.net/faq/limitations.html</a> for a
2816 discussion of some of BackupPC's limitations.</p>
2817 <p>
2818 </p>
2819 <h2><a name="security_issues">Security issues</a></h2>
2820 <p>Please see <a href="http://backuppc.sourceforge.net/faq/security.html">http://backuppc.sourceforge.net/faq/security.html</a> for a
2821 discussion of some of various security issues.</p>
2822 <p>
2823 <a href="#__index__"><small>Back to Top</small></a>
2824 </p>
2825 <hr />
2826 <h1><a name="configuration_file">Configuration File</a></h1>
2827 <p>The BackupPC configuration file resides in __TOPDIR__/conf/config.pl.
2828 Optional per-PC configuration files reside in __TOPDIR__/pc/$host/config.pl.
2829 This file can be used to override settings just for a particular PC.</p>
2830 <p>
2831 </p>
2832 <h2><a name="modifying_the_main_configuration_file">Modifying the main configuration file</a></h2>
2833 <p>The configuration file is a perl script that is executed by BackupPC, so
2834 you should be careful to preserve the file syntax (punctuation, quotes
2835 etc) when you edit it. It is recommended that you use CVS, RCS or some
2836 other method of source control for changing config.pl.</p>
2837 <p>BackupPC reads or re-reads the main configuration file and
2838 the hosts file in three cases:</p>
2839 <ul>
2840 <li>
2841 Upon startup.
2842 <p></p>
2843 <li>
2844 When BackupPC is sent a HUP (-1) signal. Assuming you installed the
2845 init.d script, you can also do this with ``/etc/init.d/backuppc reload''.
2846 <p></p>
2847 <li>
2848 When the modification time of config.pl file changes. BackupPC
2849 checks the modification time once during each regular wakeup.
2850 <p></p></ul>
2851 <p>Whenever you change the configuration file you can either do
2852 a kill -HUP BackupPC_pid or simply wait until the next regular
2853 wakeup period.</p>
2854 <p>Each time the configuration file is re-read a message is reported in the
2855 LOG file, so you can tail it (or view it via the CGI interface) to make
2856 sure your kill -HUP worked. Errors in parsing the configuration file are
2857 also reported in the LOG file.</p>
2858 <p>The optional per-PC configuration file (__TOPDIR__/pc/$host/config.pl)
2859 is read whenever it is needed by BackupPC_dump, BackupPC_link and others.</p>
2860 <p>
2861 </p>
2862 <h2><a name="configuration_file_includes">Configuration file includes</a></h2>
2863 <p>If you have a heterogeneous set of clients (eg: a variety of WinXX and
2864 linux/unix machines) you will need to create host-specific config.pl files
2865 for some or all of these machines to customize the default settings from
2866 the master config.pl file (at a minimum to set <a href="#item_%24conf%7bxfermethod%7d">$Conf{XferMethod}</A>).</p>
2867 <p>Since the config.pl file is just regular perl code, you can include
2868 one config file from another. For example, imagine you had three general
2869 classes of machines: WinXX desktops, linux machines in the DMZ and
2870 linux desktops. You could create three config files in __TOPDIR__/conf:</p>
2871 <pre>
2872 __TOPDIR__/conf/ConfigWinDesktop.pl
2873 __TOPDIR__/conf/ConfigLinuxDMZ.pl
2874 __TOPDIR__/conf/ConfigLinuxDesktop.pl</pre>
2875 <p>From each client's directory you can either add a symbolic link to
2876 the appropriate config file:</p>
2877 <pre>
2878 cd __TOPDIR__/pc/$host
2879 ln -s ../../conf/ConfigWinDesktop.pl config.pl</pre>
2880 <p>or, better yet, create a config.pl file in __TOPDIR__/pc/$host
2881 that includes the default config.pl file using perl's ``do''
2882 command:</p>
2883 <pre>
2884 do &quot;__TOPDIR__/conf/ConfigWinDesktop.pl&quot;;</pre>
2885 <p>This alternative allows you to set other configuration options
2886 specific to each host after the ``do'' command (perhaps even
2887 overriding the settings in the included file).</p>
2888 <p>Note that you could also include snippets of configuration settings
2889 from the main configuration file. However, be aware that the
2890 modification-time checking that BackupPC does only applies to the
2891 main configuration file: if you change one of the included files,
2892 BackupPC won't notice. You will need to either touch the main
2893 configuration file too, or send BackupPC a HUP (-1) signal.</p>
2894 <p>
2895 <a href="#__index__"><small>Back to Top</small></a>
2896 </p>
2897 <hr />
2898 <h1><a name="configuration_parameters">Configuration Parameters</a></h1>
2899 <p>The configuration parameters are divided into five general groups.
2900 The first group (general server configuration) provides general
2901 configuration for BackupPC. The next two groups describe what to
2902 backup, when to do it, and how long to keep it. The fourth group
2903 are settings for email reminders, and the final group contains
2904 settings for the CGI interface.</p>
2905 <p>All configuration settings in the second through fifth groups can
2906 be overridden by the per-PC config.pl file.</p>
2907 <p>
2908 </p>
2909 <h2><a name="general_server_configuration">General server configuration</a></h2>
2910 <dl>
2911 <dt><strong><a name="item_%24conf%7bserverhost%7d">$Conf{ServerHost} = '';</a></strong><br />
2912 </dt>
2913 <dd>
2914 Host name on which the BackupPC server is running.
2915 </dd>
2916 <p></p>
2917 <dt><strong><a name="item_%24conf%7bserverport%7d">$Conf{ServerPort} = -1;</a></strong><br />
2918 </dt>
2919 <dd>
2920 TCP port number on which the BackupPC server listens for and accepts
2921 connections. Normally this should be disabled (set to -1). The TCP
2922 port is only needed if apache runs on a different machine from BackupPC.
2923 In that case, set this to any spare port number over 1024 (eg: 2359).
2924 If you enable the TCP port, make sure you set <a href="#item_%24conf%7bservermesgsecret%7d">$Conf{ServerMesgSecret}</A>
2925 too!
2926 </dd>
2927 <p></p>
2928 <dt><strong><a name="item_%24conf%7bservermesgsecret%7d">$Conf{ServerMesgSecret} = '';</a></strong><br />
2929 </dt>
2930 <dd>
2931 Shared secret to make the TCP port secure. Set this to a hard to guess
2932 string if you enable the TCP port (ie: <a href="#item_%24conf%7bserverport%7d">$Conf{ServerPort}</A> &gt; 0).
2933 </dd>
2934 <dd>
2935 <p>To avoid possible attacks via the TCP socket interface, every client
2936 message is protected by an MD5 digest. The MD5 digest includes four
2937 items:
2938 - a seed that is sent to the client when the connection opens
2939 - a sequence number that increments for each message
2940 - a shared secret that is stored in <a href="#item_%24conf%7bservermesgsecret%7d">$Conf{ServerMesgSecret}</A>
2941 - the message itself.</p>
2942 </dd>
2943 <dd>
2944 <p>The message is sent in plain text preceded by the MD5 digest. A
2945 snooper can see the plain-text seed sent by BackupPC and plain-text
2946 message from the client, but cannot construct a valid MD5 digest since
2947 the secret <a href="#item_%24conf%7bservermesgsecret%7d">$Conf{ServerMesgSecret}</A> is unknown. A replay attack is
2948 not possible since the seed changes on a per-connection and
2949 per-message basis.</p>
2950 </dd>
2951 <p></p>
2952 <dt><strong><a name="item_%24conf%7bmypath%7d">$Conf{MyPath} = '/bin';</a></strong><br />
2953 </dt>
2954 <dd>
2955 PATH setting for BackupPC. An explicit value is necessary
2956 for taint mode. Value shouldn't matter too much since
2957 all execs use explicit paths. However, taint mode in perl
2958 will complain if this directory is world writable.
2959 </dd>
2960 <p></p>
2961 <dt><strong><a name="item_%24conf%7bumaskmode%7d">$Conf{UmaskMode} = 027;</a></strong><br />
2962 </dt>
2963 <dd>
2964 Permission mask for directories and files created by BackupPC.
2965 Default value prevents any access from group other, and prevents
2966 group write.
2967 </dd>
2968 <p></p>
2969 <dt><strong><a name="item_%24conf%7bwakeupschedule%7d">$Conf{WakeupSchedule} = [1..23];</a></strong><br />
2970 </dt>
2971 <dd>
2972 Times at which we wake up, check all the PCs, and schedule necessary
2973 backups. Times are measured in hours since midnight. Can be
2974 fractional if necessary (eg: 4.25 means 4:15am).
2975 </dd>
2976 <dd>
2977 <p>If the hosts you are backing up are always connected to the network
2978 you might have only one or two wakeups each night. This will keep
2979 the backup activity after hours. On the other hand, if you are backing
2980 up laptops that are only intermittently connected to the network you
2981 will want to have frequent wakeups (eg: hourly) to maximized the chance
2982 that each laptop is backed up.</p>
2983 </dd>
2984 <dd>
2985 <p>Examples:</p>
2986 </dd>
2987 <dd>
2988 <pre>
2989 <a href="#item_%24conf%7bwakeupschedule%7d">$Conf{WakeupSchedule}</A> = [22.5]; # once per day at 10:30 pm.
2990 <a href="#item_%24conf%7bwakeupschedule%7d">$Conf{WakeupSchedule}</A> = [1..23]; # every hour except midnight
2991 <a href="#item_%24conf%7bwakeupschedule%7d">$Conf{WakeupSchedule}</A> = [2,4,6,8,10,12,14,16,18,20,22]; # every 2 hours</pre>
2992 </dd>
2993 <dd>
2994 <p>The default value is every hour except midnight.</p>
2995 </dd>
2996 <dd>
2997 <p>The first entry of <a href="#item_%24conf%7bwakeupschedule%7d">$Conf{WakeupSchedule}</A> is when BackupPC_nightly
2998 is run. No other backups can run while BackupPC_nightly is
2999 running. You might want to re-arrange the entries in
3000 <a href="#item_%24conf%7bwakeupschedule%7d">$Conf{WakeupSchedule}</A> (they don't have to be ascending) so that
3001 the first entry is when you want BackupPC_nightly to run
3002 (eg: when you don't expect a lot of regular backups to run).</p>
3003 </dd>
3004 <p></p>
3005 <dt><strong><a name="item_%24conf%7bmaxbackups%7d">$Conf{MaxBackups} = 4;</a></strong><br />
3006 </dt>
3007 <dd>
3008 Maximum number of simultaneous backups to run. If there
3009 are no user backup requests then this is the maximum number
3010 of simultaneous backups.
3011 </dd>
3012 <p></p>
3013 <dt><strong><a name="item_%24conf%7bmaxuserbackups%7d">$Conf{MaxUserBackups} = 4;</a></strong><br />
3014 </dt>
3015 <dd>
3016 Additional number of simultaneous backups that users can run.
3017 As many as <a href="#item_%24conf%7bmaxbackups%7d">$Conf{MaxBackups}</A> + <a href="#item_%24conf%7bmaxuserbackups%7d">$Conf{MaxUserBackups}</A> requests can
3018 run at the same time.
3019 </dd>
3020 <p></p>
3021 <dt><strong><a name="item_%24conf%7bmaxpendingcmds%7d">$Conf{MaxPendingCmds} = 10;</a></strong><br />
3022 </dt>
3023 <dd>
3024 Maximum number of pending link commands. New backups will only be
3025 started if there are no more than <a href="#item_%24conf%7bmaxpendingcmds%7d">$Conf{MaxPendingCmds}</A> plus
3026 <a href="#item_%24conf%7bmaxbackups%7d">$Conf{MaxBackups}</A> number of pending link commands, plus running jobs.
3027 This limit is to make sure BackupPC doesn't fall too far behind in
3028 running BackupPC_link commands.
3029 </dd>
3030 <p></p>
3031 <dt><strong><a name="item_%24conf%7bmaxbackuppcnightlyjobs%7d">$Conf{MaxBackupPCNightlyJobs} = 2;</a></strong><br />
3032 </dt>
3033 <dd>
3034 How many BackupPC_nightly processes to run in parallel.
3035 </dd>
3036 <dd>
3037 <p>Each night, at the first wakeup listed in <a href="#item_%24conf%7bwakeupschedule%7d">$Conf{WakeupSchedule}</A>,
3038 BackupPC_nightly is run. Its job is to remove unneeded files
3039 in the pool, ie: files that only have one link. To avoid race
3040 conditions, BackupPC_nightly runs only when there are no backups
3041 running, and no backups will start while it runs.</p>
3042 </dd>
3043 <dd>
3044 <p>So to reduce the elapsed time, you might want to increase this
3045 setting to run several BackupPC_nightly processes in parallel
3046 (eg: 4, or even 8).</p>
3047 </dd>
3048 <p></p>
3049 <dt><strong><a name="item_%24conf%7bbackuppcnightlyperiod%7d">$Conf{BackupPCNightlyPeriod} = 1;</a></strong><br />
3050 </dt>
3051 <dd>
3052 How many days (runs) it takes BackupPC_nightly to traverse the
3053 entire pool. Normally this is 1, which means every night it runs,
3054 it does traverse the entire pool removing unused pool files.
3055 </dd>
3056 <dd>
3057 <p>Other valid values are 2, 4, 8, 16. This causes BackupPC_nightly to
3058 traverse 1/2, 1/4, 1/8 or 1/16th of the pool each night, meaning it
3059 takes 2, 4, 8 or 16 days to completely traverse the pool. The
3060 advantage is that each night the running time of BackupPC_nightly
3061 is reduced roughly in proportion, since the total job is split
3062 over multiple days. The disadvantage is that unused pool files
3063 take longer to get deleted, which will slightly increase disk
3064 usage.</p>
3065 </dd>
3066 <dd>
3067 <p>Note that even when <a href="#item_%24conf%7bbackuppcnightlyperiod%7d">$Conf{BackupPCNightlyPeriod}</A> &gt; 1, BackupPC_nightly
3068 still runs every night. It just does less work each time it runs.</p>
3069 </dd>
3070 <dd>
3071 <p>Examples:</p>
3072 </dd>
3073 <dd>
3074 <pre>
3075 <a href="#item_%24conf%7bbackuppcnightlyperiod%7d">$Conf{BackupPCNightlyPeriod}</A> = 1; # entire pool is checked every night</pre>
3076 </dd>
3077 <dd>
3078 <pre>
3079 <a href="#item_%24conf%7bbackuppcnightlyperiod%7d">$Conf{BackupPCNightlyPeriod}</A> = 2; # two days to complete pool check
3080 # (different half each night)</pre>
3081 </dd>
3082 <dd>
3083 <pre>
3084 <a href="#item_%24conf%7bbackuppcnightlyperiod%7d">$Conf{BackupPCNightlyPeriod}</A> = 4; # four days to complete pool check
3085 # (different quarter each night)</pre>
3086 </dd>
3087 <p></p>
3088 <dt><strong><a name="item_%24conf%7bmaxoldlogfiles%7d">$Conf{MaxOldLogFiles} = 14;</a></strong><br />
3089 </dt>
3090 <dd>
3091 Maximum number of log files we keep around in log directory.
3092 These files are aged nightly. A setting of 14 means the log
3093 directory will contain about 2 weeks of old log files, in
3094 particular at most the files LOG, LOG.0, LOG.1, ... LOG.13
3095 (except today's LOG, these files will have a .z extension if
3096 compression is on).
3097 </dd>
3098 <dd>
3099 <p>If you decrease this number after BackupPC has been running for a
3100 while you will have to manually remove the older log files.</p>
3101 </dd>
3102 <p></p>
3103 <dt><strong><a name="item_%24conf%7bdfpath%7d">$Conf{DfPath} = '/bin/df';</a></strong><br />
3104 </dt>
3105 <dd>
3106 Full path to the df command. Security caution: normal users
3107 should not allowed to write to this file or directory.
3108 </dd>
3109 <p></p>
3110 <dt><strong><a name="item_%24conf%7bdfcmd%7d">$Conf{DfCmd} = '$dfPath $topDir';</a></strong><br />
3111 </dt>
3112 <dd>
3113 Command to run df. The following variables are substituted at run-time:
3114 </dd>
3115 <dd>
3116 <pre>
3117 $dfPath path to df (<a href="#item_%24conf%7bdfpath%7d">$Conf{DfPath}</A>)
3118 $topDir top-level BackupPC data directory</pre>
3119 </dd>
3120 <p></p>
3121 <dt><strong><a name="item_%24conf%7bdfmaxusagepct%7d">$Conf{DfMaxUsagePct} = 95;</a></strong><br />
3122 </dt>
3123 <dd>
3124 Maximum threshold for disk utilization on the __TOPDIR__ filesystem.
3125 If the output from <a href="#item_%24conf%7bdfpath%7d">$Conf{DfPath}</A> reports a percentage larger than
3126 this number then no new regularly scheduled backups will be run.
3127 However, user requested backups (which are usually incremental and
3128 tend to be small) are still performed, independent of disk usage.
3129 Also, currently running backups will not be terminated when the disk
3130 usage exceeds this number.
3131 </dd>
3132 <p></p>
3133 <dt><strong><a name="item_%24conf%7btrashcleansleepsec%7d">$Conf{TrashCleanSleepSec} = 300;</a></strong><br />
3134 </dt>
3135 <dd>
3136 How long BackupPC_trashClean sleeps in seconds between each check
3137 of the trash directory. Once every 5 minutes should be reasonable.
3138 </dd>
3139 <p></p>
3140 <dt><strong><a name="item_%24conf%7bdhcpaddressranges%7d">$Conf{DHCPAddressRanges} = [];</a></strong><br />
3141 </dt>
3142 <dd>
3143 List of DHCP address ranges we search looking for PCs to backup.
3144 This is an array of hashes for each class C address range.
3145 This is only needed if hosts in the conf/hosts file have the
3146 dhcp flag set.
3147 </dd>
3148 <dd>
3149 <p>Examples:</p>
3150 </dd>
3151 <dd>
3152 <pre>
3153 # to specify to as the DHCP address pool
3154 <a href="#item_%24conf%7bdhcpaddressranges%7d">$Conf{DHCPAddressRanges}</A> = [
3155 {
3156 ipAddrBase =&gt; '192.10.10',
3157 first =&gt; 20,
3158 last =&gt; 250,
3159 },
3160 ];
3161 # to specify two pools ( and
3162 <a href="#item_%24conf%7bdhcpaddressranges%7d">$Conf{DHCPAddressRanges}</A> = [
3163 {
3164 ipAddrBase =&gt; '192.10.10',
3165 first =&gt; 20,
3166 last =&gt; 250,
3167 },
3168 {
3169 ipAddrBase =&gt; '192.10.11',
3170 first =&gt; 10,
3171 last =&gt; 50,
3172 },
3173 ];</pre>
3174 </dd>
3175 <p></p>
3176 <dt><strong><a name="item_%24conf%7bbackuppcuser%7d">$Conf{BackupPCUser} = '';</a></strong><br />
3177 </dt>
3178 <dt><strong><a name="item_%24conf%7bcgidir%7d">$Conf{CgiDir} = '';</a></strong><br />
3179 </dt>
3180 <dt><strong><a name="item_%24conf%7binstalldir%7d">$Conf{InstallDir} = '';</a></strong><br />
3181 </dt>
3182 <dd>
3183 These configuration settings aren't used by BackupPC, but simply
3184 remember a few settings used by configure.pl during installation.
3185 These are used by configure.pl when upgrading to new versions of
3186 BackupPC.
3187 </dd>
3188 <p></p>
3189 <dt><strong><a name="item_%24conf%7bbackuppcuserverify%7d">$Conf{BackupPCUserVerify} = 1;</a></strong><br />
3190 </dt>
3191 <dd>
3192 Whether BackupPC and the CGI script BackupPC_Admin verify that they
3193 are really running as user <a href="#item_%24conf%7bbackuppcuser%7d">$Conf{BackupPCUser}</A>. If this flag is set
3194 and the effective user id (euid) differs from <a href="#item_%24conf%7bbackuppcuser%7d">$Conf{BackupPCUser}</A>
3195 then both scripts exit with an error. This catches cases where
3196 BackupPC might be accidently started as root or the wrong user,
3197 or if the CGI script is not installed correctly.
3198 </dd>
3199 <p></p>
3200 <dt><strong><a name="item_%24conf%7bhardlinkmax%7d">$Conf{HardLinkMax} = 31999;</a></strong><br />
3201 </dt>
3202 <dd>
3203 Maximum number of hardlinks supported by the $TopDir file system
3204 that BackupPC uses. Most linux or unix file systems should support
3205 at least 32000 hardlinks per file, or 64000 in other cases. If a pool
3206 file already has this number of hardlinks, a new pool file is created
3207 so that new hardlinks can be accommodated. This limit will only
3208 be hit if an identical file appears at least this number of times
3209 across all the backups.
3210 </dd>
3211 <p></p></dl>
3212 <p>
3213 </p>
3214 <h2><a name="what_to_backup_and_when_to_do_it">What to backup and when to do it</a></h2>
3215 <dl>
3216 <dt><strong><a name="item_%24conf%7bsmbsharename%7d">$Conf{SmbShareName} = 'C$';</a></strong><br />
3217 </dt>
3218 <dd>
3219 Name of the host share that is backed up when using SMB. This can be a
3220 string or an array of strings if there are multiple shares per host.
3221 Examples:
3222 </dd>
3223 <dd>
3224 <pre>
3225 <a href="#item_%24conf%7bsmbsharename%7d">$Conf{SmbShareName}</A> = 'c'; # backup 'c' share
3226 <a href="#item_%24conf%7bsmbsharename%7d">$Conf{SmbShareName}</A> = ['c', 'd']; # backup 'c' and 'd' shares</pre>
3227 </dd>
3228 <dd>
3229 <p>This setting only matters if <a href="#item_%24conf%7bxfermethod%7d">$Conf{XferMethod}</A> = 'smb'.</p>
3230 </dd>
3231 <p></p>
3232 <dt><strong><a name="item_%24conf%7bsmbshareusername%7d">$Conf{SmbShareUserName} = '';</a></strong><br />
3233 </dt>
3234 <dd>
3235 Smbclient share user name. This is passed to smbclient's -U argument.
3236 </dd>
3237 <dd>
3238 <p>This setting only matters if <a href="#item_%24conf%7bxfermethod%7d">$Conf{XferMethod}</A> = 'smb'.</p>
3239 </dd>
3240 <p></p>
3241 <dt><strong><a name="item_%24conf%7bsmbsharepasswd%7d">$Conf{SmbSharePasswd} = '';</a></strong><br />
3242 </dt>
3243 <dd>
3244 Smbclient share password. This is passed to smbclient via its PASSWD
3245 environment variable. There are several ways you can tell BackupPC
3246 the smb share password. In each case you should be very careful about
3247 security. If you put the password here, make sure that this file is
3248 not readable by regular users! See the ``Setting up config.pl'' section
3249 in the documentation for more information.
3250 </dd>
3251 <dd>
3252 <p>This setting only matters if <a href="#item_%24conf%7bxfermethod%7d">$Conf{XferMethod}</A> = 'smb'.</p>
3253 </dd>
3254 <p></p>
3255 <dt><strong><a name="item_%24conf%7btarsharename%7d">$Conf{TarShareName} = '/';</a></strong><br />
3256 </dt>
3257 <dd>
3258 Which host directories to backup when using tar transport. This can be a
3259 string or an array of strings if there are multiple directories to
3260 backup per host. Examples:
3261 </dd>
3262 <dd>
3263 <pre>
3264 <a href="#item_%24conf%7btarsharename%7d">$Conf{TarShareName}</A> = '/'; # backup everything
3265 <a href="#item_%24conf%7btarsharename%7d">$Conf{TarShareName}</A> = '/home'; # only backup /home
3266 <a href="#item_%24conf%7btarsharename%7d">$Conf{TarShareName}</A> = ['/home', '/src']; # backup /home and /src</pre>
3267 </dd>
3268 <dd>
3269 <p>The fact this parameter is called 'TarShareName' is for historical
3270 consistency with the Smb transport options. You can use any valid
3271 directory on the client: there is no need for it to correspond to
3272 any Smb share or device mount point.</p>
3273 </dd>
3274 <dd>
3275 <p>Note also that you can also use <a href="#item_%24conf%7bbackupfilesonly%7d">$Conf{BackupFilesOnly}</A> to specify
3276 a specific list of directories to backup. It's more efficient to
3277 use this option instead of <a href="#item_%24conf%7btarsharename%7d">$Conf{TarShareName}</A> since a new tar is
3278 run for each entry in <a href="#item_%24conf%7btarsharename%7d">$Conf{TarShareName}</A>.</p>
3279 </dd>
3280 <dd>
3281 <p>On the other hand, if you add --one-file-system to <a href="#item_%24conf%7btarclientcmd%7d">$Conf{TarClientCmd}</A>
3282 you can backup each file system separately, which makes restoring one
3283 bad file system easier. In this case you would list all of the mount
3284 points here, since you can't get the same result with
3285 <a href="#item_%24conf%7bbackupfilesonly%7d">$Conf{BackupFilesOnly}</A>:</p>
3286 </dd>
3287 <dd>
3288 <pre>
3289 <a href="#item_%24conf%7btarsharename%7d">$Conf{TarShareName}</A> = ['/', '/var', '/data', '/boot'];</pre>
3290 </dd>
3291 <dd>
3292 <p>This setting only matters if <a href="#item_%24conf%7bxfermethod%7d">$Conf{XferMethod}</A> = 'tar'.</p>
3293 </dd>
3294 <p></p>
3295 <dt><strong><a name="item_%24conf%7bfullperiod%7d">$Conf{FullPeriod} = 6.97;</a></strong><br />
3296 </dt>
3297 <dd>
3298 Minimum period in days between full backups. A full dump will only be
3299 done if at least this much time has elapsed since the last full dump,
3300 and at least <a href="#item_%24conf%7bincrperiod%7d">$Conf{IncrPeriod}</A> days has elapsed since the last
3301 successful dump.
3302 </dd>
3303 <dd>
3304 <p>Typically this is set slightly less than an integer number of days. The
3305 time taken for the backup, plus the granularity of <a href="#item_%24conf%7bwakeupschedule%7d">$Conf{WakeupSchedule}</A>
3306 will make the actual backup interval a bit longer.</p>
3307 </dd>
3308 <dd>
3309 <p>There are two special values for <a href="#item_%24conf%7bfullperiod%7d">$Conf{FullPeriod}</A>:</p>
3310 </dd>
3311 <dd>
3312 <pre>
3313 -1 Don't do any regular backups on this machine. Manually
3314 requested backups (via the CGI interface) will still occur.</pre>
3315 </dd>
3316 <dd>
3317 <pre>
3318 -2 Don't do any backups on this machine. Manually requested
3319 backups (via the CGI interface) will be ignored.</pre>
3320 </dd>
3321 <dd>
3322 <p>These special settings are useful for a client that is no longer
3323 being backed up (eg: a retired machine), but you wish to keep the
3324 last backups available for browsing or restoring to other machines.</p>
3325 </dd>
3326 <p></p>
3327 <dt><strong><a name="item_%24conf%7bincrperiod%7d">$Conf{IncrPeriod} = 0.97;</a></strong><br />
3328 </dt>
3329 <dd>
3330 Minimum period in days between incremental backups (a user requested
3331 incremental backup will be done anytime on demand).
3332 </dd>
3333 <dd>
3334 <p>Typically this is set slightly less than an integer number of days. The
3335 time taken for the backup, plus the granularity of <a href="#item_%24conf%7bwakeupschedule%7d">$Conf{WakeupSchedule}</A>
3336 will make the actual backup interval a bit longer.</p>
3337 </dd>
3338 <p></p>
3339 <dt><strong><a name="item_%24conf%7bfullkeepcnt%7d">$Conf{FullKeepCnt} = 1;</a></strong><br />
3340 </dt>
3341 <dd>
3342 Number of full backups to keep. Must be &gt;= 1.
3343 </dd>
3344 <dd>
3345 <p>In the steady state, each time a full backup completes successfully
3346 the oldest one is removed. If this number is decreased, the
3347 extra old backups will be removed.</p>
3348 </dd>
3349 <dd>
3350 <p>If filling of incremental dumps is off the oldest backup always
3351 has to be a full (ie: filled) dump. This might mean one or two
3352 extra full dumps are kept until the oldest incremental backups expire.</p>
3353 </dd>
3354 <dd>
3355 <p>Exponential backup expiry is also supported. This allows you to specify:</p>
3356 </dd>
3357 <dd>
3358 <pre>
3359 - num fulls to keep at intervals of 1 * <a href="#item_%24conf%7bfullperiod%7d">$Conf{FullPeriod}</A>, followed by
3360 - num fulls to keep at intervals of 2 * <a href="#item_%24conf%7bfullperiod%7d">$Conf{FullPeriod}</A>,
3361 - num fulls to keep at intervals of 4 * <a href="#item_%24conf%7bfullperiod%7d">$Conf{FullPeriod}</A>,
3362 - num fulls to keep at intervals of 8 * <a href="#item_%24conf%7bfullperiod%7d">$Conf{FullPeriod}</A>,
3363 - num fulls to keep at intervals of 16 * <a href="#item_%24conf%7bfullperiod%7d">$Conf{FullPeriod}</A>,</pre>
3364 </dd>
3365 <dd>
3366 <p>and so on. This works by deleting every other full as each expiry
3367 boundary is crossed.</p>