This small patch shows the percentage of used inodes on the server
status page. This is not usually something to worry about, especially on
modern filesystems that dynamically allocate inodes, but I happened to
have many backups with lots of small files on an ext3 partition that I
originally created with "-T largefile" and it eventually ran out of
inodes. It doesn't hurt to keep an eye on it; maybe, if you find this
unnecessary in general use, it could only be shown if the percentage of
used inodes goes above 50%, because that means that you might just be
going to run out of them.

Attached also a small cosmetic patch that makes all units shown as "Age
(days)" rather than "Age/days".

Please CC me on replies, I'm not on the list.

Thanks for an otherwise wonderful and flawless backup tool!

-- 
Ciao, Flavio
diff -ur ./usr/share/backuppc/bin/BackupPC /usr/share/backuppc/bin/BackupPC
--- ./usr/share/backuppc/bin/BackupPC   2007-08-27 22:33:53.000000000 +0200
+++ /usr/share/backuppc/bin/BackupPC    2007-07-24 14:24:53.000000000 +0200
@@ -564,6 +564,7 @@
     my($req, $host);
     my(@deferUserQueue, @deferBgQueue);
     my $du;
+    my $duIno;
 
     if ( time - $Info{DUlastValueTime} >= 600 ) {
         #
@@ -571,23 +572,31 @@
         # once every 10 minutes
         #
         $du = $bpc->CheckFileSystemUsage($TopDir);
+        $duIno = $bpc->CheckFileSystemInodes($TopDir);
         $Info{DUlastValue}     = $du;
+        $Info{DUlastValueIno}  = $duIno;
         $Info{DUlastValueTime} = time;
     } else {
         #
         # if we recently checked it then just use the old value
         #
         $du = $Info{DUlastValue};
+        $duIno = $Info{DUlastValueIno};
     }
     if ( $Info{DUDailyMaxReset} ) {
         $Info{DUDailyMaxStartTime} = time;
         $Info{DUDailyMaxReset}     = 0;
         $Info{DUDailyMax}          = 0;
+        $Info{DUDailyMaxIno}       = 0;
     }
     if ( $du > $Info{DUDailyMax} ) {
         $Info{DUDailyMax}     = $du;
         $Info{DUDailyMaxTime} = time;
     }
+    if ( $duIno > $Info{DUDailyMaxIno} ) {
+        $Info{DUDailyMaxIno}  = $duIno;
+        # don't bother with max inode usage's time for now
+    }
     if ( $du > $Conf{DfMaxUsagePct} ) {
         my @bgQueue = @BgQueue;
         my $nSkip = 0;
diff -ur ./usr/share/backuppc/lib/BackupPC/CGI/EditConfig.pm 
/usr/share/backuppc/lib/BackupPC/CGI/EditConfig.pm
--- ./usr/share/backuppc/lib/BackupPC/CGI/EditConfig.pm 2007-08-27 
22:33:53.000000000 +0200
+++ /usr/share/backuppc/lib/BackupPC/CGI/EditConfig.pm  2007-07-24 
14:35:54.000000000 +0200
@@ -66,6 +66,7 @@
 
             {text => "CfgEdit_Title_Pool_Filesystem_Limits"},
            {name => "DfCmd"},
+           {name => "DfInoCmd"},
            {name => "DfMaxUsagePct"},
            {name => "HardLinkMax"},
 
diff -ur ./usr/share/backuppc/lib/BackupPC/Config/Meta.pm 
/usr/share/backuppc/lib/BackupPC/Config/Meta.pm
--- ./usr/share/backuppc/lib/BackupPC/Config/Meta.pm    2007-08-27 
22:33:53.000000000 +0200
+++ /usr/share/backuppc/lib/BackupPC/Config/Meta.pm     2007-07-24 
14:35:54.000000000 +0200
@@ -86,6 +86,7 @@
     PingPath           => {type => "execPath", undefIfEmpty => 1},
     DfPath             => {type => "execPath", undefIfEmpty => 1},
     DfCmd              => "string",
+    DfInoCmd           => "string",
     SplitPath          => {type => "execPath", undefIfEmpty => 1},
     ParPath            => {type => "execPath", undefIfEmpty => 1},
     CatPath            => {type => "execPath", undefIfEmpty => 1},
diff -ur ./usr/share/backuppc/lib/BackupPC/Lang/en.pm 
/usr/share/backuppc/lib/BackupPC/Lang/en.pm
--- ./usr/share/backuppc/lib/BackupPC/Lang/en.pm        2007-08-27 
22:33:53.000000000 +0200
+++ /usr/share/backuppc/lib/BackupPC/Lang/en.pm 2007-07-24 14:17:57.000000000 
+0200
@@ -79,6 +79,8 @@
         <li>Pool file system was recently at \$Info{DUlastValue}%
             (\$DUlastTime), today\'s max is \$Info{DUDailyMax}% (\$DUmaxTime)
             and yesterday\'s max was \$Info{DUDailyMaxPrev}%.
+        <li>Inode usage was recently at \$Info{DUlastValueIno}%,
+            today\'s max is \$Info{DUDailyMaxIno}%.
     </ul>
 </ul>
 EOF
diff -ur ./usr/share/backuppc/lib/BackupPC/Lib.pm 
/usr/share/backuppc/lib/BackupPC/Lib.pm
--- ./usr/share/backuppc/lib/BackupPC/Lib.pm    2007-08-27 22:33:53.000000000 
+0200
+++ /usr/share/backuppc/lib/BackupPC/Lib.pm     2007-07-24 14:40:49.000000000 
+0200
@@ -818,6 +818,23 @@
     return $1;
 }
 
