Hey Brian,

No no noooo..... don't do it! ;-)
Please see attached gizmo you might find useful.
-- 
paul                             http://acm.org/~mpb

Jim Rowan <[EMAIL PROTECTED]> wrote:
>
>Does anyone have a gizmo to wander through the vldb and filesystem to map
>volumes and mountpoints?  (either AFS or DFS would be useful)
>
>I'm currently worrying about making sure that all the volumes that exist have 
>mountpoints.  [The sad part of the story is that we're decommissioning an AFS 
>cell, and moving the data elsewhere... most likely an NFS server.  Thus, we
>need to ensure that everything's visible via the filesystem.]
>
>
>Jim Rowan                      DCSI            DCE/DFS/Sysadmin Consulting
>[EMAIL PROTECTED]                                            (512) 374-1143

                                                        o /
---gizmo attachment follows---   ---- snipetty snip ---- x  ----
                                                        O \

#!/usr/local/bin/perl
#
# %W% (hursley) %G%
# %P%
#
# NAME          afsmounts
# AUTHOR        Bradley White [EMAIL PROTECTED]
# PURPOSE       Display AFS volume names and mountpoints
# USAGE         afsmounts /afs/$afscell

sub descend {
        local($dir) = @_;
        local(@names);

        return warn "$dir: $!\n" unless opendir(DIR, $dir);
        @names = readdir(DIR);
        closedir(DIR);
        for (@names) {
                &doname($dir . "/" . $_) unless $_ eq "." || $_ eq "..";
        }
        return $dir;
}

sub doname {
        local($name) = @_;
        local($dev, $ino, $vol);

        return warn "$name: $!\n" unless ($dev, $ino) = lstat($name);
        return &descend($name) if $ino & 1;
        return $name if -l $name || ! -d _;
        $vol = `fs lsmount $name`;
        die unless $vol =~ s/.*mount point for volume '(.*)'\n$/\1/;
        printf "%-${volwidth}s %s\n", $vol, $name;
        return $name if $vol =~ /.*\.backup$/;
        return &descend($name);
}

$volwidth = 24;

printf "%-${volwidth}s %s\n", "Volume Name", "Mounted-on";

foreach (@ARGV ? @ARGV : (".")) {
        s#(.)/+$#\1#;
        $msg = `fs examine $_ 2>&1`;
        $msg =~ s/fs:\s*//, warn($msg), next unless $? == 0;
        &doname($_);
}

exit 0

Reply via email to