Operating System - HP-UX
1753702 Members
4875 Online
108799 Solutions
New Discussion

REquired script for creating Mount Point

 
Vishal_1980
Regular Advisor

REquired script for creating Mount Point

Dear Expert:

 

i was assigned 5 luns from the storage team. And i want to create the mount points for the same.

As we are testing the thigs in the devlopment servers, frequently we require to create the mountpoints for the testing purposes ( the count is 60 to 70 / day).In that concern , if i get one script wihch will creat the PV ,create the dir fot the VG ,the device file from the mknod command ,create the VG ,LV ,file system & also mount the file system on the respective mounts wichi will creat an entry in te /etc/fstab file.

I was asking this cause daily we have to do this on the regular basis ,wonderign if we can do this through script automation.

Request you to please help me out .

 

Below are the details :

 

 

       LUN                                             Mount

 

1)/dev/rdisk/disk10 :    /oracle/DIT/sapdata1

2) /dev/rdisk/disk11:   /oracle/DIT/sapdata2

3)/dev/rdisk/disk12 :   /oracle/DIT/sapdata3

4)/dev/rdisk/disk13:   /oraclle/DIT/sapdata4

5)/dev/rdisk/disk14:  /oracle/DIT/sapdata5

 

 

Request you to please suggest on this.

 

Thanks & have a great day ahead.

Regards,

Vishal

6 REPLIES 6
Bill Hassell
Honored Contributor

Re: REquired script for creating Mount Point

There isn't enough detail.

Do you want 1 LUN in 1 VG with 1 mountpoint?

Or multiple LUNs in several VGs with several mountpoints?

Should the script be configurable on the command line (ie, VGname or VGcount, LUN list, lvol list and mounpoint list?

Should the script also remove mountpoints and VGs?

 

Need a lot more information...



Bill Hassell, sysadmin
Vishal_1980
Regular Advisor

Re: REquired script for creating Mount Point

Hello Billsir,

 

Sorry that i didnt provide the details.Please find the below details for your reference.

 

1)Do you want 1 LUN in 1 VG with 1 mountpoint? Yes it should be 1 lun for 1 mountpoint.

 

2)Should the script be configurable on the command line (ie, VGname or VGcount, LUN list, lvol list and mounpoint list? -Yes

 

3) hould the script also remove mountpoints and VGs? -No as we have no fix time or duration whent the R&D guys will finifh their testing ,once we recieve the mail accordingly we have to remove it.

 

Please suggest me if i need to provide any additional information.

 

Thanks ,

Vishal

 

Vishal_1980
Regular Advisor

Re: REquired script for creating Mount Point

Dear expert ,

Waiting for you reply.....

With regards,
Vishal
Vishal_1980
Regular Advisor

Re: REquired script for creating Mount Point

Hello expert,

Please provide me the solution on this.As this was the urgent requirement.Help will be much more appreciable.

Thanks & regards,
Vishal
Bill Hassell
Honored Contributor

Re: REquired script for creating Mount Point

Here is the script.

 

   Usage: makevg.sh [-q] [-x] VGname LVOLname MNTpoint PVname [ more PVnames ]

   where: -q = quiet mode - default is to echo each command
          -x = run the commands - default is preview only
          VGname = name of VG (ie, vg03, vgora4, etc)
          LVOLname = lvol name (ie, lvol1, mylvol32, etc)
          MNTpoint = mount point name (ie, /test1, /mytestlvol, etc)
          PVname = physical volume or LUN (ie, /dev/disk/disk23, /dev/dsk/c2t3d0, etc)
                   more PVs can be added to the end of the list

makevg.sh will create a VG with one lvol and mount it to the name mountpoint. It will
use the PVs or LUNs specified. It will also add the lvol and mounpoint to /etc/fstab.
The default is preview only. Add -x to run the commands.

 So a typical run (with no options) looks like this:

 

# makevg.sh vg19 lvol99 /mnt2a /dev/rdsk/c17t15d0

makevg.sh
 verbose = true
 preview = true
    VGname   = vg19
    LVname   = lvol99
    MNTpoint = /mnt2a
    PVnames  = /dev/rdsk/c17t15d

Commands (preview):
    pvcreate -f /dev/rdsk/c17t15d0
    mkdir /dev/vg19
    mknod /dev/vg19/group c 64 0x010000
    vgcreate -s 8 vg19  /dev/dsk/c17t15d0
    vgchange -a y vg19
    lvcreate -l (preview) -n lvol99 vg19
    newfs -F vxfs -o largefiles /dev/vg19/rlvol99
    mkdir -p /mnt2a
    echo /dev/vg19/lvol99 /mnt2a vxfs delaylog 0 3 >> /etc/fstab
    mount /dev/vg19/lvol99 /mnt2a

makevg.sh done.

 Without the -x option, you get a preview of all the commands that will be run.

 

This will handle any size disk LUN or optionally, multiple LUNs. The lvol will be as large as the entire VG.

 

 

 

 

 

 

Just a note about the Community Forums.  All of us are answering questions in our spare time. An urgent request should not be posted here but instead, you should hire a consultant to complete the task.  We all have regular jobs and answer questions when time permits. This script could have been less than 20 lines of code with no error checking, but you probably don't have trained staff that will be very careful not to erase active disk LUNs due to a spelling error (or other mistakes). So this script has extensive error checking and reporting, including the preview mode where you can see what is being done. It is well documented and hopefully you  and your staff will learn some scripting techniques from the code.



Bill Hassell, sysadmin
Vishal_1980
Regular Advisor

Re: REquired script for creating Mount Point

Dear Bill sir,

Thanks for the help provided by you.
Yes next time i will be cautious while posting any comments.
Sorry for the indiscipline by me.

Thanks & have a great day ahead.
Regards
Vishal