+sub CheckFileSystemInodes
+{
+    my($bpc) = @_;
+    my($topDir) = $bpc->{TopDir};
+    my($s, $dfInoCmd);
+
+    return 0 if ( $bpc->{Conf}{DfInoCmd} eq "" );
+    my $args = {
+       dfPath   => $bpc->{Conf}{DfPath},
+       topDir   => $bpc->{TopDir},
+    };
+    $dfInoCmd = $bpc->cmdVarSubstitute($bpc->{Conf}{DfInoCmd}, $args);
+    $s = $bpc->cmdSystemOrEval($dfInoCmd, undef, $args);
+    return 0 if ( $? || $s !~ /(\d+)%/s );
+    return $1;
+}
+
 #
 # Given an IP address, return the host name and user name via
 # NetBios.
diff -ur etc/backuppc/config.pl /etc/backuppc/config.pl
--- etc/backuppc/config.pl      2007-08-27 22:33:53.000000000 +0200
+++ /etc/backuppc/config.pl     2007-09-27 11:19:28.000000000 +0200
@@ -215,6 +216,11 @@
 $Conf{DfCmd} = '$dfPath $topDir';
 
 #
+# Command to run df to get inodes.  Variables as above.
+#
+$Conf{DfInoCmd} = '$dfPath -i $topDir';
+
+#
 # Full path to various commands for archiving
 #
 $Conf{SplitPath} = '/usr/bin/split';
diff -ur ./usr/share/backuppc/lib/BackupPC/CGI/Summary.pm 
/usr/share/backuppc/lib/BackupPC/CGI/Summary.pm
--- ./usr/share/backuppc/lib/BackupPC/CGI/Summary.pm    2007-08-27 
22:33:53.000000000 +0200
+++ /usr/share/backuppc/lib/BackupPC/CGI/Summary.pm     2007-07-10 
16:54:46.000000000 +0200
@@ -147,7 +147,7 @@
     <td align="center" class="border"> $incrAge </td>
     <td align="center" class="border"> $lastAge </td> 
     <td align="center" class="border"> $Lang->{$tempState} </td>
-    <td class="border"> $Lang->{$tempReason}$shortErr </td></tr>
+    <td align="center" class="border"> $Lang->{$tempReason}$shortErr </td></tr>
 EOF
         if ( @Backups == 0 ) {
             $hostCntNone++;
diff -ur ./usr/share/backuppc/lib/BackupPC/Lang/en.pm 
/usr/share/backuppc/lib/BackupPC/Lang/en.pm
--- ./usr/share/backuppc/lib/BackupPC/Lang/en.pm        2007-08-27 
22:33:53.000000000 +0200
+++ /usr/share/backuppc/lib/BackupPC/Lang/en.pm 2007-07-24 14:17:57.000000000 
+0200
@@ -165,7 +168,7 @@
     <td align="center"> Full Size (GB) </td>
     <td align="center"> Speed (MB/s) </td>
     <td align="center"> #Incr </td>
-    <td align="center"> Incr Age/days </td>
+    <td align="center"> Incr Age (days) </td>
     <td align="center"> Last Backup (days) </td>
     <td align="center"> State </td>
     <td align="center"> Last attempt </td></tr>
@@ -653,8 +656,8 @@
     <td align="center"> Filled </td>
     <td align="center"> Level </td>
     <td align="center"> Start Date </td>
-    <td align="center"> Duration/mins </td>
-    <td align="center"> Age/days </td>
+    <td align="center"> Duration (mins) </td>
+    <td align="center"> Age (days) </td>
     <td align="center"> Server Backup Path </td>
 </tr>
 \$str
@@ -1163,7 +1166,7 @@
 <tr class="tableheader"><td align="center"> Restore# </td>
     <td align="center"> Result </td>
     <td align="right"> Start Date</td>
-    <td align="right"> Dur/mins</td>
+    <td align="right"> Dur (mins)</td>
     <td align="right"> #files </td>
     <td align="right"> MB </td>
     <td align="right"> #tar errs </td>
@@ -1182,7 +1185,7 @@
 <tr class="tableheader"><td align="center"> Archive# </td>
     <td align="center"> Result </td>
     <td align="right"> Start Date</td>
-    <td align="right"> Dur/mins</td>
+    <td align="right"> Dur (mins)</td>
 </tr>
 \$ArchiveStr
 </table>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
BackupPC-devel mailing list
BackupPC-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/backuppc-devel
http://backuppc.sourceforge.net/

Reply via email to