HACMP topology & usefull commands


Hacmp can be configured in 3 ways.

1. Rotating
2. Cascading
3. Mutual Failover

The cascading and rotating resource groups are the “classic”, pre-HA 5.1 types. The new “custom” type of resource group has been introduced in HA 5.1 onwards.


Cascading resource group:
Upon node failure, a cascading resource group falls over to the available node with the next priority in the node priority list.
Upon node reintegration into the cluster, a cascading resource group falls back to its home node by default.

Cascading without fallback
Thisoption, this means whenever a primary node fails, the package will failover to the next available node in the list and when the primary node comes online then the package will not fallback automatically. We need to move package to its home node at a convenient time.

Rotating resource group:
This is almost similar to Cascading without fallback, whenever package failover to the standby nodes it will never fallback to the primary node automatically, we need to move it manually at our convenience.

Mutual takeover:
Mutual takeover option, which means both the nodes in this type are active-active mode. Whenever fail over happens the package on the failed node will move to the other active node and will run with already existing package. Once the failed node comes online we can move the package manually to that node.

Useful HACMP commands

clstat - show cluster state and substate; needs clinfo.
cldump - SNMP-based tool to show cluster state
cldisp - similar to cldump, perl script to show cluster state.
cltopinfo - list the local view of the cluster topology.
clshowsrv -a - list the local view of the cluster subsystems.
clfindres (-s) - locate the resource groups and display status.
clRGinfo -v - locate the resource groups and display status.
clcycle - rotate some of the log files.
cl_ping - a cluster ping program with more arguments.
clrsh - cluster rsh program that take cluster node names as argument.
clgetactivenodes - which nodes are active?
get_local_nodename - what is the name of the local node?
clconfig - check the HACMP ODM.
clRGmove - online/offline or move resource groups.
cldare - sync/fix the cluster.
cllsgrp - list the resource groups.
clsnapshotinfo - create a large snapshot of the hacmp configuration.
cllscf - list the network configuration of an hacmp cluster.
clshowres - show the resource group configuration.
cllsif - show network interface information.
cllsres - show short resource group information.
lssrc -ls clstrmgrES - list the cluster manager state.
lssrc -ls topsvcs - show heartbeat information.
cllsnode - list a node centric overview of the hacmp configuration.

LVM


Logical Volume Manager (LVM) Commands for AIX

Glossary

Term
Definition
Journaled File System (JFS)
File system that uses a journaled log for faster, more reliable data recovery
Logical Partition (LP)
The LV is made up of LPs. The LP corresponds to 1 or more (in the case of mirroring) PPs.
Logical Volume (LV)
The VG is subdivided into logical volumes and each LV can have a file system on it.
Physical Partition (PP)All physical volumes are subdivided into pps. PPs are all the same size.
Physical Volume (PV)
Disk that is being managed by LVM.
Rootvg
Default volume group created during installation. The vg holds the OS filesystems ( /,/usr, /home, /proc /opt, /tmp, /var and swap space )
Volume Group (VG)
Area of storage that consists of one or more PVs


Command Summary

Command
Definition
chfs -a size=<#512 byte blocks>
Increases the size of a journaled file system to the total number of 512 byte blocks specified
chfs -a size=<+512 byte blocks> Increases the size of a journaled file system by the addional number of 512 byte blocks specified. For example "chfs -a size=+393216 /usr"
chlv -n Change the name of a logical volume (it must be inactive)
crfs -v jfs -m -g -a size=<# of 512 byte blocks>

crfs -v jfs -m
-d
This command makes a logical volume, mount point with a journaled file system:


