Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

VolumeManagerHelp.pl

by JSchmitz (Canon)
on Nov 15, 2004 at 18:23 UTC ( [id://407896]=sourcecode: print w/replies, xml ) Need Help??
Category: Utility
Author/Contact Info JefferySchmitz@mac.com
Description: Makes Veritas Volume Manager tasks quick and easy
#!/usr/bin/perl -w


#####                                                                 
+                  #####
#####   Variables, Path, and Etc...                                   
+                  #####
#####                                                                 
+                  #####

$vxass = "/usr/sbin/vxassist";
$vxdg = "/usr/sbin/vxdg";
$vxdisk ="/usr/sbin/vxdisk";

system("clear");

####    Will give you options to choose from for veritas commands     
+                  #####

print "This is a simple script which will create a volume.\n";
print "         SELECT YOUR CHOICE      \n\n";
print "1.       Create a volume. \n";
print "2.        Make Filesystem. \n";
print "3.        Make Disk Group. \n";
print "4.        Resizing a Volume. \n";

print "\nSelection:      ";
chomp($choosen=<STDIN>);

#####                   Creates A Volume                              
+                  #####

if($choosen == 1){ print "We will begin Creating a Volume\n";
        system("vxdg list");
        print "\nWhat is the name of the Disk Group you would like to 
+add the volume too? \n";
        chomp($dg = <STDIN>);
        print "What do you want the volume to be named?\n";
        chomp($vol = <STDIN>);
        print "How big would you like your volume to be? ex. 100m, 200
+g \n";
        chomp($size = <STDIN>);
        print "What disk will you be using? \n";
        system("$vxdisk -g $dg list | awk '{print $3}'");
        print "\n\nWhich devices will you be using? \n";
        chomp($disks = <STDIN>);
        print "Will be creating this volume $vol in this Disk G. $dg a
+t this size $size \n";
        print "Would you like to continue?(y or n): ";
        chomp($y = <STDIN>);
                if($y eq "y"){
                system("$vxass -g $dg make $vol $size $disks");
                }else{
                exit;
                }

#####                   Creates A Filesystem                          
+                  #####

}elsif($choosen == 2){ print "We will begin Creating a filesystem\n";
        print "What is the name of the volume? \n";
        chomp($vol = <STDIN>);
        print "What is the name of the Disk Group? \n";
        chomp($dg = <STDIN>);
        print "Would you like it to be ufs or vxfs?\n";
        chomp($vxfs = <STDIN>);
                if ($vxfs eq "vxfs"){ print "you will be creating a vx
+fs filesystem /dev/vx/rdsk/$dg/$vol... \n";
                system("mkfs -F vxfs -o largefiles /dev/vx/rdsk/$dg/$v
+ol");
                }elsif($vxfs eq "ufs"){ print "you will be creating a 
+ufs filesystem /dev/vx/rdsk/$dg/$vol... \n";
                system("newfs ufs -o largefiles /dev/vx/rdsk/$dg/$vol"
+);
                }else{
                exit;
                }

#####                   Creates A New Disk Group                      
+                  #####

}elsif($choosen == 3){print "This will Create a new disk group \n\n\n"
+;
        print "What will be the name of the Disk Group\n";
        chomp($dg = <STDIN>);
        print "Which disk would you like to add?\n";
        system("vxdisk list | grep online | grep -");
        print "\nPut in the ctd that you would like to use\n";
        chomp($disk = <STDIN>);
        print "Beginning to Create Disk Group $dg\n";
        system("vxdg init $dg $disk");

#####                   Will Resize A Volume                          
+                  #####

}elsif($choosen == 4){print "This will resize a volume.\n";
        print "What is the name of the Volume? \n";
        chomp($vol = <STDIN>);
        print "What is the name of the disk group that the volume belo
+ngs to?\n";
        chomp($dg = <STDIN>);
        print "\n";
        system("$vxass -g $dg maxgrow $vol");
        print "how much would you like to grow it by? (100m, 2g)\n";
        chomp($grow = <STDIN>);
        print "Are you sure you want to continue?(y or n)\n";
        chomp($y = <STDIN>);
                if($y eq "y"){
                print "The filesystem will not be grown if it is 100% 
+full";
                system("$vxass -g $dg growby $vol $size");
                }else{ print "exiting....\n";
                exit
                }


        #open(VFSTAB, "/etc/vfstab");
        #       while (<VFSTAB>){
        #               print if /\bvx\b/;
        #       }


#####                   Exits The Script                              
+                  #####

}elsif($choosen gt 4){
        print "This option isnt available. \n\n\n";
}

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: sourcecode [id://407896]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-04-23 08:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found