- allow PingCmd and Nmb commands to be empty strings, allowing these
[BackupPC.git] / doc-src / BackupPC.pod
1 =head1 BackupPC Introduction
2
3 This documentation describes BackupPC version __VERSION__,
4 released on __RELEASEDATE__.
5
6 =head2 Overview
7
8 BackupPC is a high-performance, enterprise-grade system for backing up
9 Linux and WinXX PCs, desktops and laptops to a server's disk.  BackupPC
10 is highly configurable and easy to install and maintain.
11
12 Given the ever decreasing cost of disks and raid systems, it is now
13 practical and cost effective to backup a large number of machines onto a
14 server's local disk or network storage.  For some sites this might be
15 the complete backup solution.  For other sites additional permanent
16 archives could be created by periodically backing up the server to tape.
17
18 Features include:
19
20 =over 4
21
22 =item *
23
24 A clever pooling scheme minimizes disk storage and disk I/O.
25 Identical files across multiple backups of the same or different PC
26 are stored only once (using hard links), resulting in substantial
27 savings in disk storage and disk writes.
28
29 =item *
30
31 Optional compression provides additional reductions in storage
32 (around 40%).  The CPU impact of compression is low since only
33 new files (those not already in the pool) need to be compressed.
34
35 =item *
36
37 A powerful http/cgi user interface allows administrators to view log
38 files, configuration, current status and allows users to initiate and
39 cancel backups and browse and restore files from backups.
40
41 =item *
42
43 No client-side software is needed. On WinXX the standard smb
44 protocol is used to extract backup data. On linux or unix clients,
45 rsync or tar (over ssh/rsh/nfs) is used to extract backup data.
46 Alternatively, rsync can also be used on WinXX (using cygwin),
47 and Samba could be installed on the linux or unix client to
48 provide smb shares).
49
50 =item *
51
52 Flexible restore options.  Single files can be downloaded from
53 any backup directly from the CGI interface.  Zip or Tar archives
54 for selected files or directories from any backup can also be
55 downloaded from the CGI interface.  Finally, direct restore to
56 the client machine (using smb or tar) for selected files or
57 directories is also supported from the CGI interface.
58
59 =item *
60
61 BackupPC supports mobile environments where laptops are only
62 intermittently connected to the network and have dynamic IP addresses
63 (DHCP).  Configuration settings allow machines connected via slower WAN
64 connections (eg: dial up, DSL, cable) to not be backed up, even if they
65 use the same fixed or dynamic IP address as when they are connected
66 directly to the LAN.
67
68 =item *
69
70 Flexible configuration parameters allow multiple backups to be performed
71 in parallel, specification of which shares to backup, which directories
72 to backup or not backup, various schedules for full and incremental
73 backups, schedules for email reminders to users and so on.  Configuration
74 parameters can be set system-wide or also on a per-PC basis.
75
76 =item *
77
78 Users are sent periodic email reminders if their PC has not
79 recently been backed up.  Email content, timing and policies
80 are configurable.
81
82 =item *
83
84 BackupPC is Open Source software hosted by SourceForge.
85
86 =back
87
88 =head2 Backup basics
89
90 =over 4
91
92 =item Full Backup
93
94 A full backup is a complete backup of a share. BackupPC can be configured to
95 do a full backup at a regular interval (often weekly). BackupPC can also
96 be configured to keep a certain number of full backups, and to keep
97 a smaller number of very old full backups.
98
99 =item Incremental Backup
100
101 An incremental backup is a backup of files that have changed (based on their
102 modification time) since the last successful full backup.  For SMB and
103 tar, BackupPC backups all files that have changed since one hour prior to the
104 start of the last successful full backup.  Rsync is more clever: any files
105 who attributes have changed (ie: uid, gid, mtime, modes, size) since the
106 last full are backed up.  Deleted and new files are also detected by
107 Rsync incrementals (SMB and tar are not able to detect deleted files or
108 new files whose modification time is prior to the last full dump.
109
110 BackupPC can also be configured to keep a certain number of incremental
111 backups, and to keep a smaller number of very old incremental backups.
112 (BackupPC does not support multi-level incremental backups, although it
113 would be easy to do so.)
114
115 BackupPC's CGI interface "fills-in" incremental backups based on the 
116 last full backup, giving every backup a "full" appearance.  This makes
117 browsing and restoring backups easier.
118
119 =item Identical Files
120
121 BackupPC pools identical files using hardlinks.  By "identical
122 files" we mean files with identical contents, not necessary the
123 same permissions, ownership or modification time.  Two files might
124 have different permissions, ownership, or modification time but
125 will still be pooled whenever the contents are identical.  This
126 is possible since BackupPC stores the file meta-data (permissions,
127 ownership, and modification time) separately from the file contents.
128
129 =item Backup Policy
130
131 Based on your site's requirements you need to decide what your backup
132 policy is.  BackupPC is not designed to provide exact re-imaging of
133 failed disks.  See L<Limitations|limitations> for more information.
134 However, the addition of tar transport for linux/unix clients, plus
135 full support for special file types and unix attributes in v1.4.0
136 likely means an exact image of a linux/unix file system can be made.
137
138 BackupPC saves backups onto disk. Because of pooling you can relatively
139 economically keep several weeks of old backups. But BackupPC does not
140 provide permanent storage to tape. Other Open Source applications can do
141 this by backing up BackupPC's pool directories to tape.
142
143 At some sites the disk-based backup will be adequate, without a
144 secondary tape backup. This system is robust to any single failure: if a
145 client disk fails or loses files, the BackupPC server can be used to
146 restore files. If the server disk fails, BackupPC can be restarted on a
147 fresh file system, and create new backups from the clients. The chance
148 of the server disk failing can be made very small by spending more money
149 on increasingly better RAID systems.
150
151 At other sites a secondary tape backup will be required. This tape
152 backup can be done perhaps weekly from the BackupPC pool file system.
153
154 =back
155
156 =head2 Resources
157
158 =over 4
159
160 =item BackupPC home page
161
162 The BackupPC Open Source project is hosted on SourceForge.  The
163 home page can be found at:
164
165     http://backuppc.sourceforge.net
166
167 This page has links to the current documentation, the SourceForge
168 project page and general information.
169
170 =item SourceForge project
171
172 The SourceForge project page is at:
173
174     http://sourceforge.net/projects/backuppc
175
176 This page has links to the current releases of BackupPC.
177
178 =item Mail lists
179
180 Three BackupPC mailing lists exist for announcements (backuppc-announce),
181 developers (backuppc-devel), and a general user list for support, asking
182 questions or any other topic relevant to BackupPC (backuppc-users).
183
184 You can subscribe to these lists by visiting:
185
186     http://lists.sourceforge.net/lists/listinfo/backuppc-announce
187     http://lists.sourceforge.net/lists/listinfo/backuppc-users
188     http://lists.sourceforge.net/lists/listinfo/backuppc-devel
189
190 The backuppc-announce list is moderated and is used only for
191 important announcements (eg: new versions).  It is low traffic.
192 You only need to subscribe to one of backuppc-announce and
193 backuppc-users: backuppc-users also receives any messages on
194 backuppc-announce.
195
196 The backuppc-devel list is only for developers who are working on BackupPC.
197 Do not post questions or support requests there.  But detailed technical
198 discussions should happen on this list.
199
200 To post a message to the backuppc-users list, send an email to
201
202     backuppc-users@lists.sourceforge.net
203
204 Do not send subscription requests to this address!
205
206 =item Other Programs of Interest
207
208 If you want to mirror linux or unix files or directories to a remote server
209 you should consider rsync, L<http://rsync.samba.org>.  BackupPC now uses
210 rsync as a transport mechanism; if you are already an rsync user you
211 can think of BackupPC as adding efficient storage (compression and
212 pooling) and a convenient user interface to rsync.
213
214 Unison is a utility that can do two-way, interactive, synchronization.
215 See L<http://www.cis.upenn.edu/~bcpierce/unison>.
216
217 Three popular open source packages that do tape backup are
218 Amanda (L<http://www.amanda.org>),
219 afbackup (L<http://sourceforge.net/projects/afbackup>), and
220 Bacula (L<http://www.bacula.org>).
221 Amanda can also backup WinXX machines to tape using samba.
222 These packages can be used as back ends to BackupPC to backup the
223 BackupPC server data to tape.
224
225 Various programs and scripts use rsync to provide hardlinked backups.
226 See, for example, Mike Rubel's site (L<http://www.mikerubel.org>),
227 J. W. Schultz's dirvish (L<http://www.pegasys.ws/dirvish>),
228 and John Bowman's rlbackup (L<http://www.math.ualberta.ca/imaging/rlbackup>).
229 BackupPC provides many additional features, such as compressed storage,
230 hardlinking any matching files (rather than just files with the same name),
231 and storing special files without root priviliges.  But these other scripts
232 provide simple and effective solutions and are worthy of consideration.
233
234 =back
235
236 =head2 Road map
237
238 Here are some ideas for new features that might appear in future
239 releases of BackupPC:
240
241 =over 4
242
243 =item *
244
245 Adding hardlink support to rsync.
246
247 =item *
248
249 Adding block and file checksum caching to rsync.  This will significantly
250 increase performance since the server doesn't have to read each file
251 twice to compute the block and file checksums.
252
253 =item *
254
255 Adding a trip wire feature for notification when files below certain
256 directories change.  For example, if you are backing up a DMZ machine,
257 you could request that you get sent email if any files below /bin,
258 /sbin or /usr change.
259
260 =item *
261
262 Allow editing of config parameters via the CGI interface. Users should
263 have permission to edit a subset of the parameters for their clients.
264 Additionally, allow an optional self-service capability so that users
265 can sign up and setup their own clients with no need for IT support.
266
267 =item *
268
269 Add backend SQL support for various BackupPC metadata, including
270 configuration parameters, client lists, and backup and restore
271 information.  At installation time the backend data engine will
272 be specified (eg: MySQL, ascii text etc).
273
274 =item *
275
276 Disconnect the notion of a physical host and a backup client.
277 Currently there is a one-to-one match between physical hosts
278 and backup clients.  Instead, the current notion of a host
279 should be replaced by a backup client.  Each backup client
280 corresponds to a physical host.  A physical host could have
281 several backup clients.  This is useful for backing up
282 different types of data, or backing up different portions
283 of a machine with different frequencies or settings.
284
285 =item *
286
287 Resuming incomplete full backups.  Useful if a machine
288 (eg: laptop) is disconnected from the network during a backup,
289 or if the user manually stops a backup.  This would be supported
290 initially for rsync.  The partial dump would be kept, and be
291 browsable.  When the next dump starts, an incremental against
292 the partial dump would be done to make sure it was up to date,
293 and then the rest of the full dump would be done.
294
295 =item *
296
297 Replacing smbclient with the perl module FileSys::SmbClient.  This
298 gives much more direct control of the smb transfer, allowing
299 incrementals to depend on any attribute change (eg: exist, mtime,
300 file size, uid, gid), and better support for include and exclude.
301 Currently smbclient incrementals only depend upon mtime, so
302 deleted files or renamed files are not detected.  FileSys::SmbClient
303 would also allow resuming of incomplete full backups in the
304 same manner as rsync will.
305
306 =item *
307
308 Support --listed-incremental or --incremental for tar,
309 so that incrementals will depend upon any attribute change (eg: exist,
310 mtime, file size, uid, gid), rather than just mtime.  This will allow
311 tar to be to as capable as FileSys::SmbClient and rsync.
312
313 =item *
314
315 For rysnc (and smb when FileSys::SmbClient is supported, and tar when
316 --listed-incremental is supported) support multi-level incrementals.
317 In fact, since incrementals will now be more "accurate", you could
318 choose to never to full dumps (except the first time), or at a
319 minimum do them infrequently: each incremental would depend upon
320 the last, giving a continuous chain of differential dumps.
321
322 =item *
323
324 Add a backup browsing feature that shows backup history by file.
325 So rather than a single directory view, it would be a table showing
326 the files (down) and the backups (across).  The internal hardlinks
327 encode which files are identical across backups.  You could immediately
328 see which files changed on which backups.
329
330 =item *
331
332 More speculative: Storing binary file deltas (in fact, reverse deltas)
333 for files that have the same name as a previous backup, but that aren't
334 already in the pool. This will save storage for things like mailbox
335 files or documents that change slightly between backups.  Running some
336 benchmarks on a large pool suggests that the potential savings are
337 around 15-20%, which isn't spectacular, and likely not worth the
338 implementation effort. The program xdelta (v1) on SourceForge (see
339 L<http://sourceforge.net/projects/xdelta>) uses an rsync algorithm for
340 doing efficient binary file deltas.  Rather than using an external
341 program, File::RsyncP will eventually get the necessary delta
342 generataion code from rsync.
343
344 =back
345
346 Comments and suggestions are welcome.
347
348 =head2 You can help
349
350 BackupPC is free. I work on BackupPC because I enjoy doing it and I like
351 to contribute to the open source community.
352
353 BackupPC already has more than enough features for my own needs.  The
354 main compensation for continuing to work on BackupPC is knowing that
355 more and more people find it useful.  So feedback is certainly
356 appreciated.  Even negative feedback is helpful, for example "We
357 evaluated BackupPC but didn't use it because it doesn't ...".
358
359 Beyond being a satisfied user and telling other people about it, everyone
360 is encouraged to add links to L<http://backuppc.sourceforge.net> (I'll
361 see then via Google) or otherwise publicize BackupPC.  Unlike the
362 commercial products in this space, I have a zero budget (in both
363 time and money) for marketing, PR and advertising, so it's up to
364 all of you!
365
366 Also, everyone is encouraged to contribute patches, bug reports, feature
367 and design suggestions, code, and documentation corrections or
368 improvements.
369
370 =head1 Installing BackupPC
371
372 =head2 Requirements
373
374 BackupPC requires:
375
376 =over 4
377
378 =item *
379
380 A linux, solaris, or unix based server with a substantial amount of free
381 disk space (see the next section for what that means). The CPU and disk
382 performance on this server will determine how many simultaneous backups
383 you can run. You should be able to run 4-8 simultaneous backups on a
384 moderately configured server.
385
386 When BackupPC starts with an empty pool, all the backup data will be
387 written to the pool on disk. After more backups are done, a higher
388 percentage of incoming files will already be in the pool. BackupPC is
389 able to avoid writing to disk new files that are already in the pool.
390 So over time disk writes will reduce significantly (by perhaps a factor
391 of 20 or more), since eventually 95% or more of incoming backup files
392 are typically in the pool. Disk reads from the pool are still needed to
393 do file compares to verify files are an exact match. So, with a mature
394 pool, if a relatively fast client generates data at say 1MB/sec, and you
395 run 4 simultaneous backups, there will be an average server disk load of
396 about 4MB/sec reads and 0.2MB/sec writes (assuming 95% of the incoming
397 files are in the pool). These rates will be perhaps 40% lower if
398 compression is on.
399
400 =item *
401
402 Perl version 5.6.0 or later. BackupPC has been tested with
403 version 5.6.0 and 5.6.1. If you don't have perl, please see
404 L<http://www.cpan.org>.
405
406 =item *
407
408 Perl modules Compress::Zlib, Archive::Zip and Rsync.  Try "perldoc
409 Compress::Zlib" and "perldoc Archive::Zip" to see if you have these
410 modules.  If not, fetch them from L<http://www.cpan.org> and see the
411 instructions below for how to build and install them.
412
413 The Rsync module is available from L<http://backuppc.sourceforge.net>.
414 You'll need to install the Rsync module if you want to use Rsync as
415 a transport method.
416
417 =item *
418
419 If you are using smb to backup WinXX machines you need smbclient and
420 nmblookup from the samba package.  You will also need nmblookup if
421 you are backing up linux/unix DHCP machines.  See L<http://www.samba.org>.
422 Version >= 2.2.0 of Samba is required (smbclient's tar feature in
423 2.0.8 and prior has bugs for file path lengths around 100 characters
424 and generates bad output when file lengths change during the backup).
425
426 See L<http://www.samba.org> for source and binaries.  It's pretty easy to
427 fetch and compile samba, and just grab smbclient and nmblookup, without
428 doing the installation. Alternatively, L<http://www.samba.org> has binary
429 distributions for most platforms.
430
431 =item *
432
433 If you are using tar to backup linux/unix machines you should have version
434 1.13.7 at a minimum, with version 1.13.20 or higher recommended.  Use
435 "tar --version" to check your version.  Various GNU mirrors have the newest
436 versions of tar, see for example L<http://www.funet.fi/pub/gnu/alpha/gnu/tar>.
437 As of July 2002 the latest versons is 1.13.25.
438
439 =item *
440
441 If you are using rsync to backup linux/unix machines you should have
442 version 2.5.5 on each client machine.  See L<http://rsync.samba.org>.
443 Use "rsync --version" to check your version.
444
445 For BackupPC to use Rsync you will also need to install the perl
446 File::RsyncP module, which is available from
447 L<http://perlrsync.sourceforge.net>.
448 Version 0.20 is required.
449
450 =item *
451
452 The Apache web server, see L<http://www.apache.org>, preferably built
453 with mod_perl support.
454
455 =back
456
457 =head2 How much disk space do I need?
458
459 Here's one real example for an environment that is backing up 65 laptops
460 with compression off. Each full backup averages 3.2GB. Each incremental
461 backup averages about 0.2GB. Storing one full backup and two incremental
462 backups per laptop is around 240GB of raw data. But because of the
463 pooling of identical files, only 87GB is used.  This is without
464 compression.
465
466 Another example, with compression on: backing up 95 laptops, where
467 each backup averages 3.6GB and each incremental averages about 0.3GB.
468 Keeping three weekly full backups, and six incrementals is around
469 1200GB of raw data.  Because of pooling and compression, only 150GB
470 is needed.
471
472 Here's a rule of thumb. Add up the C drive usage of all the machines you
473 want to backup (210GB in the first example above). This is a rough
474 minimum space estimate that should allow a couple of full backups and at
475 least half a dozen incremental backups per machine. If compression is on
476 you can reduce the storage requirements by maybe 30-40%.  Add some margin
477 in case you add more machines or decide to keep more old backups.
478
479 Your actual mileage will depend upon the types of clients, operating
480 systems and applications you have. The more uniform the clients and
481 applications the bigger the benefit from pooling common files.
482
483 For example, the Eudora email tool stores each mail folder in a separate
484 file, and attachments are extracted as separate files. So in the sadly
485 common case of a large attachment emailed to many recipients, Eudora
486 will extract the attachment into a new file. When these machines are
487 backed up, only one copy of the file will be stored on the server, even
488 though the file appears in many different full or incremental backups. In
489 this sense Eudora is a "friendly" application from the point of view of
490 backup storage requirements.
491
492 An example at the other end of the spectrum is Outlook. Everything
493 (email bodies, attachments, calendar, contact lists) is stored in a
494 single file, which often becomes huge. Any change to this file requires
495 a separate copy of the file to be saved during backup. Outlook is even
496 more troublesome, since it keeps this file locked all the time, so it
497 cannot be read by smbclient whenever Outlook is running.  See the
498 L<Limitations|limitations> section for more discussion of this problem.
499
500 =head2 Step 1: Getting BackupPC
501
502 Download the latest version from L<http://backuppc.sourceforge.net>.
503
504 =head2 Step 2: Installing the distribution
505
506 First off, there are three perl modules you should install.
507 These are all optional, but highly recommended:
508
509 =over 4
510
511 =item Compress::Zlib
512
513 To enable compression, you will need to install Compress::Zlib
514 from L<http://www.cpan.org>.
515 You can run "perldoc Compress::Zlib" to see if this module is installed.
516
517 =item Archive::Zip
518
519 To support restore via Zip archives you will need to install
520 Archive::Zip, also from L<http://www.cpan.org>.
521 You can run "perldoc Archive::Zip" to see if this module is installed.
522
523 =item File::RsyncP
524
525 To use rsync and rsyncd with BackupPC you will need to install File::RsyncP.
526 You can run "perldoc File::RsyncP" to see if this module is installed.
527 File::RsyncP is available from L<http://perlrsync.sourceforge.net>.
528 Version 0.20 is required.
529
530 =back
531
532 To build and install these packages, fetch the tar.gz file and
533 then run these commands:
534
535     tar zxvf Archive-Zip-1.01.tar.gz
536     cd Archive-Zip-1.01
537     perl Makefile.PL
538     make
539     make test
540     make install
541
542 The same sequence of commands can be used for each module.
543
544 Now let's move onto BackupPC itself.  After fetching
545 BackupPC-__VERSION__.tar.gz, run these commands as root:
546
547     tar zxf BackupPC-__VERSION__.tar.gz
548     cd BackupPC-__VERSION__
549     perl configure.pl
550
551 You will be prompted for the full paths of various executables, and
552 you will be prompted for the following information:
553
554 =over 4
555
556 =item BackupPC User
557
558 It is best if BackupPC runs as a special user, eg backuppc, that has
559 limited privileges. It is preferred that backuppc belongs to a system
560 administrator group so that sys admin members can browse backuppc files,
561 edit the configuration files and so on. Although configurable, the
562 default settings leave group read permission on pool files, so make
563 sure the BackupPC user's group is chosen restrictively.
564
565 On this installation, this is __BACKUPPCUSER__.
566
567 =item Data Directory
568
569 You need to decide where to put the data directory, below which
570 all the BackupPC data is stored.  This needs to be a big file system.
571
572 On this installation, this is __TOPDIR__.
573
574 =item Install Directory
575
576 You should decide where the BackupPC scripts, libraries and documentation
577 should be installed, eg: /opt/local/BackupPC.
578
579 On this installation, this is __INSTALLDIR__.
580
581 =item CGI bin Directory
582
583 You should decide where the BackupPC CGI script resides.  This will
584 usually below Apache's cgi-bin directory.
585
586 On this installation, this is __CGIDIR__.
587
588 =item Apache image directory
589
590 A directory where BackupPC's images are stored so that Apache can
591 serve them.  This should be somewhere under Apache's DocumentRoot
592 directory.
593
594 =back
595
596 =head2 Step 3: Setting up config.pl
597
598 After running configure.pl, browse through the config file,
599 __INSTALLDIR__/conf/config.pl, and make sure all the default settings
600 are correct. In particular, you will need to decide whether to use
601 smb or tar transport (or whether to set it on a per-PC basis),
602 set the smb share password (if using smb), set the backup policies
603 and modify the email message headers and bodies.
604
605 BackupPC needs to know the smb share user name and password for each PC
606 that uses smb (ie: all the WinXX clients).  The user name is specified
607 in $Conf{SmbShareUserName}. There are four ways to tell BackupPC the smb
608 share password:
609
610 =over 4
611
612 =item *
613
614 As an environment variable BPC_SMB_PASSWD set before BackupPC starts.
615 If you start BackupPC manually the BPC_SMB_PASSWD variable must be set
616 manually first.  For backward compatability for v1.5.0 and prior, the
617 environment variable PASSWD can be used if BPC_SMB_PASSWD is not set.
618 Warning: on some systems it is possible to see environment variables of
619 running processes.
620
621 =item *
622
623 Alternatively the BPC_SMB_PASSWD setting can be included in
624 /etc/init.d/backuppc, in which case you must make sure this file
625 is not world (other) readable.
626
627 =item *
628
629 As a configuration variable $Conf{SmbSharePasswd} in
630 __TOPDIR__/conf/config.pl.  If you put the password
631 here you must make sure this file is not world (other) readable.
632
633 =item *
634
635 As a configuration variable $Conf{SmbSharePasswd} in the per-PC
636 configuration file, __TOPDIR__/pc/$host/config.pl. You will have to
637 use this option if the smb share password is different for each host.
638 If you put the password here you must make sure this file is not
639 world (other) readable.
640
641 =back
642
643 Placement and protection of the smb share password is a possible
644 security risk, so please double-check the file and directory
645 permissions.  In a future version there might be support for
646 encryption of this password, but a private key will still have to
647 be stored in a protected place.  Suggestions are welcome.
648
649 =head2 Step 4: Setting up the hosts file
650
651 The file __TOPDIR__/conf/hosts contains the list of clients to backup.
652 BackupPC reads this file in three cases:
653
654 =over 4
655
656 =item *
657
658 Upon startup.
659
660 =item *
661
662 When BackupPC is sent a HUP (-1) signal.  Assuming you installed the
663 init.d script, you can also do this with "/etc/init.d/backuppc reload".
664
665 =item *
666
667 When the modification time of the hosts file changes.  BackupPC
668 checks the modification time once during each regular wakeup.
669
670 =back
671
672 Whenever you change the hosts file (to add or remove a host) you can
673 either do a kill -HUP BackupPC_pid or simply wait until the next regular
674 wakeup period.
675
676 Each line in the hosts file contains three fields, separated
677 by white space:
678
679 =over 4
680
681 =item Host name
682
683 If this host is a static IP address this must the machine's IP host name
684 (ie: something that can be looked up using nslookup or DNS). If this is
685 a host with a dynamic IP address (ie: DHCP flag is 1) then the host
686 name must be the netbios name of the machine.  The host name should
687 be in lower case.
688
689 =item DHCP flag
690
691 Set to 0 if this host has a static IP address (meaning it can be looked
692 up by name in the DNS).  If the host's IP address is dynamic (eg, it is
693 assigned by DHCP) then set this flag to 1.
694
695 The hosts with dhcp = 1 are backed up as follows.  If you have
696 configured a DHCP address pool ($Conf{DHCPAddressRanges}) then
697 BackupPC will check the NetBIOS name of each machine in the
698 range.  Any hosts that have a valid NetBIOS name (ie: matching
699 an entry in the hosts file) will be backed up.
700
701 =item User name
702
703 This should be the unix login/email name of the user who "owns" or uses
704 this machine. This is the user who will be sent email about this
705 machine, and this user will have permission to stop/start/browse/restore
706 backups for this host.  Leave this blank if no specific person should
707 receive email or be allowed to stop/start/browse/restore backups
708 for this host.  Administrators will still have full permissions.
709
710 =back
711
712 The first non-comment line of the hosts file is special: it contains
713 the names of the columns and should not be edited.
714
715 Here's a simple example of a hosts file:
716
717     host        dhcp    user
718     farside     0       craig
719     larson      1       gary
720
721 The range of DHCP addresses to search is specified in
722 $Conf{DHCPAddressRanges}.
723
724 =head2 Step 5: Client Setup
725
726 Two methods for getting backup data from a client are
727 supported: smb and tar. Smb is the preferred method for WinXX clients
728 and tar is preferred method for linux/unix clients.
729
730 The transfer method is set using the $Conf{XferMethod} configuration
731 setting. If you have a mixed environment (ie: you will use smb for some
732 clients and tar for others), you will need to pick the most common
733 choice for $Conf{XferMethod} for the main config.pl file, and then
734 override it in the per-PC config file for those hosts that will use
735 the other method.  (Or you could run two completely separate instances
736 of BackupPC, with different data directories, one for WinXX and the
737 other for linux/unix, but then common files between the different
738 machine types will duplicated.)
739
740 Here are some brief client setup notes:
741
742 =over 4
743
744 =item WinXX
745
746 The preferred setup for WinXX clients is to set $Conf{XferMethod} to "smb".
747
748 You need to create shares for the data you want to backup.
749 Open "My Computer", right click on the drive (eg: C), and
750 select "Sharing..." (or select "Properties" and select the
751 "Sharing" tab).  In this dialog box you can enable sharing,
752 select the share name and permissions.
753
754 If this machine uses DHCP you will also need to make sure the
755 NetBios name is set.  Go to Control Panel|System|Network Identification
756 (on Win2K) or Control Panel|System|Computer Name (on WinXP).
757 Also, you should go to Control Panel|Network Connections|Local Area
758 Connection|Properties|Internet Protocol (TCP/IP)|Properties|Advanced|WINS
759 and verify that NetBios is not disabled.
760
761 As an alternative to setting $Conf{XferMethod} to "smb" (using
762 smbclient) for WinXX clients, you can use an smb network filesystem (eg:
763 ksmbfs or similar) on your linux/unix server to mount the share,
764 and then set $Conf{XferMethod} to "tar" (use tar on the network
765 mounted file system).
766
767 Also, to make sure that file names with 8-bit characters are correctly
768 transferred by smbclient you should add this to samba's smb.conf file:
769
770     [global]
771         # Accept the windows charset
772         client code page = 850
773         character set = ISO8859-1
774
775 This setting should work for western europe.  
776 See L<http://www.oreilly.com/catalog/samba/chapter/book/ch08_03.html>
777 for more information about settings for other languages.
778
779 =item Linux/Unix
780
781 The preferred setup for linux/unix clients is to set $Conf{XferMethod}
782 to "tar".
783
784 You can use either smb or tar for linux/unix machines. Smb requires that
785 the Samba server (smbd) be run to provide the shares. Since the smb
786 protocol can't represent special files like symbolic links and fifos,
787 tar is the recommended transport method for linux/unix machines.
788 (In fact, by default samba makes symbolic links look like the file or
789 directory that they point to, so you could get an infinite loop if a
790 symbolic link points to the current or parent directory. If you really
791 need to use Samba shares for linux/unix backups you should turn off the
792 "follow symlinks" samba config setting. See the smb.conf manual page.)
793
794 The rest of this section describes the tar setup.
795
796 You must have GNU tar on the client machine.  Use "tar --version"
797 or "gtar --version" to verify.  The version should be at least
798 1.13.7, and 1.13.20 or greater is recommended.
799
800 For linux/unix machines you should no backup "/proc".  This directory
801 contains a variety of files that look like regular files but they are
802 special files that don't need to be backed up (eg: /proc/kcore is a
803 regular file that contains physical memory).  See $Conf{BackupFilesExclude}.
804 It is safe to back up /dev since it contains mostly character-special
805 and block-special files, which are correctly handed by BackupPC
806 (eg: backing up /dev/hda5 just saves the block-special file information,
807 not the contents of the disk).
808
809 Next you should decide whether to run tar over ssh, rsh or nfs. Ssh is
810 the preferred method. Rsh is not secure and therefore not recommended.
811 Nfs will work, but you need to make sure that the BackupPC user (running
812 on the server) has sufficient permissions to read all the files below
813 the nfs mount.
814
815 Ssh allows BackupPC to run as a privileged user on the client (eg:
816 root), since it needs sufficient permissions to read all the backup
817 files. Ssh is setup so that BackupPC on the server (an otherwise low
818 privileged user) can ssh as root on the client, without being prompted
819 for a password. There are two common versions of ssh: v1 and v2. Here
820 are some instructions for one way to setup ssh.  (Check which version
821 of SSH you have by typing "ssh" or "man ssh".)
822
823 =over 4
824
825 =item OpenSSH Instructions
826
827 =over 4
828
829 =item Key generation
830
831 As root on the client machine, use ssh-keygen to generate a
832 public/private key pair, without a pass-phrase:
833
834     ssh-keygen -t rsa -N ''
835
836 This will save the public key in ~/.ssh/id_rsa.pub and the private
837 key in ~/.ssh/id_rsa.
838
839 =item BackupPC setup
840
841 Repeat the above steps for the BackupPC user (__BACKUPPCUSER__) on the server.
842 Make a copy of the public key to make it recognizable, eg:
843
844     ssh-keygen -t rsa -N ''
845     cp ~/.ssh/id_rsa.pub ~/.ssh/BackupPC_id_rsa.pub
846
847 See the ssh and sshd manual pages for extra configuration information.
848
849 =item Key exchange
850
851 To allow BackupPC to ssh to the client as root, you need to place
852 BackupPC's public key into root's authorized list on the client.
853 Append BackupPC's public key (BackupPC_id_rsa.pub) to root's
854 ~/.ssh/authorized_keys2 file on the client:
855
856     touch ~/.ssh/authorized_keys2
857     cat BackupPC_id_rsa.pub >> ~/.ssh/authorized_keys2
858
859 You should edit ~/.ssh/authorized_keys2 and add further specifiers,
860 eg: from, to limit which hosts can login using this key.  For example,
861 if your BackupPC host is called backuppc.my.com, there should be
862 one line in ~/.ssh/authorized_keys2 that looks like:
863
864     from="backuppc.my.com" ssh-rsa [base64 key, eg: ABwBCEAIIALyoqa8....]
865
866 =item Fix permissions
867
868 You will probably need to make sure that all the files
869 in ~/.ssh have no group or other read/write permission:
870
871     chmod -R go-rwx ~/.ssh
872
873 You should do the same thing for the BackupPC user on the server.
874
875 =item Testing
876
877 As the BackupPC user on the server, verify that this command:
878
879     ssh -l root clientHostName whoami
880
881 prints
882
883     root
884
885 You might be prompted the first time to accept the client's host key and
886 you might be prompted for root's password on the client.  Make sure that
887 this command runs cleanly with no prompts after the first time.  You
888 might need to check /etc/hosts.equiv on the client.  Look at the
889 man pages for more information.  The "-v" option to ssh is a good way
890 to get detailed information about what fails.
891
892 =back
893
894 =item SSH2 Instructions
895
896 =over 4
897
898 =item Key generation
899
900 As root on the client machine, use ssh-keygen2 to generate a
901 public/private key pair, without a pass-phrase:
902
903     ssh-keygen2 -t rsa -P
904
905 or:
906
907     ssh-keygen -t rsa -N ''
908
909 (This command might just be called ssh-keygen on your machine.)
910
911 This will save the public key in /.ssh2/id_rsa_1024_a.pub and the private
912 key in /.ssh2/id_rsa_1024_a.
913
914 =item Identification
915
916 Create the identification file /.ssh2/identification:
917
918     echo "IdKey id_rsa_1024_a" > /.ssh2/identification
919
920 =item BackupPC setup
921
922 Repeat the above steps for the BackupPC user (__BACKUPPCUSER__) on the server.
923 Rename the key files to recognizable names, eg:
924
925     ssh-keygen2 -t rsa -P
926     mv ~/.ssh2/id_rsa_1024_a.pub ~/.ssh2/BackupPC_id_rsa_1024_a.pub
927     mv ~/.ssh2/id_rsa_1024_a     ~/.ssh2/BackupPC_id_rsa_1024_a
928     echo "IdKey BackupPC_id_rsa_1024_a" > ~/.ssh2/identification
929
930 Based on your ssh2 configuration, you might also need to turn off
931 StrictHostKeyChecking and PasswordAuthentication:
932
933     touch ~/.ssh2/ssh2_config
934     echo "StrictHostKeyChecking ask" >> ~/.ssh2/ssh2_config
935     echo "PasswordAuthentication no" >> ~/.ssh2/ssh2_config
936
937 =item Key exchange
938
939 To allow BackupPC to ssh to the client as root, you need to place
940 BackupPC's public key into root's authorized list on the client.
941 Copy BackupPC's public key (BackupPC_id_rsa_1024_a.pub) to the
942 /.ssh2 directory on the client.  Add the following line to the
943 /.ssh2/authorization file on the client (as root):
944
945     touch /.ssh2/authorization
946     echo "Key BackupPC_id_rsa_1024_a.pub" >> /.ssh2/authorization
947
948 =item Fix permissions
949
950 You will probably need to make sure that all the files
951 in /.ssh2 have no group or other read/write permission:
952
953     chmod -R go-rwx /.ssh2
954
955 You should do the same thing for the BackupPC user on the server.
956
957 =item Testing
958
959 As the BackupPC user on the server, verify that this command:
960
961     ssh2 -l root clientHostName whoami
962
963 prints
964
965     root
966
967 You might be prompted the first time to accept the client's host key and
968 you might be prompted for root's password on the client.  Make sure that
969 this command runs cleanly with no prompts after the first time.  You
970 might need to check /etc/hosts.equiv on the client.  Look at the
971 man pages for more information.  The "-v" option to ssh2 is a good way
972 to get detailed information about what fails.
973
974 =back
975
976 =item SSH version 1 Instructions
977
978 The concept is identical and the steps are similar, but the specific
979 commands and file names are slightly different.
980
981 First, run ssh-keygen on the client (as root) and server (as the BackupPC
982 user) and simply hit enter when prompted for the pass-phrase:
983
984     ssh-keygen
985
986 This will save the public key in /.ssh/identity.pub and the private
987 key in /.ssh/identity.
988
989 Next, append BackupPC's ~/.ssh/identity.pub (from the server) to root's
990 /.ssh/authorized_keys file on the client.  It's a single long line that
991 you can cut-and-paste with an editor (make sure it remains a single line).
992
993 Next, force protocol version 1 by adding:
994
995     Protocol 1
996
997 to BackupPC's ~/.ssh/config on the server.
998
999 Next, run "chmod -R go-rwx ~/.ssh" on the server and "chmod -R go-rwx /.ssh"
1000 on the client.
1001
1002 Finally, test using:
1003
1004     ssh -l root clientHostName whoami
1005
1006 =back
1007
1008 Finally, if this machine uses DHCP you will need to run nmbd (the
1009 NetBios name server) from the Samba distribution so that the machine
1010 responds to a NetBios name request. See the manual page and Samba
1011 documentation for more information.
1012
1013 =back
1014
1015 =head2 Step 6: Running BackupPC
1016
1017 The installation contains an init.d backuppc script that can be copied
1018 to /etc/init.d so that BackupPC can auto-start on boot.
1019 See init.d/README for further instructions.
1020
1021 BackupPC should be ready to start.  If you installed the init.d script,
1022 then you should be able to run BackupPC with:
1023
1024     /etc/init.d/backuppc start
1025
1026 (This script can also be invoked with "stop" to stop BackupPC and "reload"
1027 to tell BackupPC to reload config.pl and the hosts file.)
1028
1029 Otherwise, just run
1030
1031      __INSTALLDIR__/bin/BackupPC -d
1032
1033 as user __BACKUPPCUSER__.  The -d option tells BackupPC to run as a daemon
1034 (ie: it does an additional fork).
1035
1036 Any immediate errors will be printed to stderr and BackupPC will quit.
1037 Otherwise, look in __TOPDIR__/log/LOG and verify that BackupPC reports
1038 it has started and all is ok.
1039
1040 =head2 Step 7: Talking to BackupPC
1041
1042 Note: as of version 1.5.0, BackupPC no longer supports telnet
1043 to its TCP port.  First off, a unix domain socket is used
1044 instead of a TCP port.  (The TCP port can still be re-enabled
1045 if your installation has apache and BackupPC running on different
1046 machines.)  Secondly, even if you still use the TCP port, the
1047 messages exchanged over this interface are now protected by
1048 an MD5 digest based on a shared secret (see $Conf{ServerMesgSecret})
1049 as well as sequence numbers and per-session unique keys, preventing
1050 forgery and replay attacks.
1051
1052 You should verify that BackupPC is running by using BackupPC_serverMesg.
1053 This sends a message to BackupPC via the unix (or TCP) socket and prints
1054 the response.
1055
1056 You can request status information and start and stop backups using this
1057 interface. This socket interface is mainly provided for the CGI interface
1058 (and some of the BackupPC sub-programs use it too).  But right now we just
1059 want to make sure BackupPC is happy.  Each of these commands should
1060 produce some status output:
1061
1062     __INSTALLDIR__/bin/BackupPC_serverMesg status info
1063     __INSTALLDIR__/bin/BackupPC_serverMesg status jobs
1064     __INSTALLDIR__/bin/BackupPC_serverMesg status hosts
1065
1066 The output should be some hashes printed with Data::Dumper.  If it
1067 looks cryptic and confusing, and doesn't look like an error message,
1068 then all is ok.
1069
1070 The jobs status should initially show just BackupPC_trashClean.
1071 The hosts status should produce a list of every host you have listed
1072 in __TOPDIR__/conf/hosts as part of a big cryptic output line.
1073
1074 You can also request that all hosts be queued:
1075
1076     __INSTALLDIR__/bin/BackupPC_serverMesg backup all
1077
1078 At this point you should make sure the CGI interface works since
1079 it will be much easier to see what is going on.  That's our
1080 next subject.
1081
1082 =head2 Step 8: CGI interface
1083
1084 The CGI interface script, BackupPC_Admin, is a powerful and flexible
1085 way to see and control what BackupPC is doing.  It is written for an
1086 Apache server.  If you don't have Apache, see L<http://www.apache.org>.
1087
1088 There are two options for setting up the CGI interface: standard
1089 mode and using mod_perl.  Mod_perl provides much higher performance
1090 (around 15x) and is the best choice if your Apache was built with
1091 mod_perl support.  To see if your apache was built with mod_perl
1092 run this command:
1093
1094     httpd -l | egrep mod_perl
1095
1096 If this prints mod_perl.c then your Apache supports mod_perl.
1097
1098 Using mod_perl with BackupPC_Admin requires a dedicated Apache
1099 to be run as the BackupPC user (__BACKUPPCUSER__).  This is
1100 because BackupPC_Admin needs permission to access various files
1101 in BackupPC's data directories.  In contrast, the standard
1102 installation (without mod_perl) solves this problem by having
1103 BackupPC_Admin installed as setuid to the BackupPC user, so that
1104 BackupPC_Admin runs as the BackuPC user.
1105
1106 Here are some specifics for each setup:
1107
1108 =over 4
1109
1110 =item Standard Setup
1111
1112 The CGI interface should have been installed by the configure.pl script
1113 in __CGIDIR__/BackupPC_Admin.  BackupPC_Admin should have been installed
1114 as setuid to the BackupPC user (__BACKUPPCUSER__), in addition to user
1115 and group execute permission.
1116
1117 You should be very careful about permissions on BackupPC_Admin and
1118 the directory __CGIDIR__: it is important that normal users cannot
1119 directly execute or change BackupPC_Admin, otherwise they can access
1120 backup files for any PC. You might need to change the group ownership
1121 of BackupPC_Admin to a group that Apache belongs to so that Apache
1122 can execute it (don't add "other" execute permission!).
1123 The permissions should look like this:
1124
1125     ls -l __CGIDIR__/BackupPC_Admin
1126     -swxr-x---    1 __BACKUPPCUSER__   web      82406 Jun 17 22:58 __CGIDIR__/BackupPC_Admin
1127
1128 The setuid script won't work unless perl on your machine was installed
1129 with setuid emulation.  This is likely the problem if you get an error
1130 saying such as "Wrong user: my userid is 25, instead of 150", meaning
1131 the script is running as the httpd user, not the BackupPC user.
1132 This is because setuid scripts are disabled by the kernel in most
1133 flavors of unix and linux.
1134
1135 To see if your perl has setuid emulation, see if there is a program
1136 called sperl5.6.0 or sperl5.6.1 in the place where perl is installed.
1137 If you can't find this program, then you have two options: rebuild
1138 and reinstall perl with the setuid emulation turned on (answer "y" to
1139 the question "Do you want to do setuid/setgid emulation?" when you
1140 run perl's configure script), or switch to the mod_perl alternative
1141 for the CGI script (which doesn't need setuid to work).
1142
1143 =item Mod_perl Setup
1144
1145 The advantage of the mod_perl setup is that no setuid script is needed,
1146 and there is a huge performance advantage.  Not only does all the perl
1147 code need to be parsed just once, the config.pl and hosts files, plus
1148 the connection to the BackupPC server are cached between requests.  The
1149 typical speedup is around 15 times.
1150
1151 To use mod_perl you need to run Apache as user __BACKUPPCUSER__.
1152 If you need to run multiple Apache's for different services then
1153 you need to create multiple top-level Apache directories, each
1154 with their own config file.  You can make copies of /etc/init.d/httpd
1155 and use the -d option to httpd to point each http to a different
1156 top-level directory.  Or you can use the -f option to explicitly
1157 point to the config file.  Multiple Apache's will run on different
1158 Ports (eg: 80 is standard, 8080 is a typical alternative port accessed
1159 via http://yourhost.com:8080).
1160
1161 Inside BackupPC's Apache http.conf file you should check the
1162 settings for ServerRoot, DocumentRoot, User, Group, and Port.  See 
1163 L<http://httpd.apache.org/docs/server-wide.html> for more details.
1164
1165 For mod_perl, BackupPC_Admin should not have setuid permission, so
1166 you should turn it off:
1167
1168     chmod u-s __CGIDIR__/BackupPC_Admin
1169
1170 To tell Apache to use mod_perl to execute BackupPC_Admin, add this
1171 to Apache's httpd.conf file:
1172
1173     <IfModule mod_perl.c>
1174         PerlModule Apache::Registry
1175         PerlTaintCheck On
1176         <Location /cgi-bin/BackupPC/BackupPC_Admin>   # <--- change path as needed
1177            SetHandler perl-script
1178            PerlHandler Apache::Registry
1179            Options ExecCGI
1180         </Location>
1181     </IfModule>
1182
1183 There are other optimizations and options with mod_perl.  For
1184 example, you can tell mod_perl to preload various perl modules,
1185 which saves memory compared to loading separate copies in every
1186 Apache process after they are forked. See Stas's definitive
1187 mod_perl guide at L<http://perl.apache.org/guide>.
1188
1189 =back
1190
1191 BackupPC_Admin requires that users are authenticated by Apache.
1192 Specifically, it expects that Apache sets the REMOTE_USER environment
1193 variable when it runs.  There are several ways to do this.  One way
1194 is to create a .htaccess file in the cgi-bin directory that looks like:
1195
1196     AuthGroupFile /etc/httpd/conf/group    # <--- change path as needed
1197     AuthUserFile /etc/http/conf/passwd     # <--- change path as needed
1198     AuthType basic
1199     AuthName "access"
1200     require valid-user
1201
1202 You will also need "AllowOverride Indexes AuthConfig" in the Apache
1203 httpd.conf file to enable the .htaccess file. Alternatively, everything
1204 can go in the Apache httpd.conf file inside a Location directive. The
1205 list of users and password file above can be extracted from the NIS
1206 passwd file.
1207
1208 One alternative is to use LDAP.  In Apache's http.conf add these lines:
1209
1210     LoadModule auth_ldap_module   modules/auth_ldap.so
1211     AddModule auth_ldap.c
1212
1213     # cgi-bin - auth via LDAP (for BackupPC)
1214     <Location /cgi-binBackupPC/BackupPC_Admin>    # <--- change path as needed
1215       AuthType Basic
1216       AuthName "BackupPC login"
1217       # replace MYDOMAIN, PORT, ORG and CO as needed
1218       AuthLDAPURL ldap://ldap.MYDOMAIN.com:PORT/o=ORG,c=CO?uid?sub?(objectClass=*)
1219       require valid-user
1220     </Location>
1221
1222 If you want to defeat the user authentication you can force a
1223 particular user name by getting Apache to set REMOTE_USER, eg,
1224 to hardcode the user to www you could add this to httpd.conf:
1225
1226     <Location /cgi-bin/BackupPC/BackupPC_Admin>   # <--- change path as needed
1227         Setenv REMOTE_USER www
1228     </Location>
1229
1230 Finally, you should also edit the config.pl file and adjust, as necessary,
1231 the CGI-specific settings.  They're near the end of the config file. In
1232 particular, you should specify which users or groups have administrator
1233 (privileged) access.  Also, the configure.pl script placed various
1234 images into $Conf{CgiImageDir} that BackupPC_Admin needs to serve
1235 up.  You should make sure that $Conf{CgiImageDirURL} is the correct
1236 URL for the image directory.
1237
1238 =head2 Other installation topics
1239
1240 =over 4
1241
1242 =item Copying the pool
1243
1244 If the pool disk requirements grow you might need to copy the entire
1245 data directory to a new (bigger) file system.  Hopefully you are lucky
1246 enough to avoid this by having the data directory on a RAID file system
1247 or LVM that allows the capacity to be grown in place by adding disks.
1248
1249 The backup data directories contain large numbers of hardlinks.  If
1250 you try to copy the pool the target directory will occupy a lot more
1251 space if the hardlinks aren't re-established.
1252
1253 The GNU cp program with the -a option is aware of hardlinks and knows
1254 to re-establish them.  So GNU cp -a is the recommended way to copy
1255 the data directory and pool.  Don't forget to stop BackupPC while
1256 the copy runs.
1257
1258 =item Compressing an existing pool
1259
1260 If you are upgrading BackupPC and want to turn compression on you have
1261 two choices:
1262
1263 =over 4
1264
1265 =item *
1266
1267 Simply turn on compression.  All new backups will be compressed. Both old
1268 (uncompressed) and new (compressed) backups can be browsed and viewed.
1269 Eventually, the old backups will expire and all the pool data will be
1270 compressed. However, until the old backups expire, this approach could
1271 require 60% or more additional pool storage space to store both
1272 uncompressed and compressed versions of the backup files.
1273
1274 =item *
1275
1276 Convert all the uncompressed pool files and backups to compressed.
1277 The script __INSTALLDIR__/bin/BackupPC_compressPool does this.
1278 BackupPC must not be running when you run BackupPC_compressPool.
1279 Also, there must be no existing compressed backups when you
1280 run BackupPC_compressPool.
1281
1282 BackupPC_compressPool compresses all the files in the uncompressed pool
1283 (__TOPDIR__/pool) and moves them to the compressed pool
1284 (__TOPDIR__/cpool). It rewrites the files in place, so that the
1285 existing hardlinks are not disturbed.
1286
1287 =back
1288
1289 The rest of this section discusses how to run BackupPC_compressPool.
1290
1291 BackupPC_compressPool takes three command line options:
1292
1293 =over 4
1294
1295 =item -t
1296
1297 Test mode: do everything except actually replace the pool files.
1298 Useful for estimating total run time without making any real
1299 changes.
1300
1301 =item -r
1302
1303 Read check: re-read the compressed file and compare it against
1304 the original uncompressed file.  Can only be used in test mode.
1305
1306 =item -c #
1307
1308 Number of children to fork. BackupPC_compressPool can take a long time
1309 to run, so to speed things up it spawns four children, each working on a
1310 different part of the pool. You can change the number of children with
1311 the -c option.
1312
1313 =back
1314
1315 Here are the recommended steps for running BackupPC_compressPool:
1316
1317 =over 4
1318
1319 =item *
1320
1321 Stop BackupPC (eg: "/etc/init.d/backuppc stop").
1322
1323 =item *
1324
1325 Set $Conf{CompressLevel} to a non-zero number (eg: 3).
1326
1327 =item *
1328
1329 Do a dry run of BackupPC_compressPool.  Make sure you run this as
1330 the BackupPC user (__BACKUPPCUSER__):
1331
1332     BackupPC_compressPool -t -r
1333
1334 The -t option (test mode) makes BackupPC_compressPool do all the steps,
1335 but not actually change anything. The -r option re-reads the compressed
1336 file and compares it against the original.
1337
1338 BackupPC_compressPool gives a status as it completes each 1% of the job.
1339 It also shows the cumulative compression ratio and estimated completion
1340 time.  Once you are comfortable that things look ok, you can kill
1341 BackupPC_compressPool or wait for it to finish.
1342
1343 =item *
1344
1345 Now you are ready to run BackupPC_compressPool for real.  Once again,
1346 as the BackupPC user (__BACKUPPCUSER__), run:
1347
1348     BackupPC_compressPool
1349
1350 You should put the output into a file and tail this file.  (The running
1351 time could be twice as long as the test mode since the test mode file
1352 writes are immediately followed by an unlink, so in test mode it is
1353 likely the file writes never make it to disk.)
1354
1355 It is B<critical> that BackupPC_compressPool runs to completion before
1356 re-starting BackupPC.  Before BackupPC_compressPool completes, none of
1357 the existing backups will be in a consistent state.  If you must stop
1358 BackupPC_compressPool for some reason, send it an INT or TERM signal
1359 and give it several seconds (or more) to clean up gracefully.
1360 After that, you can re-run BackupPC_compressPool and it will start
1361 again where it left off.  Once again, it is critical that it runs
1362 to 100% completion.
1363
1364 =back
1365
1366 After BackupPC_compressPool completes you should have a complete set
1367 of compressed backups (and your disk usage should be lower).  You
1368 can now re-start BackupPC.
1369
1370 =back
1371
1372 =head2 Debugging installation problems
1373
1374 This section will probably grow based on the types of questions on
1375 the BackupPC mail list.
1376
1377 Assuming BackupPC can start correctly you should inspect __TOPDIR__/log/LOG
1378 for any errors.  Assuming backups for a particular host start, you
1379 should be able to look in __TOPDIR__/pc/$host/LOG for error messages
1380 specific to that host.
1381
1382 The most likely problems will relate to connecting to the smb shares on
1383 each host.  On each failed backup, a file __TOPDIR__/pc/$host/XferERR will
1384 be created. This is the stderr output from smbclient. The first line
1385 will show the full smbclient command that was run. Based on the error
1386 messages you should figure out what is wrong.  Possible errors on the
1387 server side are invalid host, invalid share name, bad username or password.
1388 Possible errors on the client side are misconfiguration of the share,
1389 username or password.
1390
1391 You should run smbclient manually and verify that you can connect to
1392 the host in interactive mode, eg:
1393
1394     smbclient '\\hostName\shareName' -U userName
1395
1396 shareName should match the $Conf{SmbShareName} setting and userName
1397 should match the the $Conf{SmbShareUserName} setting.
1398
1399 You will be prompted for the password. You should then see this prompt:
1400
1401     smb: \>
1402
1403 Verify that "ls" works and then type "quit" to exit.
1404
1405 Secondly, you should also verify that nmblookup correctly returns
1406 the netbios name.  This is essential for DHCP hosts, and depending
1407 upon the setting of $Conf{FixedIPNetBiosNameCheck} might also be
1408 required for fixed IP address hosts too.  Run this command:
1409
1410     nmblookup -A hostName
1411
1412 Verify that the host name is printed.  The output might look like:
1413
1414     received 7 names
1415             DELLLS13        <00> -         P <ACTIVE> 
1416             DOMAINNAME      <00> - <GROUP> P <ACTIVE> 
1417             DELLLS13        <20> -         P <ACTIVE> 
1418             DOMAINNAME      <1e> - <GROUP> P <ACTIVE> 
1419             DELLLS13        <03> -         P <ACTIVE> 
1420             DELLLS13$       <03> -         P <ACTIVE> 
1421             CRAIG           <03> -         P <ACTIVE> 
1422
1423 The first name, converted to lower case, is used for the host name.
1424
1425 =head1 Restore functions
1426
1427 BackupPC supports several different methods for restoring files. The
1428 most convenient restore options are provided via the CGI interface.
1429 Alternatively, backup files can be restored using manual commands.
1430
1431 =head2 CGI restore options
1432
1433 By selecting a host in the CGI interface, a list of all the backups
1434 for that machine will be displayed.  By selecting the backup number
1435 you can navigate the shares and directory tree for that backup.
1436
1437 BackupPC's CGI interface automatically fills incremental backups
1438 with the corresponding full backup, which means each backup has
1439 a filled appearance.  Therefore, there is no need to do multiple
1440 restores from the incremental and full backups: BackupPC does all
1441 the hard work for you.  You simply select the files and directories
1442 you want from the correct backup vintage in one step.
1443
1444 You can download a single backup file at any time simply by selecting
1445 it.  Your browser should prompt you with the file name and ask you
1446 whether to open the file or save it to disk.
1447
1448 Alternatively, you can select one or more files or directories in
1449 the currently selected directory and select "Restore selected files".
1450 (If you need to restore selected files and directories from several
1451 different parent directories you will need to do that in multiple
1452 steps.)
1453
1454 If you select all the files in a directory, BackupPC will replace
1455 the list of files with the parent directory.  You will be presented
1456 with a screen that has three options:
1457
1458 =over 4
1459
1460 =item Option 1: Direct Restore
1461
1462 With this option the selected files and directories are restored
1463 directly back onto the host, by default in their original location.
1464 Any old files with the same name will be overwritten, so use caution.
1465 You can optionally change the target host name, target share name,
1466 and target path prefix for the restore, allowing you to restore the
1467 files to a different location.
1468
1469 Once you select "Start Restore" you will be prompted one last time
1470 with a summary of the exact source and target files and directories
1471 before you commit.  When you give the final go ahead the restore
1472 operation will be queued like a normal backup job, meaning that it
1473 will be deferred if there is a backup currently running for that host.
1474 When the restore job is run, smbclient or tar is used (depending upon
1475 $Conf{XferMethod}) to actually restore the files.  Sorry, there is
1476 currently no option to cancel a restore that has been started.
1477
1478 A record of the restore request, including the result and list of
1479 files and directories, is kept.  It can be browsed from the host's
1480 home page.  $Conf{RestoreInfoKeepCnt} specifies how many old restore
1481 status files to keep.
1482
1483 =item Option 2: Download Zip archive
1484
1485 With this option a zip file containing the selected files and directories
1486 is downloaded.  The zip file can then be unpacked or individual files
1487 extracted as necessary on the host machine. The compression level can be
1488 specified.  A value of 0 turns off compression.
1489
1490 When you select "Download Zip File" you should be prompted where to
1491 save the restore.zip file.
1492
1493 BackupPC does not consider downloading a zip file as an actual
1494 restore operation, so the details are not saved for later browsing
1495 as in the first case.  However, a mention that a zip file was
1496 downloaded by a particular user, and a list of the files, does
1497 appear in BackupPC's log file.
1498
1499 =item Option 3: Download Tar archive
1500
1501 This is identical to the previous option, except a tar file is downloaded
1502 rather than a zip file (and there is currently no compression option).
1503
1504 =back
1505
1506 =head2 Command-line restore options
1507
1508 Apart from the CGI interface, BackupPC allows you to restore files
1509 and directories from the command line.  The following programs can
1510 be used:
1511
1512 =over 4
1513
1514 =item BackupPC_zcat
1515
1516 For each file name argument it inflates (uncompresses) the file and
1517 writes it to stdout.  To use BackupPC_zcat you could give it the
1518 full file name, eg:
1519
1520     __INSTALLDIR__/bin/BackupPC_zcat __TOPDIR__/pc/host/5/fc/fcraig/fexample.txt > example.txt
1521
1522 It's your responsibility to make sure the file is really compressed:
1523 BackupPC_zcat doesn't check which backup the requested file is from.
1524
1525 =item BackupPC_tarCreate
1526
1527 BackupPC_tarCreate creates a tar file for any files or directories in
1528 a particular backup.  Merging of incrementals is done automatically,
1529 so you don't need to worry about whether certain files appear in the
1530 incremental or full backup.
1531
1532 The usage is:
1533
1534    BackupPC_tarCreate [-t] [-h host] [-n dumpNum] [-s shareName]
1535                     [-r pathRemove] [-p pathAdd]
1536                     files/directories...
1537
1538 The command-line files and directories are relative to the specified
1539 shareName.  The tar file is written to stdout.
1540
1541 The required options are:
1542
1543 =over 4
1544
1545 =item -h host
1546
1547 host from which the tar archive is created
1548
1549 =item -n dumpNum
1550
1551 dump number from which the tar archive is created
1552
1553 =item -s shareName
1554
1555 share name from which the tar archive is created
1556
1557 =back
1558
1559 Other options are:
1560
1561 =over 4
1562
1563 =item -t
1564
1565 print summary totals
1566
1567 =item -r pathRemove
1568
1569 path prefix that will be replaced with pathAdd
1570
1571 =item -p pathAdd
1572
1573 new path prefix
1574
1575 =back
1576
1577 The -h, -n and -s options specify which dump is used to generate
1578 the tar archive.  The -r and -p options can be used to relocate
1579 the paths in the tar archive so extracted files can be placed
1580 in a location different from their original location.
1581
1582 =item BackupPC_zipCreate
1583
1584 BackupPC_zipCreate creates a zip file for any files or directories in
1585 a particular backup.  Merging of incrementals is done automatically,
1586 so you don't need to worry about whether certain files appear in the
1587 incremental or full backup.
1588
1589 The usage is:
1590
1591    BackupPC_zipCreate [-t] [-h host] [-n dumpNum] [-s shareName]
1592                     [-r pathRemove] [-p pathAdd] [-c compressionLevel]
1593                    files/directories...
1594
1595 The command-line files and directories are relative to the specified
1596 shareName.  The zip file is written to stdout.
1597
1598 The required options are:
1599
1600 =over 4
1601
1602 =item -h host
1603
1604 host from which the zip archive is created
1605
1606 =item -n dumpNum
1607
1608 dump number from which the zip archive is created
1609
1610 =item -s shareName
1611
1612 share name from which the zip archive is created
1613
1614 =back
1615
1616 Other options are:
1617
1618 =over 4
1619
1620 =item -t
1621
1622 print summary totals
1623
1624 =item -r pathRemove
1625
1626 path prefix that will be replaced with pathAdd
1627
1628 =item -p pathAdd
1629
1630 new path prefix
1631
1632 =item -c level
1633
1634 compression level (default is 0, no compression)
1635
1636 =back
1637
1638 The -h, -n and -s options specify which dump is used to generate
1639 the zip archive.  The -r and -p options can be used to relocate
1640 the paths in the zip archive so extracted files can be placed
1641 in a location different from their original location.
1642
1643 =back
1644
1645 Each of these programs reside in __INSTALLDIR__/bin.
1646
1647 =head1 BackupPC Design
1648
1649 =head2 Some design issues
1650
1651 =over 4
1652
1653 =item Pooling common files
1654
1655 To quickly see if a file is already in the pool, an MD5 digest of the
1656 file length and contents is used as the file name in the pool. This
1657 can't guarantee a file is identical: it just reduces the search to
1658 often a single file or handful of files. A complete file comparison
1659 is always done to verify if two files are really the same.
1660
1661 Identical files on multiples backups are represented by hard links.
1662 Hardlinks are used so that identical files all refer to the same
1663 physical file on the server's disk. Also, hard links maintain
1664 reference counts so that BackupPC knows when to deleted unused files
1665 from the pool.
1666
1667 For the computer-science majors among you, you can think of the pooling
1668 system used by BackupPC as just a chained hash table stored on a (big)
1669 file system.
1670
1671 =item The hashing function
1672
1673 There is a tradeoff between how much of file is used for the MD5 digest
1674 and the time taken comparing all the files that have the same hash.
1675
1676 Using the file length and just the first 4096 bytes of the file for the
1677 MD5 digest produces some repetitions.  One example: with 900,000 unique
1678 files in the pool, this hash gives about 7,000 repeated files, and in
1679 the worst case 500 files have the same hash.  That's not bad: we only
1680 have to do a single file compare 99.2% of the time.  But in the worst
1681 case we have to compare as many as 500 files checking for a match.
1682
1683 With a modest increase in CPU time, if we use the file length and the
1684 first 256K of the file we now only have 500 repeated files and in the
1685 worst case around 20 files have the same hash. Furthermore, if we
1686 instead use the first and last 128K of the file (more specifically, the
1687 first and eighth 128K chunks for files larger than 1MB) we get only 300
1688 repeated files and in the worst case around 20 files have the same hash.
1689
1690 Based on this experimentation, this is the hash function used by BackupPC.
1691 It is important that you don't change the hash function after files
1692 are already in the pool.  Otherwise your pool will grow to twice the
1693 size until all the old backups (and all the old files with old hashes)
1694 eventually expire.
1695
1696 =item Compression
1697
1698 BackupPC supports compression. It uses the deflate and inflate methods
1699 in the Compress::Zlib module, which is based on the zlib compression
1700 library (see L<http://www.gzip.org/zlib/>).
1701
1702 The $Conf{CompressLevel} setting specifies the compression level to use.
1703 Zero (0) means no compression. Compression levels can be from 1 (least
1704 cpu time, slightly worse compression) to 9 (most cpu time, slightly
1705 better compression). The recommended value is 3. Changing it to 5, for
1706 example, will take maybe 20% more cpu time and will get another 2-3%
1707 additional compression. Diminishing returns set in above 5.  See the zlib
1708 documentation for more information about compression levels.
1709
1710 BackupPC implements compression with minimal CPU load. Rather than
1711 compressing every incoming backup file and then trying to match it
1712 against the pool, BackupPC computes the MD5 digest based on the
1713 uncompressed file, and matches against the candidate pool files by
1714 comparing each uncompressed pool file against the incoming backup file.
1715 Since inflating a file takes roughly a factor of 10 less CPU time than
1716 deflating there is a big saving in CPU time.
1717
1718 The combination of pooling common files and compression can yield
1719 a factor of 8 or more overall saving in backup storage.
1720
1721 =back
1722
1723 =head2 BackupPC operation
1724
1725 BackupPC reads the configuration information from
1726 __TOPDIR__/conf/config.pl. It then runs and manages all the backup
1727 activity. It maintains queues of pending backup requests, user backup
1728 requests and administrative commands. Based on the configuration various
1729 requests will be executed simultaneously.
1730
1731 As specified by $Conf{WakeupSchedule}, BackupPC wakes up periodically
1732 to queue backups on all the PCs.  This is a four step process:
1733
1734 =over 4
1735
1736 =item 1
1737
1738 For each host and DHCP address backup requests are queued on the
1739 background command queue.
1740
1741 =item 2
1742
1743 For each PC, BackupPC_dump is forked. Several of these may be run in
1744 parallel, based on the configuration. First a ping is done to see if the
1745 machine is alive. If this is a DHCP address, nmblookup is run to get
1746 the netbios name, which is used as the host name. The file
1747 __TOPDIR__/pc/$host/backups is read to decide whether a full or
1748 incremental backup needs to be run. If no backup is scheduled, or the ping
1749 to $host fails, then BackupPC_dump exits.
1750
1751 The backup is done using samba's smbclient or tar over ssh/rsh/nfs piped
1752 into BackupPC_tarExtract, extracting the backup into __TOPDIR__/pc/$host/new.
1753 The smbclient or tar output is put into __TOPDIR__/pc/$host/XferLOG.
1754
1755 As BackupPC_tarExtract extracts the files from smbclient, it checks each
1756 file in the backup to see if it is identical to an existing file from
1757 any previous backup of any PC. It does this without needed to write the
1758 file to disk. If the file matches an existing file, a hardlink is
1759 created to the existing file in the pool. If the file does not match any
1760 existing files, the file is written to disk and the file name is saved
1761 in __TOPDIR__/pc/$host/NewFileList for later processing by
1762 BackupPC_link.  BackupPC_tarExtract can handle arbitrarily large
1763 files and multiple candidate matching files without needing to
1764 write the file to disk in the case of a match.  This significantly
1765 reduces disk writes (and also reads, since the pool file comparison
1766 is done disk to memory, rather than disk to disk).
1767
1768 Based on the configuration settings, BackupPC_dump checks each
1769 old backup to see if any should be removed.  Any expired backups
1770 are moved to __TOPDIR__/trash for later removal by BackupPC_trashClean.
1771
1772 =item 3
1773
1774 For each complete, good, backup, BackupPC_link is run.
1775 To avoid race conditions as new files are linked into the
1776 pool area, only a single BackupPC_link program runs
1777 at a time and the rest are queued.
1778
1779 BackupPC_link reads the NewFileList written by BackupPC_dump and
1780 inspects each new file in the backup. It re-checks if there is a
1781 matching file in the pool (another BackupPC_link
1782 could have added the file since BackupPC_dump checked). If so, the file
1783 is removed and replaced by a hard link to the existing file. If the file
1784 is new, a hard link to the file is made in the pool area, so that this
1785 file is available for checking against each new file and new backup.
1786
1787 Then, assuming $Conf{IncrFill} is set, for each incremental backup,
1788 hard links are made in the new backup to all files that were not extracted
1789 during the incremental backups.  The means the incremental backup looks
1790 like a complete image of the PC (with the exception that files
1791 that were removed on the PC since the last full backup will still
1792 appear in the backup directory tree).
1793
1794 As of v1.03, the CGI interface knows how to merge unfilled
1795 incremental backups will the most recent prior filled (full)
1796 backup, giving the incremental backups a filled appearance.  The
1797 default for $Conf{IncrFill} is off, since there is now no need to
1798 fill incremental backups.  This saves some level of disk activity,
1799 since lots of extra hardlinks are no longer needed (and don't have
1800 to be deleted when the backup expires).
1801
1802 =item 4
1803
1804 BackupPC_trashClean is always run in the background to remove any
1805 expired backups. Every 5 minutes it wakes up and removes all the files
1806 in __TOPDIR__/trash.
1807
1808 Also, once each night, BackupPC_nightly is run to complete some additional
1809 administrative tasks, such as cleaning the pool.  This involves removing
1810 any files in the pool that only have a single hard link (meaning no backups
1811 are using that file).  Again, to avoid race conditions, BackupPC_nightly
1812 is only run when there are no BackupPC_dump or BackupPC_link processes
1813 running.
1814
1815 =back
1816
1817 BackupPC also listens for TCP connections on $Conf{ServerPort}, which
1818 is used by the CGI script BackupPC_Admin for status reporting and
1819 user-initiated backup or backup cancel requests.
1820
1821 =head2 Storage layout
1822
1823 BackupPC resides in three directories:
1824
1825 =over 4
1826
1827 =item __INSTALLDIR__
1828
1829 Perl scripts comprising BackupPC reside in __INSTALLDIR__/bin,
1830 libraries are in __INSTALLDIR__/lib and documentation
1831 is in __INSTALLDIR__/doc.
1832
1833 =item __CGIDIR__
1834
1835 The CGI script BackupPC_Admin resides in this cgi binary directory.
1836
1837 =item __TOPDIR__
1838
1839 All of BackupPC's data (PC backup images, logs, configuration information)
1840 is stored below this directory.
1841
1842 =back
1843
1844 Below __TOPDIR__ are several directories:
1845
1846 =over 4
1847
1848 =item __TOPDIR__/conf
1849
1850 The directory __TOPDIR__/conf contains:
1851
1852 =over 4
1853
1854 =item config.pl
1855
1856 Configuration file. See L<Configuration file|configuration file>
1857 below for more details.
1858
1859 =item hosts
1860
1861 Hosts file, which lists all the PCs to backup.
1862
1863 =back
1864
1865 =item __TOPDIR__/log
1866
1867 The directory __TOPDIR__/log contains:
1868
1869 =over 4
1870
1871 =item LOG
1872
1873 Current (today's) log file output from BackupPC.
1874
1875 =item LOG.0 or LOG.0.z
1876
1877 Yesterday's log file output.  Log files are aged daily and compressed
1878 (if compression is enabled), and old LOG files are deleted.
1879
1880 =item BackupPC.pid
1881
1882 Contains BackupPC's process id.
1883
1884 =item status.pl
1885
1886 A summary of BackupPC's status written periodically by BackupPC so
1887 that certain state information can be maintained if BackupPC is
1888 restarted.  Should not be edited.
1889
1890 =item UserEmailInfo.pl
1891
1892 A summary of what email was last sent to each user, and when the
1893 last email was sent.  Should not be edited.
1894
1895 =back
1896
1897 =item __TOPDIR__/trash
1898
1899 Any directories and files below this directory are periodically deleted
1900 whenever BackupPC_trashClean checks. When a backup is aborted or when an
1901 old backup expires, BackupPC_dump simply moves the directory to
1902 __TOPDIR__/trash for later removal by BackupPC_trashClean.
1903
1904 =item __TOPDIR__/pool
1905
1906 All uncompressed files from PC backups are stored below __TOPDIR__/pool.
1907 Each file's name is based on the MD5 hex digest of the file contents.
1908 Specifically, for files less than 256K, the file length and the entire
1909 file is used. For files up to 1MB, the file length and the first and
1910 last 128K are used. Finally, for files longer than 1MB, the file length,
1911 and the first and eighth 128K chunks for the file are used.
1912
1913 Each file is stored in a subdirectory X/Y/Z, where X, Y, Z are the
1914 first 3 hex digits of the MD5 digest.
1915
1916 For example, if a file has an MD5 digest of 123456789abcdef0,
1917 the file is stored in __TOPDIR__/pool/1/2/3/123456789abcdef0.
1918
1919 The MD5 digest might not be unique (especially since not all the file's
1920 contents are used for files bigger than 256K). Different files that have
1921 the same MD5 digest are stored with a trailing suffix "_n" where n is
1922 an incrementing number starting at 0. So, for example, if two additional
1923 files were identical to the first, except the last byte was different,
1924 and assuming the file was larger than 1MB (so the MD5 digests are the
1925 same but the files are actually different), the three files would be
1926 stored as:
1927
1928         __TOPDIR__/pool/1/2/3/123456789abcdef0
1929         __TOPDIR__/pool/1/2/3/123456789abcdef0_0
1930         __TOPDIR__/pool/1/2/3/123456789abcdef0_1
1931
1932 Both BackupPC_dump (actually, BackupPC_tarExtract) and BackupPC_link are
1933 responsible for checking newly backed up files against the pool. For
1934 each file, the MD5 digest is used to generate a file name in the pool
1935 directory. If the file exists in the pool, the contents are compared.
1936 If there is no match, additional files ending in "_n" are checked.
1937 (Actually, BackupPC_tarExtract compares multiple candidate files in
1938 parallel.)  If the file contents exactly match, the file is created by
1939 simply making a hard link to the pool file (this is done by
1940 BackupPC_tarExtract as the backup proceeds). Otherwise,
1941 BackupPC_tarExtract writes the new file to disk and a new hard link is
1942 made in the pool to the file (this is done later by BackupPC_link).
1943
1944 Therefore, every file in the pool will have at least 2 hard links
1945 (one for the pool file and one for the backup file below __TOPDIR__/pc).
1946 Identical files from different backups or PCs will all be linked to
1947 the same file.  When old backups are deleted, some files in the pool
1948 might only have one link.  BackupPC_nightly checks the entire pool
1949 and removes all files that have only a single link, thereby recovering
1950 the storage for that file.
1951
1952 One other issue: zero length files are not pooled, since there are a lot
1953 of these files and on most file systems it doesn't save any disk space
1954 to turn these files into hard links.
1955
1956 =item __TOPDIR__/cpool
1957
1958 All compressed files from PC backups are stored below __TOPDIR__/cpool.
1959 Its layout is the same as __TOPDIR__/pool, and the hashing function
1960 is the same (and, importantly, based on the uncompressed file, not
1961 the compressed file).
1962
1963 =item __TOPDIR__/pc/$host
1964
1965 For each PC $host, all the backups for that PC are stored below
1966 the directory __TOPDIR__/pc/$host.  This directory contains the
1967 following files:
1968
1969 =over 4
1970
1971 =item LOG
1972
1973 Current log file for this PC from BackupPC_dump.
1974
1975 =item LOG.0 or LOG.0.z
1976
1977 Last month's log file.  Log files are aged monthly and compressed
1978 (if compression is enabled), and old LOG files are deleted.
1979
1980 =item XferERR or XferERR.z
1981
1982 Output from the transport program (ie: smbclient or tar)
1983 for the most recent failed backup.
1984
1985 =item new
1986
1987 Subdirectory in which the current backup is stored.  This
1988 directory is renamed if the backup succeeds.
1989
1990 =item XferLOG or XferLOG.z
1991
1992 Output from the transport program (ie: smbclient or tar)
1993 for the current backup.
1994
1995 =item nnn (an integer)
1996
1997 Successful backups are in directories numbered sequentially starting at 0.
1998
1999 =item XferLOG.nnn or XferLOG.nnn.z
2000
2001 Output from the transport program (ie: smbclient or tar)
2002 corresponding to backup number nnn.
2003
2004 =item RestoreInfo.nnn
2005
2006 Information about restore request #nnn including who, what, when, and
2007 why. This file is in Data::Dumper format.  (Note that the restore
2008 numbers are not related to the backup number.)
2009
2010 =item RestoreLOG.nnn.z
2011
2012 Output from smbclient or tar during restore #nnn.  (Note that the restore
2013 numbers are not related to the backup number.)
2014
2015 =item config.pl
2016
2017 Optional configuration settings specific to this host.  Settings in this
2018 file override the main configuration file.
2019
2020 =item backups
2021
2022 A tab-delimited ascii table listing information about each successful
2023 backup, one per row.  The columns are:
2024
2025 =over 4
2026
2027 =item num
2028
2029 The backup number, an integer that starts at 0 and increments
2030 for each successive backup.  The corresponding backup is stored
2031 in the directory num (eg: if this field is 5, then the backup is
2032 stored in __TOPDIR__/pc/$host/5).
2033
2034 =item type
2035
2036 Set to "full" or "incr" for full or incremental backup.
2037
2038 =item startTime
2039
2040 Start time of the backup in unix seconds.
2041
2042 =item endTime
2043
2044 Stop time of the backup in unix seconds.
2045
2046 =item nFiles
2047
2048 Number of files backed up (as reported by smbclient or tar).
2049
2050 =item size
2051
2052 Total file size backed up (as reported by smbclient or tar).
2053
2054 =item nFilesExist
2055
2056 Number of files that were already in the pool
2057 (as determined by BackupPC_dump and BackupPC_link).
2058
2059 =item sizeExist
2060
2061 Total size of files that were already in the pool
2062 (as determined by BackupPC_dump and BackupPC_link).
2063
2064 =item nFilesNew
2065
2066 Number of files that were not in the pool
2067 (as determined by BackupPC_link).
2068
2069 =item sizeNew
2070
2071 Total size of files that were not in the pool
2072 (as determined by BackupPC_link).
2073
2074 =item xferErrs
2075
2076 Number of errors or warnings from smbclient (zero for tar).
2077
2078 =item xferBadFile
2079
2080 Number of errors from smbclient that were bad file errors (zero for tar).
2081
2082 =item xferBadShare
2083
2084 Number of errors from smbclient that were bad share errors (zero for tar).
2085
2086 =item tarErrs
2087
2088 Number of errors from BackupPC_tarExtract.
2089
2090 =item compress
2091
2092 The compression level used on this backup.  Zero or empty means no
2093 compression.
2094
2095 =item sizeExistComp
2096
2097 Total compressed size of files that were already in the pool
2098 (as determined by BackupPC_dump and BackupPC_link).
2099
2100 =item sizeNewComp
2101
2102 Total compressed size of files that were not in the pool
2103 (as determined by BackupPC_link).
2104
2105 =item noFill
2106
2107 Set if this backup has not been filled in with the most recent
2108 previous filled or full backup.  See $Conf{IncrFill}.
2109
2110 =item fillFromNum
2111
2112 If this backup was filled (ie: noFill is 0) then this is the
2113 number of the backup that it was filled from
2114
2115 =item mangle
2116
2117 Set if this backup has mangled file names and attributes.  Always
2118 true for backups in v1.4.0 and above.  False for all backups prior
2119 to v1.4.0.
2120
2121 =back
2122
2123 =item restores
2124
2125 A tab-delimited ascii table listing information about each requested
2126 restore, one per row.  The columns are:
2127
2128 =over 4
2129
2130 =item num
2131
2132 Restore number (matches the suffix of the RestoreInfo.nnn and
2133 RestoreLOG.nnn.z file), unrelated to the backup number.
2134
2135 =item startTime
2136
2137 Start time of the restore in unix seconds.
2138
2139 =item endTime
2140
2141 End time of the restore in unix seconds.
2142
2143 =item result
2144
2145 Result (ok or failed).
2146
2147 =item errorMsg
2148
2149 Error message if restore failed.
2150
2151 =item nFiles
2152
2153 Number of files restored.
2154
2155 =item size
2156
2157 Size in bytes of the restored files.
2158
2159 =item tarCreateErrs
2160
2161 Number of errors from BackupPC_tarCreate during restore.
2162
2163 =item xferErrs
2164
2165 Number of errors from smbclient or tar during restore.
2166
2167 =back
2168
2169 =back
2170
2171 =back
2172
2173 =head2 Compressed file format
2174
2175 The compressed file format is as generated by Compress::Zlib::deflate
2176 with one minor, but important, tweak. Since Compress::Zlib::inflate
2177 fully inflates its argument in memory, it could take large amounts of
2178 memory if it was inflating a highly compressed file. For example, a
2179 200MB file of 0x0 bytes compresses to around 200K bytes. If
2180 Compress::Zlib::inflate was called with this single 200K buffer, it
2181 would need to allocate 200MB of memory to return the result.
2182
2183 BackupPC watches how efficiently a file is compressing. If a big file
2184 has very high compression (meaning it will use too much memory when it
2185 is inflated), BackupPC calls the flush() method, which gracefully
2186 completes the current compression.  BackupPC then starts another
2187 deflate and simply appends the output file.  So the BackupPC compressed
2188 file format is one or more concatenated deflations/flushes.  The specific
2189 ratios that BackupPC uses is that if a 6MB chunk compresses to less
2190 than 64K then a flush will be done.
2191
2192 Back to the example of the 200MB file of 0x0 bytes.  Adding flushes
2193 every 6MB adds only 200 or so bytes to the 200K output.  So the
2194 storage cost of flushing is negligible.
2195
2196 To easily decompress a BackupPC compressed file, the script
2197 BackupPC_zcat can be found in __INSTALLDIR__/bin.  For each
2198 file name argument it inflates the file and writes it to stdout.
2199
2200 =head2 File name mangling
2201
2202 Backup file names are stored in "mangled" form. Each node of
2203 a path is preceded by "f" (mnemonic: file), and special characters
2204 (\n, \r, % and /) are URI-encoded as "%xx", where xx is the ascii
2205 character's hex value.  So c:/craig/example.txt is now stored as
2206 fc/fcraig/fexample.txt.
2207
2208 This was done mainly so meta-data could be stored alongside the backup
2209 files without name collisions. In particular, the attributes for the
2210 files in a directory are stored in a file called "attrib", and mangling
2211 avoids file name collisions (I discarded the idea of having a duplicate
2212 directory tree for every backup just to store the attributes). Other
2213 meta-data (eg: rsync checksums) could be stored in file names preceded
2214 by, eg, "c". There are two other benefits to mangling: the share name
2215 might contain "/" (eg: "/home/craig" for tar transport), and I wanted
2216 that represented as a single level in the storage tree. Secondly, as
2217 files are written to NewFileList for later processing by BackupPC_link,
2218 embedded newlines in the file's path will cause problems which are
2219 avoided by mangling.
2220
2221 The CGI script undoes the mangling, so it is invisible to the user.
2222 Old (unmangled) backups are still supported by the CGI
2223 interface.
2224
2225 =head2 Special files
2226
2227 Linux/unix file systems support several special file types: symbolic
2228 links, character and block device files, fifos (pipes) and unix-domain
2229 sockets. All except unix-domain sockets are supported by BackupPC
2230 (there's no point in backing up or restoring unix-domain sockets since
2231 they only have meaning after a process creates them). Symbolic links are
2232 stored as a plain file whose contents are the contents of the link (not
2233 the file it points to). This file is compressed and pooled like any
2234 normal file. Character and block device files are also stored as plain
2235 files, whose contents are two integers separated by a comma; the numbers
2236 are the major and minor device number. These files are compressed and
2237 pooled like any normal file. Fifo files are stored as empty plain files
2238 (which are not pooled since they have zero size). In all cases, the
2239 original file type is stored in the attrib file so it can be correctly
2240 restored.
2241
2242 Hardlinks are also supported.  When GNU tar first encounters a file with
2243 more than one link (ie: hardlinks) it dumps it as a regular file.  When
2244 it sees the second and subsequent hardlinks to the same file, it dumps
2245 just the hardlink information.  BackupPC correctly recognizes these
2246 hardlinks and stores them just like symlinks: a regular text file
2247 whose contents is the path of the file linked to.  The CGI script
2248 will download the original file when you click on a hardlink.
2249
2250 Also, BackupPC_tarCreate has enough magic to re-create the hardlinks
2251 dynamically based on whether or not the original file and hardlinks
2252 are both included in the tar file.  For example, imagine a/b/x is a
2253 hardlink to a/c/y.  If you use BackupPC_tarCreate to restore directory
2254 a, then the tar file will include a/b/x as the original file and a/c/y
2255 will be a hardlink to a/b/x.  If, instead you restore a/c, then the
2256 tar file will include a/c/y as the original file, not a hardlink.
2257
2258 =head2 Attribute file format
2259
2260 The unix attributes for the contents of a directory (all the files and
2261 directories in that directory) are stored in a file called attrib.
2262 There is a single attrib file for each directory in a backup.
2263 For example, if c:/craig contains a single file c:/craig/example.txt,
2264 that file would be stored as fc/fcraig/fexample.txt and there would be an
2265 attribute file in fc/fcraig/attrib (and also fc/attrib and ./attrib).
2266 The file fc/fcraig/attrib would contain a single entry containing the
2267 attributes for fc/fcraig/fexample.txt.
2268
2269 The attrib file starts with a magic number, followed by the
2270 concatenation of the following information for each file:
2271
2272 =over 4
2273
2274 =item *
2275
2276 File name length in perl's pack "w" format (variable length base 128).
2277
2278 =item *
2279
2280 File name.
2281
2282 =item *
2283
2284 The unix file type, mode, uid, gid and file size divided by 4GB and
2285 file size modulo 4GB (type mode uid gid sizeDiv4GB sizeMod4GB),
2286 in perl's pack "w" format (variable length base 128).
2287
2288 =item *
2289
2290 The unix mtime (unix seconds) in perl's pack "N" format (32 bit integer).
2291
2292 =back
2293
2294 The attrib file is also compressed if compression is enabled.
2295 See the lib/BackupPC/Attrib.pm module for full details.
2296
2297 Attribute files are pooled just like normal backup files.  This saves
2298 space if all the files in a directory have the same attributes across
2299 multiple backups, which is common.
2300
2301 =head2 Limitations
2302
2303 BackupPC isn't perfect (but it is getting better).  Here are some
2304 limitations of BackupPC:
2305
2306 =over 4
2307
2308 =item Non-unix file attributes not backed up
2309
2310 smbclient doesn't extract the WinXX ACLs, so file attributes other than
2311 the equivalent (as provided by smbclient) unix attributes are not
2312 backed up.
2313
2314 =item Locked files are not backed up
2315
2316 Under WinXX a locked file cannot be read by smbclient.  Such files will
2317 not be backed up.  This includes the WinXX system registry files.
2318
2319 This is especially troublesome for Outlook, which stores all its data
2320 in a single large file and keeps it locked whenever it is running.
2321 Since many users keep Outlook running all the time their machine
2322 is up their Outlook file will not be backed up.  Sadly, this file
2323 is the most important file to backup.  As one workaround, Microsoft has
2324 a user-level application that periodically asks the user if they want to
2325 make a copy of their outlook.pst file.  This copy can then be backed up
2326 by BackupPC.  See L<http://office.microsoft.com/downloads/2002/pfbackup.aspx>.
2327
2328 Similarly, all of the data for WinXX services like SQL databases,
2329 Exchange etc won't be backed up.  If these applications support
2330 some kind of export or utility to save their data to disk then this
2331 can =used to create files that BackupPC can backup.
2332
2333 So far, the best that BackupPC can do is send warning emails to
2334 the user saying that their outlook files haven't been backed up in
2335 X days.  (X is configurable.)  The message invites the user to
2336 exit Outlook and gives a URL to manually start a backup.
2337
2338 I suspect there is a way of mirroring the outlook.pst file so
2339 that at least the mirror copy can be backed up.  Or perhaps a
2340 manual copy can be started at login.   Does some WinXX expert
2341 know how to do this?
2342
2343 Comment: two users have noted that there are commercial OFM (open file
2344 manager) products that are designed to solve this problem, for example
2345 from St. Bernard or Columbia Data Products. Apparently Veritas and
2346 Legato bundle this product with their commercial products.  See for
2347 example L<http://www.stbernard.com/products/docs/ofm_whitepaperV8.pdf>.
2348 If anyone tries these programs with BackupPC please tell us whether or
2349 not they work.
2350
2351 =item Don't expect to reconstruct a complete WinXX drive
2352
2353 The conclusion from the last few items is that BackupPC is not intended
2354 to allow a complete WinXX disk to be re-imaged from the backup. Our
2355 approach to system restore in the event of catastrophic failure is to
2356 re-image a new disk from a generic master, and then use the BackupPC
2357 archive to restore user files.
2358
2359 It is likely that linux/unix backups done using tar (rather than
2360 smb) can be used to reconstruct a complete file system, although
2361 I haven't tried it.
2362
2363 =item Maximum Backup File Sizes
2364
2365 BackupPC can backup and manage very large file sizes, probably as large
2366 as 2^51 bytes (when a double-precision number's mantissa can no longer
2367 represent an integer exactly).  In practice, several things outside
2368 BackupPC limit the maximum individual file size.  Any one of the
2369 following items will limit the maximum individual file size:
2370
2371 =over 4
2372
2373 =item Perl
2374
2375 Perl needs to be compiled with uselargefiles defined. Check your
2376 installation with:
2377
2378     perl -V | egrep largefiles
2379
2380 Without this, the maximum file size will be 2GB.
2381
2382 =item File system
2383
2384 The BackupPC pool and data directories must be on a file system that
2385 supports large files.
2386
2387 Without this, the maximum file size will be 2GB.
2388
2389 =item Transport
2390
2391 The transport mechanism also limits the maximum individual file size.
2392
2393 GNU tar maximum file size is limited by the tar header format. The tar
2394 header uses 11 octal digits to represent the file size, which is 33 bits
2395 or 8GB.  I vaguely recall (but I haven't recently checked) that GNU tar
2396 uses an extra octal digit (replacing a trailing delimiter) if necessary,
2397 allowing 64GB files.  So tar transport limits the maximum file size to
2398 8GB or perhaps 64GB.  It is possible that files >= 8GB don't work; this
2399 needs to be looked into.
2400
2401 Smbclient is limited to 4GB file sizes.  Moreover, a bug in smbclient
2402 (mixing signed and unsigned 32 bit values) causes it to incorrectly
2403 do the tar octal conversion for file sizes from 2GB-4GB.  BackupPC_tarExtract
2404 knows about this bug and can recover the correct file size.  So smbclient
2405 transport works up to 4GB file sizes.
2406
2407 =back
2408
2409 =item Some tape backup systems aren't smart about hard links
2410
2411 If you backup the BackupPC pool to tape you need to make sure that the
2412 tape backup system is smart about hard links. For example, if you
2413 simply try to tar the BackupPC pool to tape you will backup a lot more
2414 data than is necessary.
2415
2416 Using the example at the start of the installation section, 65 hosts are
2417 backed up with each full backup averaging 3.2GB. Storing one full backup
2418 and two incremental backups per laptop is around 240GB of raw data. But
2419 because of the pooling of identical files, only 87GB is used (with
2420 compression the total is lower). If you run du or tar on the data
2421 directory, there will appear to be 240GB of data, plus the size of the
2422 pool (around 87GB), or 327GB total.
2423
2424 If your tape backup system is not smart about hard links an alternative
2425 is to periodically backup just the last successful backup for each host
2426 to tape.  Another alternative is to do a low-level dump of the pool
2427 file system (ie: /dev/hda1 or similar) using dump(1).
2428
2429 Supporting more efficient tape backup is an area for further
2430 development.
2431
2432 =item Incremental backups might included deleted files
2433
2434 To make browsing and restoring backups easier, incremental backups
2435 are "filled-in" from the last complete backup when the backup is
2436 browsed or restored.
2437
2438 However, if a file was deleted by a user after the last full backup, that
2439 file will still appear in the "filled-in" incremental backup. This is not
2440 really a specific problem with BackupPC, rather it is a general issue
2441 with the full/incremental backup paradigm.  This minor problem could be
2442 solved by having smbclient list all files when it does the incremental
2443 backup.  Volunteers anyone?
2444
2445 =back
2446
2447 Comments or suggestions on these issues are welcome.
2448
2449 =head2 Security issues
2450
2451 Please read this section and consider each of the issues carefully.
2452
2453 =over 4
2454
2455 =item Smb share password
2456
2457 An important security risk is the manner in which the smb share
2458 passwords are stored. They are in plain text. As described in
2459 L<Step 3: Setting up config.pl|step 3: setting up config.pl> there are four
2460 ways to tell BackupPC the smb share password (manually setting an environment
2461 variable, setting the environment variable in /etc/init.d/backuppc,
2462 putting the password in __TOPDIR__/conf/config.pl, or putting the
2463 password in __TOPDIR__/pc/$host/config.pl). In the latter 3 cases the
2464 smb share password appears in plain text in a file.
2465
2466 If you use any of the latter three methods please make sure that the file's
2467 permission is appropriately restricted.  If you also use RCS or CVS, double
2468 check the file permissions of the config.pl,v file.
2469
2470 In future versions there will probably be support for encryption of the
2471 smb share password, but a private key will still have to be stored in a
2472 protected place.  Comments and suggestions are welcome.
2473
2474 =item BackupPC socket server
2475
2476 In v1.5.0 the primary method for communication between the CGI program
2477 (BackupPC_Admin) and the server (BackupPC) is via a unix-domain socket.
2478 Since this socket has restricted permissions, no local user should be
2479 able to connect to this port.  No backup or restore data passes through
2480 this interface, but an attacker can start or stop backups and get status
2481 through this port.
2482
2483 If the Apache server and BackupPC_Admin run on a different host to
2484 BackupPC then a TCP port must be enabled by setting $Conf{ServerPort}.
2485 Anyone can connect to this port.  To avoid possible attacks via the TCP
2486 socket interface, every client message is protected by an MD5 digest.
2487 The MD5 digest includes four items:
2488
2489 =over 4
2490
2491 =item *
2492
2493 a seed that is sent to the client when the connection opens
2494
2495 =item *
2496
2497 a sequence number that increments for each message
2498
2499 =item *
2500
2501 a shared secret that is stored in $Conf{ServerMesgSecret}
2502
2503 =item *
2504
2505 the message itself.
2506
2507 =back
2508
2509 The message is sent in plain text preceded by the MD5 digest.  A
2510 snooper can see the plain-text seed sent by BackupPC and plain-text
2511 message from the client, but cannot construct a valid MD5 digest since
2512 the secret in $Conf{ServerMesgSecret} is unknown.  A replay attack is
2513 not possible since the seed changes on a per-connection and
2514 per-message basis.
2515
2516 So if you do enable the TCP port, please set $Conf{ServerMesgSecret}
2517 to some hard-to-guess string.  A denial-of-service attack is possible
2518 with the TCP port enabled.  Someone could simply connect many times
2519 to this port, until BackupPC had exhausted all its file descriptors,
2520 and this would cause new backups and the CGI interface to fail.  The
2521 most secure solution is to run BackupPC and Apache on the same machine
2522 and disable the TCP port.
2523
2524 By the way, if you have upgraded from a version of BackupPC prior to
2525 v1.5.0 you should set $Conf{ServerPort} to -1 to disable the TCP port.
2526
2527 =item Installation permissions
2528
2529 It is important to check that the BackupPC scripts in __INSTALLDIR__/bin
2530 and __INSTALLDIR__/lib cannot be edited by normal users. Check the
2531 directory permissions too.
2532
2533 =item Pool permissions
2534
2535 It is important to check that the data files in __TOPDIR__/pool,
2536 __TOPDIR__/pc and __TOPDIR__/trash cannot be read by normal users.
2537 Normal users should not be able to see anything below __TOPDIR__.
2538
2539 =item Host shares
2540
2541 Enabling shares on hosts carries security risks.  If you are on a private
2542 network and you generally trust your users then there should not be a
2543 problem. But if you have a laptop that is sometimes on public networks
2544 (eg: broadband or even dialup) you should be concerned.  A conservative
2545 approach is to use firewall software, and only enable the netbios and
2546 smb ports (137 and 139) on connections from the host running BackupPC.
2547
2548 =item SSH key security
2549
2550 Using ssh for linux/unix clients is quite secure, but the security is
2551 only as good as the protection of ssh's private keys. If an attacker can
2552 devise a way to run a shell as the BackupPC user then they will have
2553 access to BackupPC's private ssh keys. They can then, in turn, ssh to
2554 any client machine as root (or whichever user you have configured
2555 BackupPC to use). This represents a serious compromise of your entire
2556 network.  So in vulnerable networks, think carefully about how to protect
2557 the machine running BackupPC and how to prevent attackers from gaining
2558 shell access (as the BackupPC user) to the machine.
2559
2560 =item CGI interface
2561
2562 The CGI interface, __CGIDIR__/BackupPC_Admin, needs access to the pool
2563 files so it is installed setuid to __BACKUPPCUSER__. The permissions of
2564 this file need to checked carefully. It should be owned by
2565 __BACKUPPCUSER__ and have user and group (but not other) execute
2566 permission. To allow apache/httpd to execute it, the group ownership
2567 should be something that apache/httpd belongs to.
2568
2569 The Apache configuration should be setup for AuthConfig style,
2570 using a .htaccess file so that the user's name is passed into
2571 the script as $ENV{REMOTE_USER}.
2572
2573 If normal users could directly run BackupPC_Admin then there is a serious
2574 security hole: since it is setuid to __BACKUPPCUSER__ any user can
2575 browse and restore any backups. Be aware that anyone who is allowed to
2576 edit or create cgi scripts on your server can execute BackupPC_Admin as
2577 any user!  They simply write a cgi script that sets $ENV{REMOTE_USER} and
2578 then execs BackupPC_Admin.  The exec succeeds since httpd runs the first
2579 script as user httpd/apache, which in turn has group permission to
2580 execute BackupPC_Admin.
2581
2582 While this setup should be safe, a more conservative approach is to
2583 run a dedicated Apache as user __BACKUPPCUSER__ on a different port.
2584 Then BackupPC_Admin no longer needs to be setuid, and the cgi
2585 directories can be locked down from normal users.  Moreover, this
2586 setup is exactly the one used to support mod_perl, so this provides
2587 both the highest performance and the lowest security risk.
2588
2589 =back
2590
2591 Comments and suggestions are welcome.
2592
2593 =head1 Configuration File
2594
2595 The BackupPC configuration file resides in __TOPDIR__/conf/config.pl.
2596 Optional per-PC configuration files reside in __TOPDIR__/pc/$host/config.pl.
2597 This file can be used to override settings just for a particular PC.
2598
2599 =head2 Modifying the main configuration file
2600
2601 The configuration file is a perl script that is executed by BackupPC, so
2602 you should be careful to preserve the file syntax (punctuation, quotes
2603 etc) when you edit it. It is recommended that you use CVS, RCS or some
2604 other method of source control for changing config.pl.
2605
2606 BackupPC reads or re-reads the main configuration file and
2607 the hosts file in three cases:
2608
2609 =over 4
2610
2611 =item *
2612
2613 Upon startup.
2614
2615 =item *
2616
2617 When BackupPC is sent a HUP (-1) signal.  Assuming you installed the 
2618 init.d script, you can also do this with "/etc/init.d/backuppc reload".
2619
2620 =item *
2621
2622 When the modification time of config.pl file changes.  BackupPC
2623 checks the modification time once during each regular wakeup.
2624
2625 =back
2626
2627 Whenever you change the configuration file you can either do
2628 a kill -HUP BackupPC_pid or simply wait until the next regular
2629 wakeup period.
2630
2631 Each time the configuration file is re-read a message is reported in the
2632 LOG file, so you can tail it (or view it via the CGI interface) to make
2633 sure your kill -HUP worked. Errors in parsing the configuration file are
2634 also reported in the LOG file.
2635
2636 The optional per-PC configuration file (__TOPDIR__/pc/$host/config.pl)
2637 is read whenever it is needed by BackupPC_dump, BackupPC_link and others.
2638
2639 =head2 Configuration file includes
2640
2641 If you have a heterogeneous set of clients (eg: a variety of WinXX and
2642 linux/unix machines) you will need to create host-specific config.pl files
2643 for some or all of these machines to customize the default settings from
2644 the master config.pl file (at a minimum to set $Conf{XferMethod}).
2645
2646 Since the config.pl file is just regular perl code, you can include
2647 one config file from another.  For example, imagine you had three general
2648 classes of machines: WinXX desktops, linux machines in the DMZ and
2649 linux desktops.  You could create three config files in __TOPDIR__/conf:
2650
2651     __TOPDIR__/conf/ConfigWinDesktop.pl
2652     __TOPDIR__/conf/ConfigLinuxDMZ.pl
2653     __TOPDIR__/conf/ConfigLinuxDesktop.pl
2654
2655 From each client's directory you can either add a symbolic link to
2656 the appropriate config file:
2657
2658     cd __TOPDIR__/pc/$host
2659     ln -s ../../conf/ConfigWinDesktop.pl config.pl
2660
2661 or, better yet, create a config.pl file in __TOPDIR__/pc/$host
2662 that contains this line:
2663
2664     do "../../conf/ConfigWinDesktop.pl";
2665
2666 This alternative allows you to set other configuration options
2667 specific to each host (perhaps even overriding the settings in
2668 the included file).
2669
2670 Note that you could also include snippets of configuration settings
2671 from the main configuration file.  However, be aware that the
2672 modification-time checking that BackupPC does only applies to the
2673 main configuration file: if you change one of the included files,
2674 BackupPC won't notice.  You will need to either touch the main
2675 configuration file too, or send BackupPC a HUP (-1) signal.
2676
2677 =head1 Configuration Parameters
2678
2679 The configuration parameters are divided into five general groups.
2680 The first group (general server configuration) provides general
2681 configuration for BackupPC.  The next two groups describe what to
2682 backup, when to do it, and how long to keep it.  The fourth group
2683 are settings for email reminders, and the final group contains
2684 settings for the CGI interface.
2685
2686 All configuration settings in the second through fifth groups can
2687 be overridden by the per-PC config.pl file.
2688
2689 __CONFIGPOD__
2690
2691 =head1 Version Numbers
2692
2693 Starting with v1.4.0 BackupPC switched to a X.Y.Z version numbering
2694 system, instead of X.0Y. The first digit is for major new releases, the
2695 middle digit is for significant feature releases and improvements (most
2696 of the releases have been in this category), and the last digit is for
2697 bug fixes. You should think of the old 1.00, 1.01, 1.02 and 1.03 as
2698 1.0.0, 1.1.0, 1.2.0 and 1.3.0.
2699
2700 =head1 Author
2701
2702 Craig Barratt  <cbarratt@users.sourceforge.net>
2703
2704 See L<http://backuppc.sourceforge.net>.
2705
2706 =head1 Copyright
2707
2708 Copyright (C) 2001-2002 Craig Barratt
2709
2710 =head1 Credits
2711
2712 Ryan Kucera contributed the directory navigation code and images
2713 for v1.5.0.  He also contributed the first skeleton of BackupPC_restore.
2714
2715 Guillaume Filion wrote BackupPC_zipCreate and added the CGI support
2716 for zip download, in addition to some CGI cleanup, for v1.5.0.
2717
2718 Several people have reported bugs or made useful suggestions; see the
2719 ChangeLog.
2720
2721 Your name could appear here in the next version!
2722
2723 =head1 License
2724
2725 This program is free software; you can redistribute it and/or modify it
2726 under the terms of the GNU General Public License as published by the
2727 Free Software Foundation; either version 2 of the License, or (at your
2728 option) any later version.
2729
2730 This program is distributed in the hope that it will be useful,
2731 but WITHOUT ANY WARRANTY; without even the implied warranty of
2732 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2733 General Public License for more details.
2734
2735 You should have received a copy of the GNU General Public License in the
2736 LICENSE file along with this program; if not, write to the Free Software
2737 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.