creates a jfs file system on a logical volume
df -k
Shows the disk usage of logical volumes on the server.
exportvg
removes a volume group from a machine
extendvg Adds a new physical volume to an existing volume group
importvg -y
add a volume group to another machine
lslv [-l, m]
Lists information about the logical volumes. The -l option lists the disks in the logical volume.
lspv [-l, M, p]
Lists the disks on the server, including the physical volume will give details about that disk. The -l option will list the details of how the filesystems are distributed on the disk.
lsvg [-l]
Lists the volume groups on the server, including the volume group name will give details about that vg. The -l option will list the logical volumes in the volume group.
lsvpcfg
Lists each vpath and the hdisks that make up the vpath
mklv -y Makes a logical volume in a volume group
mksysb -l -f
makes a bootable backup of rootvg
mkvg -y . . . Makes a volume group out of one or more physical volumes
mount or
mount
if it is already in /etc/filesystems
Mounts the file system for use.
reducevg Removes a physical volume from a volume group
rmfs
removes a file system and it's logical volume
rmlv Removes a logical volume (it must be inactive)
savevg -l -f
makes a backup copy of another volume group
umount dismount the file system
Unmounts the filesystem.


Sample LVM Procedures:

Filesystem Procedures

Procedure to create a filesystem using JFS:
  • See below the procedure for creating a logical volume and a filesystem using JFS:

Procedure to extend the size of filesystem using JFS:
  1. "df" to see the filesystem, it's current size, % utilization and the name of it's logical volume
  2. "lslv " to show information about the logical volume including it's volume group name.
  3. "lsvg " to show information about the volume group, including number of free pp's and the pp size
  4. If there are not enough free pp's then see below for procedure to add a disk to a volume group.
  5. "chfs -a size= +4194304 " to grow the filesystem by 2 GB (4194304=2*1024*1024*1024/512)
    • NOTE: Growing the file system will automatically grow the logical volume
  6. df" shows the file system's current size is 2 GB more than before.
Troubleshooting extending the size of a filesystem using JFS:
  • Error Message: 0516-787 extendlv: Maximum allocation for logical volume is 512.
    • Maximum number of LPs for the logical volume has been exceeded - must increase the allocation
    • Calculate the number of LPs needed = LV Size in MB / LP size in MB
    • chlv -x
Procedure to remove a file system
  1. Unmount the filesystem
  2. Remove the logical volume "rmlv "
  3. Remove the filesystem information from /etc/filesystems
Procedure to reduce the size of a file system - shareold is 8mb and needs to be reduced to 4mb
  1. Create the file system
    1. crfs -v jfs -m /usr/sharenew -g rootvg -a size=8192
    2. this makes a logical volume in the root volume group of 4MB that uses jfs
  2. Mount the volume
    1. mount /usr/sharenew
  3. Move the files from the old file system (/usr/shareold)
    1. cd /usr/shareold
    2. tar cf - | (cd /usr/sharenew; tar xvf -)
    3. cd
  4. Unmount the file systems
    1. umount /usr/sharenew
    2. umount /usr/shareold
  5. Remove the old file system and it's logical volume
    1. rmfs /usr/shareold
    1. chfs -m /usr/shareold /usr/sharenew
  6. Mount the new filesystem
    1. mount /usr/shareold
  7. Delete the temporary mount point
    1. rmdir /usr/share

Logical Volume Procedures

Procedure to create a logical volume and filesystem in a volume group using JFS:
  1. lsvg to determine the size of the PP
  2. lslv in similar logical volumes to determine if mirroring is in effect
  3. Calculate the number of PPs needed for the logical volume
    1. bc
    2. scale=2
    3. /
    4. quit
  4. mklv -y "" <# of LPS> --> creates the logical volume
  5. crfs -v jfs -d -m / -A yes --> makes the filesystem, creates the mountpoint and puts it in /etc/filesystems
  6. mount / --> mounts the new fileystem
  7. df / --> verifies the mount and the size of the new filesystem
  8. Check the ownership and permissions of the new mount point
    • ls -ld
    • chown owner:group
    • chmod XXX
  9. If mirroring is in effect, then mirror this logical volume to another disk (original and 1 mirror):
    • mklvcopy -s y 2

Check to see if all of the logical volumes in a volume group are mirrored
  • lsvg -l

Mirror a logical volume after the fact
  • mklvcopy -s y 2


Volume Group Procedures

