#!/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=); ##### 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 = ); print "What do you want the volume to be named?\n"; chomp($vol = ); print "How big would you like your volume to be? ex. 100m, 200g \n"; chomp($size = ); 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 = ); print "Will be creating this volume $vol in this Disk G. $dg at this size $size \n"; print "Would you like to continue?(y or n): "; chomp($y = ); 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 = ); print "What is the name of the Disk Group? \n"; chomp($dg = ); print "Would you like it to be ufs or vxfs?\n"; chomp($vxfs = ); if ($vxfs eq "vxfs"){ print "you will be creating a vxfs filesystem /dev/vx/rdsk/$dg/$vol... \n"; system("mkfs -F vxfs -o largefiles /dev/vx/rdsk/$dg/$vol"); }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 = ); 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 = ); 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 = ); print "What is the name of the disk group that the volume belongs to?\n"; chomp($dg = ); print "\n"; system("$vxass -g $dg maxgrow $vol"); print "how much would you like to grow it by? (100m, 2g)\n"; chomp($grow = ); print "Are you sure you want to continue?(y or n)\n"; chomp($y = ); 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 (){ # print if /\bvx\b/; # } ##### Exits The Script ##### }elsif($choosen gt 4){ print "This option isnt available. \n\n\n"; }