AIX Shell script to create FS ?
 
*
Welcome, Guest. Please login or register. January 08, 2009, 10:58:36 PM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: AIX Shell script to create FS ?  (Read 2162 times)
0 Members and 1 Guest are viewing this topic.
Michael
Administrator
Hero Member
*****
Posts: 539


« Reply #12 on: September 24, 2007, 09:08:21 AM »

You can also put filesystems into groups. The option is -u while creating the filesystem; the option is -t for mount and umount.

Thus:
crfs .... -u power ....

and later, rather than one at a time:

mount -t power

umount -t power
Logged
kavishshetty
Full Member
***
Posts: 16


« Reply #11 on: September 24, 2007, 07:35:40 AM »

Hi Peter/Michael ...

Thanks for your interest on this ...

Based on all the comments i have conjured up a script that creates LVM on a hdispower device ( MPIO capable device ) . The script greps for a Power Device which can as well be a hdisk Device for general users.

Also i have used a command called syminq which may not be usefull for many people ... It is used only if a symmetrix DMX is connected to your AIX box .


Had problems attaching the script ,,, hence inserting Sad
################################################################################################

#!/bin/ksh

Create_VG () {
Counter=0

for i in `lspv | grep power | awk '{print $1}'` ; do           #  List power devices

        syminq | grep GK | grep power | grep $i >> /dev/null    # Remove Symm Gatekeeper devices
        if [ $? = 0 ]
        then
        echo "$i is a GK device, Cannot create LVM on a GK device"
        Counter=`expr $Counter + 1`
        else

        chdev -l $i -a pv=clear >/dev/tty                       # Clearing PV Attributes

        mkvg -fy vg$Counter $i  >> /dev/null 2>&1
        echo "Volume Group vg$Counter created"

        mklv -y test$Counter -t jfs vg$Counter 16 >> /dev/null 2>&1

        echo "Logical Volume test$Counter created"

        crfs -v jfs -d test$Counter -m /power$Counter >> /dev/null 2>&1

        mount -f /dev/test$Counter /power$Counter

        echo "Logical Volume /dev/test$Counter mounted on /power$Counter "

        Counter=`expr $Counter + 1`
        fi
done
}

lspv | grep power | grep active     # List active Volume Groups on Power Devices

if [ $? -eq 0 ]
then
        echo "Active LVM Found"
        echo "Umounting all the LVM/Power devices"
        mount | grep power | awk '{print $2}' | xargs -n1 umount
        echo "Removing the Associated FileSystem"
        lsfs | grep power | awk '{print $3}' | xargs -n1 rmfs -r >> /dev/null 2>&1
        vg_count=`lspv | grep power | grep -c active`
        h_count=1
while [ $vg_count != 0 ]
do
        echo "Turning off the active VG$vg_count and Exporting them"
        vg=`lspv | grep power | grep active | head -$h_count | tail -1| awk '{print $3}'`
        varyoffvg $vg
        exportvg $vg
        pvid_clr=`lspv | grep power | head -$h_count | tail -1 | awk '{print $1}'`
        chdev -l $pvid_clr -a pv=clear
        h_count=`expr $h_count + 1`
        vg_count=`expr $vg_count - 1`
done
        Create_VG

else
        Create_VG
fi
################################################################################################


Please feel free to get back for ny queries..

Thanks
Kavish

Logged
pprevoo
New Member
*
Posts: 2


« Reply #10 on: September 21, 2007, 10:41:27 AM »

Hello Kavish,

Are you still looking for a script to automate the creation of hpowerdisks, vg's, lv's and fs's? I could make a little script for you doing this. But I do need to know a few things.

1. Should the script discover all the lun's an all HBA's first?

2. Should the script create powerdisks (powermt config)

3. Do you want all not used powerdisks to be used ?

4. How many lun's do you want per vg?

5. How many FS's do you want per vg?

6. jfs or jf2 ?

7. what should the base path be?

Regards,

Patrick Prevoo
Logged
Michael
Administrator
Hero Member
*****
Posts: 539


« Reply #9 on: September 10, 2007, 03:21:02 PM »

I think everyone will be quite interested in MPIO i/o tests.

So, in advance: thanks for the input!
Logged
kavishshetty
Full Member
***
Posts: 16


« Reply #8 on: September 10, 2007, 12:46:44 PM »

Thanks Michael ...
Appreciate the time taken for replying my post ....

Will keep you posted with the progress i have made

Logged
Michael
Administrator
Hero Member
*****
Posts: 539


« Reply #7 on: September 10, 2007, 06:56:40 AM »

Ok.

