• HPUX LVM Cheat Sheet

    Scan for Disks

    Run the command below to scan for disks.

    ioscan -fnC disk

    Make your physical volume

    This is the first step in the creation of a physical volume.

    pvcreate -f /dev/rdsk/c0t1d0

    Create the device structure using mknod

    Mknon creates a FIFO, character special file, or block special file with the
    specified name. You will need to do this when you are creating a volume group.

                  cd /dev
                  mkdir vgdata
                  cd vgdata
                  mknod group c 64 0x010000

    What is above is only an example, your minor number will vary by machine.

         mknod [options]... NAME Type [Major Minor]

    Create volume group

    Using vgcreate,you need to create you volume group and list all the disks
    that are to make up this volume group. In the example below we are creating a
    volume group called vgdata.

                    vgcreate vgdata  /dev/dsk/c0t1d0

    Below is an example from one of the DCA boxes:

                     vgcreate /dev/vgapcj06 /dev/dsk/c7t2d2 /dev/dsk/c7t2d3 /dev/dsk/c7t2d4

    Once created use vgdisplay to display information pertaining to your new
    volume.

                     vgdisplay -v vg01
    updca003(root)#vgdisplay vgapcj06
    --- Volume groups ---
    VG Name                     /dev/vgapcj06
    VG Write Access             read/write
    VG Status                   available
    Max LV                      255
    Cur LV                      0
    Open LV                     0
    Max PV                      16
    Cur PV                      3
    Act PV                      3
    Max PE per PV               8690
    VGDA                        6
    PE Size (Mbytes)            4
    Total PE                    26067
    Alloc PE                    0
    Free PE                     26067
    Total PVG                   0
    Total Spare PVs             0
    Total Spare PVs in use      0

    Create a Logical Volume

    See the example below that was created with the -l option which used logical
    extents to determine the size for the logical volume

    updca003(root)#lvcreate -n ndata6 -l 26067 /dev/vgapcj06
    Logical volume "/dev/vgapcj06/ndata6" has been successfully created with
    character device "/dev/vgapcj06/rndata6".
    Logical volume "/dev/vgapcj06/ndata6" has been successfully extended.
    Volume Group configuration for /dev/vgapcj06 has been saved in /etc/lvmconf/vgapcj06.conf
    updca003(root)#lvdisplay /dev/vgapcj06/ndata6
    --- Logical volumes ---
    LV Name                     /dev/vgapcj06/ndata6
    VG Name                     /dev/vgapcj06
    LV Permission               read/write
    LV Status                   available/syncd
    Mirror copies               0
    Consistency Recovery        MWC
    Schedule                    parallel
    LV Size (Mbytes)            104268
    Current LE                  26067
    Allocated PE                26067
    Stripes                     0
    Stripe Size (Kbytes)        0
    Bad block                   on
    Allocation                  strict
    IO Timeout (Seconds)        default

    Make a filesystem

       updca003(root)#newfs /dev/vgapcj06/rndata6
       newfs: /etc/default/fs is used for determining the file system type
       version 4 layout
       106770432 sectors, 13346304 blocks of size 8192, log size 256 blocks
       unlimited inodes, largefiles not supported
       13346304 data blocks, 13345512 free data blocks
       408 allocation units of 32768 blocks, 32768 data blocks
       last allocation unit has 9728 data blocks

    Other LVM Commands for HPUX

    Export disk group

    • vgexport /dev/disgroup

    this deactivates the diskgroup

    • vgchange -a n <diskgroup>

    this activates a diskgroup

    • vgchange -a y <diskgroup>

    Grow a logical volume

    • lvextend
  • Solaris HBA Notes

    Below is a cheat sheet that I put together of commands that are helpful for managing HBAs on Solaris.

    Helpful Commands

    • luxadm probe
    • luxadm -e port
    • devfsadm

    More Helpful Commands

    • To show Sun/Qlogic HBA’s:

    luxadm qlgc

    • To show all vendor HBA’s — see sample output below:

    luxadm fcode_download -p

    Found Path to 0 FC100/S Cards

    Complete

    Found Path to 5 FC100/P, ISP2200, ISP23xx Devices

    Opening Device: /devices/pci@9,600000/SUNW,qlc@2/fp@0,0:devctl

    Detected FCode Version:       ISP2200 FC-AL Host Adapter Driver: 1.14 01/11/20

    Opening Device: /devices/pci@8,700000/SUNW,qlc@5,1/fp@0,0:devctl

    Detected FCode Version:       ISP2312 Host Adapter Driver: 1.14.09 03/08/04

    Opening Device: /devices/pci@8,700000/SUNW,qlc@3,1/fp@0,0:devctl

    Detected FCode Version:       ISP2312 Host Adapter Driver: 1.14.09 03/08/04

    Opening Device: /devices/pci@8,700000/SUNW,qlc@3/fp@0,0:devctl

    Detected FCode Version:       ISP2312 Host Adapter Driver: 1.14.09 03/08/04

    Opening Device: /devices/pci@8,700000/SUNW,qlc@5/fp@0,0:devctl

    Detected FCode Version:       ISP2312 Host Adapter Driver: 1.14.09 03/08/04

    Complete

    • Another Method of doing the same thing as above:

    prtpicl -v > filename

    • To show link status of card:

    luxadm -e port

    • See WWNS:

    To see the WWN’s (using address given to you from previous commands), it is
    the last one that specifies it is a HBA, so the port WWN here is 210000e08b100d16

    # luxadm -e dump_map /devices/pci@1f,0/pci@1/SUNW,qlc@1/fp@0,0:devctl

    Pos Port_ID Hard_Addr Port WWN Node WWN Type

    0 10600 0 224100015d210900 220000015d210900 0x1f (Unknown Type)

    1 10700 0 210000e08b103417 200000e08b103417 0x1f (Unknown Type)

    2 10800 0 210000e08b100d16 200000e08b100d16 0x1f (Unknown Type,Host Bus Adapter

    Configuring storage online

    • List unconfigured disks

    cfgadm -al

    Ap_Id Type Receptacle Occupant Condition

    c0 scsi-bus connected configured unknown

    c0::dsk/c0t0d0 disk connected configured unknown

    c0::dsk/c0t2d0 CD-ROM connected configured unknown

    c1 fc-fabric connected unconfigured unknown

    c1::210000e08b103417 unknown connected unconfigured unknown

    c1::224100015d210900 unknown connected unconfigured unknown

    c2 fc-fabric connected unconfigured unknown

    c2::210100e08b303417 unknown connected unconfigured unknown

    c2::223100015d210900 unknown connected unconfigured unknown

    So we can see that c1 and c2 are both unconfigured disks, so we now run the command below to configure them.

    # cfgadm -f -c configure c1 c2

    You can now run devfsadm.

    Example cfgadm -al

    c1                             fc-private

    c1::21000020379cb9bb           disk         connected    configured   unknown

    c4                             fc-fabric    connected    unconfigured unknown

    c5                             fc           connected    unconfigured unknown

    C1 is a 280r internal controller
    C4 is a HBA attached to a switch with no targets
    C5 is a HBA that has nothing connected

    More Good Stuff

    1) The command cfgadm -al

    2) look for the fc-fabric

    c2                             fc-fabric    connected

    c3                             fc-fabric    connected

    3) and then cfgadm -cconfigure c2 c3

    4) Now you see the LUN

    A Magical File – Check it Out

    /kernel/drv/sd.conf

    Checking IO on Fibre Cards

    iostat -xcn 5

    San Foundation Kit

    You get this from Sun, install it after you install the drivers
    There is no SAN foundation kit for Solaris 10. Installing the SAN foundation
    kit will do bad things. It’s only for Solaris 8 and Solaris 9.

    Get the WWN

     Method 1:

     

    $ luxadm probe
    $ luxadm -e port

    $ luxadm -e dump_map <xyz> where xyz= your connected port.

    Method 2:

    bash-2.03# cat /var/adm/messages | grep -i WWN

    Sep 20 18:23:28 alautpnc003 qlc: [ID 657001 kern.info] Qlogic qlc(0) WWPN=210000e08b934ead : WWNN=200000e08b934ead

    Sep 20 18:23:39 alautpnc003 qlc: [ID 657001 kern.info] Qlogic qlc(1) WWPN=210100e08bb34ead : WWNN=200100e08bb34ead

    Method 3:

    #modinfo | grep SunFC

    46 10274e94 20010 172 1 fcp (SunFC FCP v20050926-1.86)

    47 10269923 8204 – 1 fctl (SunFC Transport v20050926-1.36)

    51 1028b850 15e28 171 1 fp (SunFC Port v20050926-1.53)

    53 10300f09 c5024 175 1 qlc (SunFC Qlogic FCA v20051013-2.08)

    Method 4:

    cfgadm -o show_FCP_dev -al

    Method 5:

    prtconf -pv | grep -i wwn | grep -i port

  • Modifying the Bootlist

    Below are instructions on how to modify and confirm your bootlist, which is the list of devices that your AIX system is going to try to boot from. Below is a list of quick and easy commands.

    • To specify the logical volume hd5 on disk hdisk0 for normal boot, typle
      • bootlist -m normal hdisk0 blv=hd5
    • To view the boot list that you set in the example above
      • bootlist -m normal -o      #where normal sepcifies normal boot

    • To specify booting in normal mode from the only boot logical volume on hdisk0, or the boot record hd5 on hdisk1, do the following
      • bootlist -m normal hdisk0 hdisk1 blv=mb_hd5
    • If you are dealing with a new disk you are going to need to initialize the boot block as well.
      • In this example you can see that the boot block on hdisk0 has not been initialized.
        • hdisk1 blv=hd5

          hdisk0

        • # bosboot -ad /dev/hdisk0 #use the bosboot command to initialize it.
        • Now all is well
          • # bootlist -m normal -o

            hdisk1 blv=hd5

            hdisk0 blv=hd5

                                               

     

    Below are some quick and dirty commands that maybe usefull.

    bootlist -m (normal or service) -o –
    displays bootlist
    bootlist -m (normal or service) (list of devices) – change bootlist
    bootinfo -b –
    Identifies the bootable disk
    bootinfo -t   –
    Specifies type of boot
    bosboot -a -d (/dev/pv) – Creates a complete
    boot image on a physical volume.
    mkboot -c -d (/dev/pv)       Zero’s out
    the boot records on the physical volume.
    savebase -d (/dev/pv)        Saves
    customised ODM info onto the boot device.

  • AIX bootdisk removal

    Need to replace a failed rootdisk in AIX? The post below outlines the procedure for removing a disk from a mirrored root volume.

    First take a look at what disks are in your rootvg.

    In the example below we have hdisk0 and hdisk1

     

    # lsvg -p rootvg
    rootvg:
    PV_NAME
    PV STATE          TOTAL
    PPs   FREE PPs    FREE DISTRIBUTION
    hdisk0
    active
    542         264
    109..00..00..46..109
    hdisk1
    active
    542         278
    88..00..00..81..109

     

     lsvg -l rootvg
    
     LV
     NAME
     TYPE       LPs   PPs
     PVs  LV STATE      MOUNT POINT
    
     hd5
     boot       1
     2     2    closed/syncd  N/A
    
    hd6
    
    paging     64    128
    
    2    open/syncd    N/A
    
    hd8
    
    jfslog     1     2
    
    2    open/syncd    N/A
    
    hd4
    
    jfs        6
    
    12    2    open/syncd
    
    /
    
    hd2
    
    jfs        127   254
    
    2    open/syncd    /usr
    
    hd9var
    
    jfs        4
    
    8     2    open/syncd
    
    /var
    
    hd3
    
    jfs        37
    
    74    2    open/syncd
    
    /tmp
    
    hd1
    
    jfs        3
    
    6     2    open/syncd
    
    /home
    
    hd10opt
    
    jfs        21
    
    42    2    open/syncd
    
    /opt
    
    dumplv
     sysdump    14    14
     1    open/syncd    N/A

    Now lets check to make sure that there’s a 1:2 relationship, meaning that there are copies.

    Notice dumplv. It’s not copied so we need to make sure dumplv data isn’t on the failing disk. To check, run;

    $ lslv -l dumplv
    dumplv:N/A
    PV
    COPIES        IN BAND
    DISTRIBUTION
    hdisk0
    014:000:000   100%
    000:014:000:000:000

    This is telling us that the logical volume dumplv is on hdisk0.  If hdisk1 is the failing
    disk, then we are okay.  Otherwise, we would have to migrate the data over to the good drive and proceed.

    # unmirrorvg rootvg hdisk1
    # reducevg rootvg hdisk1
    # rmdev -l hdisk1 –d

     


    Before you power down, you need to make sure that your system is set to boot off of a disk that is still in the rootvg.

     

    # bootinfo -b
    hdisk1

     

    This tells you what drive it was last booted up.  We want to change this to boot to the new drive, so;

    # bosboot -ad
    /dev/hdisk0

    And check bootlist

    # bootlist –m normal
    –o

    NOW WE CAN POWER DOWN THE BOX AND REPLACE THE DRIVE. Once disk has been replaced,
    power up the server.  Once at command prompt, run;

    # cfgmgr

     

     

    This will install the new device and allow the OS to see it.

     lsdev -Cc disk
    
     hdisk0
     Available 40-60-00-4,0 16 Bit LVD SCSI Disk Drive
    
     hdisk1
     Available 40-60-00-8,0 16 Bit LVD SCSI Disk Drive

     

    Make sure that the OS says it’s available.  If it is, we can assign it to a volume group.

    # extendvg rootvg hdisk1

     This will assign it a PVID. and assign it to the volumegroup rootvg to make it available for use.  Now we can mirror;


    # mirrovg rootvg

    This will take a little while as it’s taking all data now on hdisk0 and making a copy to hdisk1.

     

    # lsvg -p rootvg
    rootvg:
    PV_NAME
    PV STATE          TOTAL
    PPs   FREE PPs    FREE DISTRIBUTION
    hdisk0
    active
    542         264
    109..00..00..46..109
    hdisk1
    active
    542         278
    88..00..00..81..109

     

    Once it’s mirroring, we can make sure it’s assigned to rootvg by doing the above.  We can also check to make sure there’s copies;

     

    # lsvg -l rootvg
    rootvg:
    LV
    NAME
    TYPE       LPs   PPs
    PVs  LV STATE      MOUNT POINT
    hd5
    boot       1
    2     2    closed/syncd  N/A
    hd6
    paging     64    128
    2    open/syncd    N/A
    hd8
    jfslog     1     2
    2    open/syncd    N/A
    hd4
    jfs        6
    12    2    open/syncd
    /
    hd2
    jfs        127   254
    2    open/syncd    /usr
    hd9var
    jfs        4
    8     2    open/syncd
    /var
    hd3
    jfs
    37    74    2
    open/syncd    /tmp
    hd1
    jfs        3
    6     2    open/syncd
    /home
    hd10opt
    jfs        21
    42    2    open/syncd
    /opt
    dumplv
    sysdump    14    14
    1    open/syncd    N/A

     

    Now we need to modify the bosboot to recreate the boot image.

     

    # bosboot –a

     

    Double check your bootlist to make sure hdisk1 is in there.

     

    # bootlist –m normal –o