Message dated Friday, 11 Oct 191996, 6:48pm EDT
                   from "[EMAIL PROTECTED] (W. Phillip Moore)"

> all of your fileserver, then your could in thoery build a complete
> mount point database from the SalvageLog files.

Here's the script I use.  Note it requires perl version 5 and that you are
authenticated as a member of UserList.  You could always change the 'bos
getlog' call to read from a file if you copy the SalvageLog somewhere.

Be sure to change pdx.intel.com to the name of your cell


#!/usr/intel/bin/perl

use subs 'showLevel';
use strict 'refs';

;# @servers should be the names of your AFS 
;# fileservers.  Build it however you want.

for (1..8) { push @servers, "pdxafs0$_" }

foreach $s (@servers) {
    open LOG, "bos getlog $s SalvageLog|" or die "Can't read SalvageLog for $s: $!\n";
    
    while (<LOG>) {
        next unless / In volume \d+ \((.+)\) found mountpoint ..(\S+) to ..(.+)\'/;
        
        ($name, $path, $mountedVol) = ($1, $2, $3);

        chop $mountedVol;
        
        next if $mountedVol =~ /\.backup$/o;

        # If the -cell argument is given to fs mkm, then the volume name will
        # have the cell prepended.  Take it off.  Once it's off, skip any volume
        # that still has one, as it's a mount to another cell, and they should
        # be backing that volume up, not us.

        $mountedVol =~ s/^pdx.intel.com://;
        next if $mountedVol =~ /^[\-\w\.]+:/;
        
        $exists{$mountedVol}++;
        push @{$blah{$name}}, [$path, $mountedVol];
    }
    
    close LOG;
}

sub showLevel {
    my($path, $volume) = @_;
    
    for (@{$blah{$volume}}) {
        ($subdir, $vol) = @$_;
        
        print "$path/$subdir  $vol\n" unless $path =~ m@/afs/\.@;
        
        showLevel "$path/$subdir", $vol if exists $blah{$vol};
    }
}

showLevel '/afs', 'root.afs';

Reply via email to