From: cbarratt Date: Sun, 16 Sep 2007 06:16:41 +0000 (+0000) Subject: * When there is an existing partial, a new partials is only saved X-Git-Tag: v3_1_0~5 X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=commitdiff_plain;h=f41207123efc0156687d3f7994cd245a70d7de62 * When there is an existing partial, a new partials is only saved if it has more files than the existing partial. Requested by Carl Soderstrom. * Fixed handling of $Conf{BackupFilesExclude} for tar XferMethod. Patch supplied by Frans Pop. * Fixed numeric column sorting in host summary table, reported by Michael Pellegrino. * Fixed host CGI editor so it creates the new host's config.pl file using the lower-case host name, since host names are mapped to lower case when they are read from the hosts file. Reported by Alexander Onic. * Applied documentation patches from Frans Pop. --- diff --git a/ChangeLog b/ChangeLog index 742d05b..d1777df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,27 @@ # Version __VERSION__, __RELEASEDATE__ #------------------------------------------------------------------------ +* When there is an existing partial, a new partials is only saved + if it has more files than the existing partial. Requested by + Carl Soderstrom. + +* Fixed handling of $Conf{BackupFilesExclude} for tar XferMethod. + Patch supplied by Frans Pop. + +* Fixed numeric column sorting in host summary table, reported by + Michael Pellegrino. + +* Fixed host CGI editor so it creates the new host's config.pl file + using the lower-case host name, since host names are mapped to + lower case when they are read from the hosts file. Reported by + Alexander Onic. + +* Applied documentation patches from Frans Pop. + +#------------------------------------------------------------------------ +# Version 3.1.0beta0, 3 Sep 2007 +#------------------------------------------------------------------------ + * Added new script BackupPC_archiveStart that allows command-line starting of archives. Based on script written by Sergey Kovzik, which in turn was based on an earlier version by Holger Parplies. @@ -105,8 +126,6 @@ * configure.pl clears $Conf{ParPath} if it doesn't point to a valid executable. -* Added freebsd-backuppc init.d script from Gabriel Rossetti. - * Added documentation for BackupPC_tarPCCopy, including use of -P option to tar suggested by Daniel Berteaud. diff --git a/bin/BackupPC_dump b/bin/BackupPC_dump index 8ee8c7e..7c3e33c 100755 --- a/bin/BackupPC_dump +++ b/bin/BackupPC_dump @@ -303,6 +303,7 @@ my $lastFullTime = 0; my $lastIncrTime = 0; my $partialIdx = -1; my $partialNum; +my $partialFileCnt; my $lastBkupNum; my $lastPartial = 0; @@ -405,9 +406,10 @@ for ( my $i = 0 ; $i < @Backups ; $i++ ) { $lastIncrTime = $Backups[$i]{startTime} if ( $lastIncrTime < $Backups[$i]{startTime} ); } elsif ( $Backups[$i]{type} eq "partial" ) { - $partialIdx = $i; - $lastPartial = $Backups[$i]{startTime}; - $partialNum = $Backups[$i]{num}; + $partialIdx = $i; + $lastPartial = $Backups[$i]{startTime}; + $partialNum = $Backups[$i]{num}; + $partialFileCnt = $Backups[$i]{nFiles}; } } @@ -1128,7 +1130,9 @@ sub BackupFailCleanup # # We keep this backup if it is a full and we actually backed - # up some files. + # up some files. If the prior backup was a partial too, we + # only keep this backup if it has more files than the previous + # partial. # if ( $type eq "full" ) { if ( $nFilesTotal == 0 && $xfer->getStats->{fileCnt} == 0 ) { @@ -1137,13 +1141,29 @@ sub BackupFailCleanup # directory just in case. # find(\&CheckForNewFiles, "$Dir/new"); - $keepPartial = 1 if ( $nFilesTotal ); - } else { - # - # Xfer reported some files - # + } + my $str; + if ( $nFilesTotal > $partialFileCnt + || $xfer->getStats->{fileCnt} > $partialFileCnt ) { + # + # If the last backup wasn't a partial then + # $partialFileCnt is undefined, so the above + # test is simply $nFilesTotal > 0 + # $keepPartial = 1; - } + if ( $partialFileCnt ) { + $str = "Saving this as a partial backup\n"; + } else { + $str = sprintf("Saving this as a partial backup, replacing the" + . " prior one (got %d and %d files versus %d)\n", + $nFilesTotal, $xfer->getStats->{fileCnt}, $partialFileCnt); + } + } else { + $str = sprintf("Not saving this as a partial backup since it has fewer" + . " files than the prior one (got %d and %d files versus %d)\n", + $nFilesTotal, $xfer->getStats->{fileCnt}, $partialFileCnt); + } + $XferLOG->write(\$str); } # diff --git a/doc-src/BackupPC.pod b/doc-src/BackupPC.pod index 3f50272..e027b1b 100644 --- a/doc-src/BackupPC.pod +++ b/doc-src/BackupPC.pod @@ -120,7 +120,7 @@ files that changed since the last full (level 0). For SMB and tar, BackupPC uses the modification time (mtime) to determine which files have changed since the last lower-level -backup. That mean SMB and tar incrementals are not able to detect +backup. That means SMB and tar incrementals are not able to detect deleted files, renamed files or new files whose modification time is prior to the last lower-level backup. @@ -227,7 +227,7 @@ This page has links to the current releases of BackupPC. BackupPC has a FAQ at L. -=item Mail lists +=item Mailing lists Three BackupPC mailing lists exist for announcements (backuppc-announce), developers (backuppc-devel), and a general user list for support, asking @@ -323,7 +323,7 @@ L. Also, everyone is encouraged to contribute patches, bug reports, feature and design suggestions, new code, FAQs, and documentation corrections or -improvements. Answering questions on the mail list is a big help too. +improvements. Answering questions on the mailing list is a big help too. =head1 Installing BackupPC @@ -342,8 +342,8 @@ you can run. You should be able to run 4-8 simultaneous backups on a moderately configured server. Several users have reported significantly better performance using -reiser compared to ext3 for the BackupPC data file system. It is -also recommended you consider either an LVM or raid setup (either +reiserfs compared to ext3 for the BackupPC data file system. It is +also recommended you consider either an LVM or RAID setup (either in HW or SW; eg: 3Ware RAID5) so that you can expand the file system as necessary. @@ -480,7 +480,7 @@ more troublesome, since it keeps this file locked all the time, so it cannot be read by smbclient whenever Outlook is running. See the L section for more discussion of this problem. -In addition to total disk space, you shold make sure you have +In addition to total disk space, you should make sure you have plenty of inodes on your BackupPC data partition. Some users have reported running out of inodes on their BackupPC data partition. So even if you have plenty of disk space, BackupPC will report @@ -492,16 +492,16 @@ inode usage. =head2 Step 1: Getting BackupPC Some linux distributions now include BackupPC. The Debian -distribution, supprted by Ludovic Drolez, can be found at -L; it should be included -in the next stable Debian release. On Debian, BackupPC can +distribution, supported by Ludovic Drolez, can be found at +L and is included +in the current stable Debian release. On Debian, BackupPC can be installed with the command: apt-get install backuppc In the future there might be packages for Gentoo and other linux flavors. If the packaged version is older than the -released version then you will probably want to install the +released version then you may want to install the latest version as described below. Otherwise, manually fetching and installing BackupPC is easy. @@ -512,6 +512,11 @@ download the latest version. =head2 Step 2: Installing the distribution +Note: most information in this step is only relevant if you build +and install BackupPC yourself. If you use a package provided by a +distribution, the package management system should take of installing +any needed dependencies. + First off, there are three perl modules you should install. These are all optional, but highly recommended: @@ -594,13 +599,16 @@ read with perldoc: perldoc configure.pl Starting with BackupPC 3.0.0, the configure.pl script by default -complies with the file system hierarchy conventions. The major -difference compared to earlier versions is that by default +complies with the file system hierarchy (FHS) conventions. The +major difference compared to earlier versions is that by default configuration files will be stored in /etc/BackupPC rather than below the data directory, __TOPDIR__/conf, -and the log files will be stored in /var/log/BackupPC. +and the log files will be stored in /var/log/BackupPC rather than below the data directory, __TOPDIR__/log. +Note that distributions may choose to use different locations for +BackupPC files than these defaults. + If you are upgrading from an earlier version the configure.pl script will keep the configuration files and log files in their original location. @@ -615,7 +623,7 @@ information. It is best if BackupPC runs as a special user, eg backuppc, that has limited privileges. It is preferred that backuppc belongs to a system -administrator group so that sys admin members can browse backuppc files, +administrator group so that sys admin members can browse BackupPC files, edit the configuration files and so on. Although configurable, the default settings leave group read permission on pool files, so make sure the BackupPC user's group is chosen restrictively. @@ -651,15 +659,19 @@ On this installation, this is __INSTALLDIR__. You should decide where the BackupPC CGI script resides. This will usually be below Apache's cgi-bin directory. +It is also possible to use a different directory and use Apache's +``'' directive to specifiy that location. See the Apache +HTTP Server documentation for additional information. + On this installation, this is __CGIDIR__. -=item Apache image directory +=item Apache image Directory A directory where BackupPC's images are stored so that Apache can -serve them. This should be somewhere under Apache's DocumentRoot -directory. +serve them. You should ensure this directory is readable by Apache and +create a symlink to this directory from the BackupPC CGI bin Directory. -=item Config and Log directories +=item Config and Log Directories In this installation the configuration and log directories are located in the following locations: @@ -1024,9 +1036,9 @@ Note that if you run rsyncd (rsync daemon), ssh is not used. In this case, rsyncd provides its own authentication, but there is no encryption of network data. If you want encryption of network data you can use ssh to create a tunnel, or use a -program like stunnel. If someone submits instructions I +program like stunnel. -Setup instructions for ssh are at +Setup instructions for ssh can be found at L. =item Clients that use DHCP @@ -1162,13 +1174,17 @@ run this command: If this prints mod_perl.c then your Apache supports mod_perl. +Note: on some distributions (like Debian) the command is not ``httpd'', +but ``apache'' or ``apache2''. Those distributions will generally also +use ``apache'' for the Apache user account and configuration files. + Using mod_perl with BackupPC_Admin requires a dedicated Apache to be run as the BackupPC user (__BACKUPPCUSER__). This is because BackupPC_Admin needs permission to access various files in BackupPC's data directories. In contrast, the standard installation (without mod_perl) solves this problem by having BackupPC_Admin installed as setuid to the BackupPC user, so that -BackupPC_Admin runs as the BackuPC user. +BackupPC_Admin runs as the BackupPC user. Here are some specifics for each setup: @@ -1347,7 +1363,7 @@ BackupPC (starting with v2.0.0) looks up hosts with DHCP = 0 in this manner: First DNS is used to lookup the IP address given the client's name using perl's gethostbyname() function. This should succeed for machines that have fixed IP addresses that are known via DNS. You can manually -see whether a given host have a DNS entry according to perls' +see whether a given host have a DNS entry according to perl's gethostbyname function with this command: perl -e 'print(gethostbyname("myhost") ? "ok\n" : "not found\n");' @@ -1366,7 +1382,7 @@ If this fails you will see output like: querying myhost on 10.10.255.255 name_query failed to find name myhost -If this success you will see output like: +If it is successful you will see output like: querying myhost on 10.10.255.255 10.10.1.73 myhost<00> @@ -1376,7 +1392,7 @@ nmblookup. For example: nmblookup -B 10.10.1.255 myhost -If necessary, experiment on the nmblookup command that will return the +If necessary, experiment with the nmblookup command which will return the IP address of the client given its name. Then update $Conf{NmbLookupFindHostCmd} with any necessary options to nmblookup. @@ -1441,7 +1457,7 @@ backups (via the CGI interface) will be ignored. =back -This will still allow that client's old backups to be browsable +This will still allow the client's old backups to be browsable and restorable. To completely remove a client and all its backups, you should remove its @@ -1498,7 +1514,7 @@ stop BackupPC so that the store is static. =item * copy the cpool, conf and log directory trees using any technique -(like cp, rsync or tar) wihtout the need to preserve hardlinks. +(like cp, rsync or tar) without the need to preserve hardlinks. =item * @@ -1804,7 +1820,7 @@ user. =head2 RSS BackupPC supports a very basic RSS feed. Provided you have the -XML::RSS perl module installed, a URL simular to this will +XML::RSS perl module installed, a URL similar to this will provide RSS information: http://localhost/cgi-bin/BackupPC/BackupPC_Admin?action=rss @@ -2111,8 +2127,6 @@ last email was sent. Should not be edited. All of BackupPC's data (PC backup images, logs, configuration information) is stored below this directory. -=back - Below __TOPDIR__ are several directories: =over 4 @@ -2448,6 +2462,8 @@ Error message if archive failed. =back +=back + =head2 Compressed file format The compressed file format is as generated by Compress::Zlib::deflate @@ -2649,7 +2665,8 @@ since it saves attribute meta-data separate from the files. Since BackupPC mostly does reads from disk, maintaining the access time of files generates a lot of unnecessary disk writes. So, provided BackupPC has a dedicated data disk, you should consider mounting -BackupPC's data directory with the noatime attribute (see mount(1)). +BackupPC's data directory with the noatime (or, with Linux kernels +>=2.6.20, relatime) attribute (see mount(1)). =head2 Limitations @@ -2793,7 +2810,7 @@ Youlin Feng provided the Chinese translation for 3.1.0. Jeremy Tietsort provided the host summary table sorting feature for 3.1.0. Many people have reported bugs, made useful suggestions and helped -with testing; see the ChangeLog and the mail lists. +with testing; see the ChangeLog and the mailing lists. Your name could appear here in the next version! diff --git a/lib/BackupPC/CGI/EditConfig.pm b/lib/BackupPC/CGI/EditConfig.pm index aa48bf9..0be716a 100644 --- a/lib/BackupPC/CGI/EditConfig.pm +++ b/lib/BackupPC/CGI/EditConfig.pm @@ -725,9 +725,14 @@ EOF ($mesg, my $hostChange) = hostsDiffMesg($hostsNew); $bpc->HostInfoWrite($hostsNew) if ( $hostChange ); foreach my $host ( keys(%$copyConf) ) { - my $confData = $bpc->ConfigDataRead($copyConf->{$host}); + # + # Currently host names are forced to lc when they + # are read from the hosts file. Therefore we need + # to force the from and to hosts to lc. + # + my $confData = $bpc->ConfigDataRead(lc($copyConf->{$host})); my $fromHost = $copyConf->{$host}; - $err .= $bpc->ConfigDataWrite($host, $confData); + $err .= $bpc->ConfigDataWrite(lc($host), $confData); $mesg .= eval("qq($Lang->{CfgEdit_Log_Copy_host_config})"); } diff --git a/lib/BackupPC/CGI/Summary.pm b/lib/BackupPC/CGI/Summary.pm index 628db70..f818fdf 100644 --- a/lib/BackupPC/CGI/Summary.pm +++ b/lib/BackupPC/CGI/Summary.pm @@ -136,18 +136,18 @@ sub action } $str = < ${HostLink($host)} +${HostLink($host)} ${UserLink(defined($Hosts->{$host}) ? $Hosts->{$host}{user} : "")} - $fullCnt - $fullAge - $fullSize - $fullRate - $incrCnt - $incrAge - $lastAge - $Lang->{$tempState} - $Lang->{$tempReason}$shortErr + $fullCnt + $fullAge + $fullSize + $fullRate + $incrCnt + $incrAge + $lastAge + $Lang->{$tempState} + $Lang->{$tempReason}$shortErr EOF if ( @Backups == 0 ) { $hostCntNone++; diff --git a/lib/BackupPC/Xfer/Tar.pm b/lib/BackupPC/Xfer/Tar.pm index ab44a74..79d05a8 100644 --- a/lib/BackupPC/Xfer/Tar.pm +++ b/lib/BackupPC/Xfer/Tar.pm @@ -101,8 +101,7 @@ sub start if ( defined($conf->{BackupFilesExclude}{$t->{shareName}}) ) { foreach my $file ( @{$conf->{BackupFilesExclude}{$t->{shareName}}} ) { - $file = $2 if ( $file =~ m{^(\./+|/+)(.*)}s ); - $file = "./$file"; + $file = "./$2" if ( $file =~ m{^(\./+|/+)(.*)}s ); $file = encode($conf->{ClientCharset}, $file) if ( $conf->{ClientCharset} ne "" ); push(@fileList, "--exclude=$file");