Well, as you are comfortable with the CLI interface to creating volume groups, logical volumes, and file systems I'll just list the steps I would take to get the job done.

There are three basic processes, maybe four (I'll let you decide):
1. Discovery
2. Build environment
3. Test
4. Cleanup

Discovery: identify disks that are a) not in a volume group already (e.g. lspv | grep xxxx (None I believe); b) verify the disk is multipath (lspath)

Build: decide how many disks are to be in the volume group (1 or more) and build volume group, logical volumes, and create logical volumes

Test: using the logical volumes create both jfs and jfs2 file systems (in seperate runs, so build will need to be repeated (see below)

Cleanup: if first run (e.g. jfs file systems) remove file systems, and rerun Build, and retest using jfs2 file systems (perhaps a third pass on logical volumes (block device) and/or so called raw logical volumes (character device). If last pass, remove volume group definition.

Just a suggestion. I am working very hard on some experiments with WPAR - if you need more help just let us know how far you are. I am sure there are many who will help.
Logged
kavishshetty
Full Member
***
Posts: 16


« Reply #6 on: September 10, 2007, 06:22:27 AM »

The case is actually to test the I/O behaviour in an MPIO framework....

I dont really understand by what you mean by a benchmark .... But it is to verify the SAN performance through heavy read/write I/O's..

But the means for my testing is to check an application that gives multipathing, loadbalancing and failover to hdisk devices(LUNS) ..

And yes .. once the filesystems are created ... and my testing is done ... it would be removed ..

Hope this answers your questions

Thanks for your interest in this
« Last Edit: September 10, 2007, 06:54:33 AM by kavishshetty » Logged
Michael
Administrator
Hero Member
*****
Posts: 539


« Reply #5 on: September 07, 2007, 01:20:11 PM »

OK, I understand a bit better now.

Are these file systems that are going to be created just to do a benchmark, so to speak, and then be thrown away? I have a number of ideas running thru my head (and I may not get anything "finished" today - and tomorrow is weekend Smiley.

One basic question: if it is to verify SAN performance/configuration, etc. do you already have a benchmark that you run? If so, I can just specify a line like "call benchmark" in a template for a script.

And if you care to share such a benchmark, I am sure there are many besides myself who would interested in what you test.
Logged
kavishshetty
Full Member
***
Posts: 16


« Reply #4 on: September 07, 2007, 10:50:11 AM »

Smiley thanks for the reply michael...

I am very much comfortable in creating VG,LV and fs thru the CLI mode..

But my question was to automate the process with a shell script .....

for eg: i may have hundred LUNS which the host see's as a hdisk device and may have the need to create FS on each one to check the I/O transfer .... but creating it on all the LUNS would be monotonous 



Logged
Michael
Administrator
Hero Member
*****
Posts: 539


« Reply #3 on: September 06, 2007, 02:59:47 PM »

The manual pages you want to read are: mkvg, mklv and crfs.

The basic options for mkvg are:
 -y # to name the volume group
 -t # to set # of PP max per volume, and effect minimum PP size
 -V # set a major device/volume group number (important in HACMP/NFS)

The basic options for mklv are:
 -y # set name of logical volume
 -t jfs2 # should you want jfs2, jfs is default
 vgName # whatever name you gave it above
 XXXG # or M, or just a count of PP to set the size

Since you are using jfs you must make a jfslog:
mklv -y lgXXX -t jfslog vgXXX 1
yes | logform /dev/lgXXX



For crfs I have always used smitty (smit crfs). Too many arguments to remember Smiley Note: for jfs2 filesystems, I recommend the smit fastpath
# smit jfs2
Logged
kavishshetty
Full Member
***
Posts: 16


« Reply #2 on: September 06, 2007, 12:37:06 PM »

jfs fs is what i am looking at ..

checking out if it possible with the smit.script ..

Thanks MIchael
Logged
Michael
Administrator
Hero Member
*****
Posts: 539


« Reply #1 on: September 05, 2007, 05:01:56 PM »

You can use smit -x to create a $HOME/smit.script for each of these items. Maybe someone has a boiler plate script.

Only real question: jfs or jfs2 file systems?
Logged
kavishshetty
Full Member
***
Posts: 16


« on: September 05, 2007, 01:24:39 PM »

Hi,

I am running powerpath on my AIX host connected to EMC devices

Can anybody provide me a script that can create a vg , lv and fs dynamically to all the hdisk devices ??

Appreciate any help regarding this

-Kavish
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.934 seconds with 19 queries.




eXTReMe Tracker

Terms of Use and Privacy and Security Policies
Copyright 2001-2008 Michael Felt and ROOTVG.NET