Procedure to create a volume group:
  1. lsdev -C -c disk -> lists available disks (and the hdisk#) on the server
  2. mkvg -y "" hdisk# --> creates the volume group on the named hard disk
  3. varyonvg --> activates the volume group
Procedure to add a disk to a volume group (extend the volume group)
  • extendvg
    • Verify the disk has been successfully added to the vg
  • lsvg -p

Procedure to mirror the rootvg:
  1. lspv --> determine the hdisk#
  2. extendvg rootvg hdisk --> add the hdisk to the volume group
  3. lspv --> verify that the hdisk has been successfully added to the volume group
  4. chvg -Q 'n' rootvg --> change the quorum so that the vg will stay active if one of the mirrors fail
  5. mirrorvg -S -c 2 rootvg --> mirror all of the logical volumes in the volume group
  6. lsvg -l rootvg --> verify successful mirroring (pps will appear "stale" until synchronization is complete).
  7. bosboot -a --> update the boot image information
  8. bootlist -m normal -o hdisk0 hdisk1 --> create a new bootlist
  9. bootlist -m normal -o --> verify the bootlist is correct
Procedure to increase the number of LP's available
Assume we receive an error that the maximum number of LP's had been exceeded, and the maximum number of LP's defined was 1100:
  1. "lsvg " to show the total PP's available in the volume group =1250
  2. "lsvg -l " to show the total PP's used in all logical volumes in that volume group (showed sys1log, the jfs log was using 2 PP's)
  3. "chlv -x 1248 " to change the maximum number of LP's from 1100 to 1248 (1250 PP's in the volume group - 2 PP's used by the jfs log = 1248 available)


Physical Disk Procedures

Procedure to find disks/vpaths that are unallocated
  • lsvpcfg
    • This will show disks/vpaths and the volume group they are allocated to
  • lspv|grep None
    • This will show pvs and whether they are asssociated with a volume group
    • Note: For vpaths, the hdisks will show as none, but they may be allocated to a vpath - you must grep each hdisk with the lsvpcfg

Procedure to make a new lun available to AIX
  • Allocate the new lun on the SAN
  • Run "cfgmgr"
  • Verify the new vpatch/hdisk by running "lsvpcfg"
    • There should be a new vpath and it should be available with no volume group - if not, rerun cfgmgr

Procedure to list the PVs in a volume group:
  • lsvg -p

IBM AIX - Disks and Filesystems


AIX provides powerful tools for management of disks and file systems. This is accomplished through the use of JFS (Journaled File System) and LSM (Logical Storage Manager).

Logical Volume Manager

The AIX Logical Volume Manager is similar in execution to the HP-UX and Digital Unix Logical Volume Managers, and is similar in purpose to the Sun On-line Disksuite package. The purpose of LVM is to add a layer of abstraction between file systems and disk drives. This layer of abstraction allows for easier management of space, and allows for enhancements such as disk mirroring, disk concatenation, and disk striping.

There are three main objects in the Logical Volume Manager:

Physical Volumes (PVs)

Physical volumes are a wrapper of sorts that is placed around a disk drive to allow it to be managed. A PV normally consists of 1 distinct physical disk. But in the case of a RAID controller, a PV consists of an entire "logical" disk, as presented to the system by the RAID controller.

Volume Groups (VGs)
A pool of storage, consisting of one or more physical volumes. A volume group may span multiple physical disks. A volume group can be thought of as a logical disk. Storage is allocated to one or more logical volumes, which can grow or shrink in size.
Logical Volumes (LVs)
If VGs can be thought of as disks, Logical Volumes can be thought of as partitions or slices on those disks. An LV is the object that filesystems, raw partitions, and paging space is built upon. Logical volumes can be expanded or moved from one PV to another on the fly while the LV is in use.
Logical volumes cannot be reduced in size. If a LV must be shrunken, you will need to back up the data, remove the LV, create a new smaller LV, and then restore the data.

JFS

The Journaled File System has several advantages over the BSD and UFS filesystems used in other Unixes. One disadvantage of UFS and BSD file systems is the possibility of file system corruption in the event of a system crash or power failure. This corruption can occur when files or directories are created or removed, but the system crashes before the information can be written to disk. This can lead to unreferenced files, missing file blocks, or file blocks belonging to multiple files.

