#!/usr/bin/perl # # FSInfo v0.1 written 061306:1135 by BJP # # FSInfo will dump useful information about LVM structure of a given f +ilesystem. # # Usage: fsinfo <mountpoint> # Example: fsinfo /tmp # main(); sub usage() { print "\n Usage: fsinfo <mountpoint>\n"; print " Example: fsinfo /tmp\n\n"; exit(); } sub sanityCheck() { if($#ARGV<0 || $#ARGV>0) ## Hee haw! { usage(); } else { $targetFS=$ARGV[0]; } ## OS level check.. @unameDump=split(/\s+/,`uname -a`); if ($unameDump[3]<5) { print "fsinfo only works in AIX 5L or later.\n"; usage(); } ## Check to see if the filesystem actually exists... @dfContents=split(/\s+/,`df -m | grep " $targetFS\$"`); if(length($targetFS)==length($dfContents[6])) { print "\nFSInfo: Starting up..\nFSInfo:\n"; } else { print "\nFSInfo: Ack! Can't find the filesystem you specified ($ta +rgetFS)..! Exiting.\n\n"; exit(); } } sub main() { sanityCheck(); ## So far so good. Pull up the VG info for this filesystem.. $dfContents[0]=~/\/dev\//; $targetLV=$'; @lslvContents=split(/\s+/,`lslv $targetLV|head -n1` ); $targetVG=$lslvContents[5]; print "FSInfo: Filesystem \"$targetFS\" belongs to logical volume $t +argetLV which sits inside $targetVG. Details shown below.\n"; @vgdump=`lsvg -L $targetVG`; @lvdump=`lslv -L $targetLV`; ## Dump it all out... print "FSInfo:\nFSInfo: Volume Group information for $targetFS..\n"; print "FSInfo:\n"; foreach $line (@vgdump) { print "FSInfo: $line"; } print "FSInfo:\nFSInfo: Logical Volume information for $targetFS..\n +"; print "FSInfo:\n"; foreach $line (@lvdump) { print "FSInfo: $line"; } print "FSInfo:\nFSInfo: Spinning down..\n\n"; }

In reply to FSInfo by bpoag

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.