This problem is much reduced in JFS file systems through the use of a log volume for file systems. While cached data can still be lost if the system crashes before it is synced to disk, file system changes such as inode and block allocation and freeing are logged to disk right away. In the event of a system crash, this log file is replayed prior to bringing a file system back on-line. This allows the file system structure to be intact even after a crash. This log replay process is much much quicker than the traditional fsck process. In a UFS file system, all block allocation must be verified, which takes multiple passes. Multi-gigabyte file systems can take tens of minutes to fsck. File systems in the hundreds of gigabytes can take hours to fsck if corrupted.

In contrast, JFS logs can be replayed in tens of seconds, even for large file systems. This is because only small log has to be processed rather than entire disks.

JFS file systems still may occasionally need to be fsck'd, but the is a much rarer occurrence.

Summary of Filesystem and LVM Commands

LVM and file systems can either be manipulated via SMIT or the command line. If using SMIT, the device, LVM, and file system screens are in different sections from each other. The other command line options are in families. Most of the "vg" commands have "vg" in the name, "lv" commands have "lv" in their name, etc.

Device Commands
lsdevThe "lsdev -Cc disk" command can be used to display the what disks are recognized by the system. This will display disks whether they have been initialized as PVs or not.
rmdevRemove a device from the system configuration. This is done to remove the device configuration when a faulty disk is replaced, or if a disk is moved to another system.
cfgmgrRe-scan the system for devices that were not available at system start up. This can be done to recognize hot pluggable drives that were added after the system was up, or can be used to recognize devices such as external tape or disk drives that were not powered on when the system was booted up.
Physical Volume Commands
pvcreateInitialize a disk as a Physical Volume. This must be done prior to adding a disk to a volume group.
lspvDisplay the Physical Volumes on a system. When given a PV name as a parameter, it gives detailed information about that PV.
Volume Group Commands
lsvgList information about logical volumes. When given with parameters, it lists all volume groups on the system. When given parameters, it can give detailed information about a particular VG, including information about what logical volumes are in that volume group.
chvgChange volume group characteristics.
mkvgCreate a volume group.
extendvgAdd PVs to a volume group.
reducevgRemove unused PVs from a volume group. If logical volumes currently reside on the PV in question, the "migratepv" command can be used to move the LV onto another disk in the VG provided there is enough space to do so.
exportvgRemove knowledge of a volume group from the Kernel. This can be used on removable disks such as optical disks or Iomega Jaz drives prior to removing the drive from a system, or can be used when moving a disk or disks from one system to another. The data in the VG is left intact.
importvgRe-initializes kernel knowledge of a volume group that had been previously exported. The data on the VG is left intact, and becomes accessible once it has been imported. The existing logical volume names are used unless they conflict with logical volumes currently in use on the system.
mirrorvgCreates mirror volumes for all volumes in a volume group.
unmirrorvgRemoves a mirror from each volume in a volume group.
Logical Volume Commands
lslvLists information about logical volumes. A logical volume name must be specified. In order to list information about all logical volumes, you would need to use "lsvg" to list all volume groups, and then use "lsvg -l " on each volume group. You could then use "lslv " to list the detailed information about each logical volume found.
mklvCreate a logical volume.
rmlvDelete a logical volume.
extendlvIncrease the size of a logical volume.
chlvChange the characteristics of a logical volume.
mklvcopyMirror a logical volume. This allows for RAID-1 in software.
rmlvcopyRemoves a mirror copy of a logical volume.
File System Commands
crfsCreate a file system. This command can be used to create a file system on an existing logical volume, or it can be used as an all in one command to create both a logical volume and file system at once.
chfsChange file system characteristics. This can be used to increase the size of a file system.
rmfsRemove a filesystem, its associated logical volume, and its entry in /etc/filesystems.
Paging Space Commands
lspsLists information about paging space volumes.
 
|  AIX Advanced Interactive eXecutive. Blogger Template By Lawnydesignz Powered by Blogger