Pages

Thursday, 21 July 2011

Linux Setup: Kernel Tuning


  • What is a kernel?

A UNIX kernel is an interpreter that translates user level system calls into synchronized access to hardware and device drivers. The calls are defined by POSIX standards. The interpreter manages user level requests for file or process access. The kernel's scheduler enables UNIX to juggle file and process subsystems. The file subsystem works with raw or block disk devices. The process subsystem manages process synchronization, inter-process communication, memory management and process scheduling.
The kernel manages through the use of two key structures, the process table and the user structure. The process table contains scheduling parameters, memory image, signals and miscellaneous process states. The user structure includes machine registries, system call state, file descriptor table, accounting and kernel stack.

  • Why tune a kernel?
The default UNIX kernel behavior is suboptimal out of the box because it is difficult to anticipate what type of work or workload the operating system will be assigned. Therefore, UNIX products provide parameters that may change the allocation of critical resources. The kernel tuning parameters are UNIX product specific. The system administrator is responsible to determine the target type of work and workload for a machine and to monitor whether either change over time. The system administrator should ensure that any tunable kernel parameters are set to optimize machine performance.
NOTE: Kernel tuning is an advanced topic and should not be done without a complete understanding of the subject.

  • How to tune Red Hat?
The super user should configure the tunable parameters for the Red Hat Application Server 2.1 Linux kernel before installing Oracle9i or Oracle Applications 11i. If using an Oracle Development Services slot, the concurrent number of Oracle9i and Oracle 9iAS instances should be determined. The number of concurrent instances will enable validating whether the tunable kernel parameters are correctly configured.
  1. Edit the /etc/sysctl.conf file.
The changes noted below should be made in the /etc/sysctl.conf file. If using a slot, log a bug to effect changes to a slot environment. Copy the following from the web page into the /etc/sysctl.conf file. Recalculate the numeric values and use the new values to edit the file.
# -------------------------------------------------------------------------
# Kernel parameter assumptions and rationale.
# ===========================================
#
# Linux Advanced Server 2.1 has a configure restricted kernel.
#
# -------------------------------------------------------------------------
# Disables packet forwarding
# -------------------------------------------------------------------------

 net.ipv4.ip_forward = 0

# -------------------------------------------------------------------------
# Enables source route verification
# -------------------------------------------------------------------------

 net.ipv4.conf.default.rp_filter = 1

# -------------------------------------------------------------------------
# Set the default local port range.
# -------------------------------------------------------------------------

 net.ipv4.ip_local_port_range = 1024 65000

# -------------------------------------------------------------------------
# Enables the magic-sysrq key
# -------------------------------------------------------------------------

 kernel.sysrq = 1

# -------------------------------------------------------------------------
# General semaphore rules:
# -----------------------
# 1. Semaphore tunable parameters are limited to semmsl, semmns,
#    semopm and semmni and must be entered in the /etc/sysctl.conf
#    file with the following syntax.
#
#    kernel.sem = semmsl semmns semopm semmni
#
# 2. The tunable kernel resource of semmsl sets the maximum number
#    of semaphore per set. The semopm should be set equal to semmsl
#    so that an operation can be performed on every semaphore in
#    the set. If semopm is larger than semmsl it should raise an
#    OS exception but doesn't in Linux.
#
#    Oracle8i Installation Manual for UNIX recommends this value be
#    derived as "... the sum of the PROCESSES parameter for each
#    Oracle database except the largest one, plus 2 times the largest
#    PROCESSES value, plus 10 times the number of Oracle databases."
#    Assuming 2 Oracle8i databases with the init{SID}.ora "processes"
#    parameter set to 100 and 1 Oracle 9iAS server with "processes"
#    parameter set to 100, the following is the recommended value:
#
#    Variables:
#    =========
#    s = sum of processes for all but largest instance
#    m = maximum number of process for a single instance
#    n = total number of instances
#    i = n - largest instance.
#
#    semmsl = ((s * i) + (m * 2)) + (n * 10))
#
#    semmsl = ((100*2) + (100)*2) + (3 * 10)) = (400 + 30) = 430
#
#    semopm = semmsl = 430
#
# 3. The tunable kernel resource of semmni sets the system wide
#    semaphore sets by creating a semid_ds control structure of
#    84 bytes, so this parameter should not be set arbitrarily large.
#    The Oracle8i and Oracle9i installation manual recommends 100
#    for each Oracle instance. Assuming 2 Oracle8i databases with
#    the init{SID}.ora processes parameter set to 100 and 1 Oracle
#    9iAS server with processes parameter set to 100, the following
#    is the recommended value:
#
#    semmni = 300
#
# 4. The semmsl (maximum number of semaphores per identifier) value
#    is the product of the semmni and semmsl values, as qualified
#    below:
#
#    semmns = (semmni * semmsl) = 300 * 430 = 129000
#
# 5. Therefore, semaphores should be set in the /etc/sysctl.conf
#    file as follows:
# -------------------------------------------------------------------------

 kernel.sem = 430 129000 430 300

# -------------------------------------------------------------------------
# General semaphore rules:
# -----------------------
# 1. The "Oracle9i Installation Guide, Release 2 (9.2.0.1.0) for
#    UNIX Systems: AIX-Based Systems, Compaq Tru64 UNIX, HP 9000
#    Series HP-UX, Linux Intel, and Sun Solaris" manual (A96167)
#    advises default settings for shmmin, shmmni, shmseg and
#    shmvmx shared memory kernel values.
#
# 2. The shmmin should be set to 1.
#
# 3. The shmmni memory variable sets the maximum number of
#    system wide shmid_ds structures and should be equal to the
#    value determined for semmni value.
#
#    shmmni = semmni = 300
#
# 4. The shmmax should be set to 50% of available memory or 2 GB but
#    setting above 50% of available memory can cause some memory use
#    issues in Oracle8i.
#
# 5. The shmmin, shmmsg and shmvmx cannot be set when using the
#    Red Hat Advanced Server 2.1 because alteration of the kernel is
#    not supported by Oracle and these typically tunable parameters
#    are fixed in the supported and shipped kernels.
#
# -------------------------------------------------------------------------

 kernel.shmmni = 300
 kernel.shmmax = 2147483648

# -------------------------------------------------------------------------
# General File Management:
# -----------------------
# The default value of 8192 is not compatible with Oracle's file limit
# of 65536 and should be changed to that value or higher provided memory
# is available. For example, the typical rule-of-thumb is to divide real
# memory by 16,384, or 64 simultaneous open files per 1 MB of memory.
# In systems with large amounts of memory, concurrency of file access
# would be a better rule-of-thumb. The value is set based on 2 GB of
# real memory as follows below.
#
#    fs.file-max = ( 2,097,152,000 / 16384 ) = 128,000
#
# Using the 2.2.x Linux kernel you will need to set the inode-max
# value to 4 to 5 times the file-max value. However, beginning with the
# 2.4.x Linux kernel inode-max is managed dynamically and should not be
# set in the /etc/sysctl.conf file.
# -------------------------------------------------------------------------

 fs.file-max=128000

  1. Reboot to effect the changes.
  1. Validate kernel boot parameters.
The following command enables validation of kernel parameters that are set in the /etc/sysctl.conf file that are processed at boot time.
# sysctl -p | grep kernel
kernel.sysrq = 0
kernel.core_uses_pid = 1
kernel.sem = 430 129000 430 300
kernel.shmmni = 300
kernel.shmmax = 2147483648

  • How to tune UnitedLinux?
The super user should configure the tunable parameters for the UnitedLinux 1.0 kernel before installing Oracle9i or Oracle Applications 11i. If using an Oracle Development Services slot, the concurrent number of Oracle9i and Oracle 9iAS instances should be determined. The number of concurrent instances will enable validating whether the tunable kernel parameters are correctly configured.
  1. Create the /etc/sysctl.conf file.
Create a /etc/sysctl.conf file with the information below. If using a slot, log a bug to effect changes to a slot environment. Copy the following from the web page into the /etc/sysctl.conf file. Recalculate the numeric values and use the new values to edit the file.
# -------------------------------------------------------------------------
# Kernel parameter assumptions and rationale.
# ===========================================
#
# UnitedLinux 1.0 has a configure restricted kernel.
#
# -------------------------------------------------------------------------
# Set the default local port range.
# -------------------------------------------------------------------------

 net.ipv4.ip_local_port_range = 1024 65000

# -------------------------------------------------------------------------
# Enables the magic-sysrq key
# -------------------------------------------------------------------------

 kernel.sysrq = 1

# -------------------------------------------------------------------------
# General semaphore rules:
# -----------------------
# 1. Semaphore tunable parameters are limited to semmsl, semmns,
#    semopm and semmni and must be entered in the /etc/sysctl.conf
#    file with the following syntax.
#
#    kernel.sem = semmsl semmns semopm semmni
#
# 2. The tunable kernel resource of semmsl sets the maximum number
#    of semaphore per set. The semopm should be set equal to semmsl
#    so that an operation can be performed on every semaphore in
#    the set. If semopm is larger than semmsl it should raise an
#    OS exception but doesn't in Linux.
#
#    Oracle8i Installation Manual for UNIX recommends this value be
#    derived as "... the sum of the PROCESSES parameter for each
#    Oracle database except the largest one, plus 2 times the largest
#    PROCESSES value, plus 10 times the number of Oracle databases."
#    Assuming 2 Oracle8i databases with the init{SID}.ora "processes"
#    parameter set to 100 and 1 Oracle 9iAS server with "processes"
#    parameter set to 100, the following is the recommended value:
#
#    Variables:
#    =========
#    s = sum of processes for all but largest instance
#    m = maximum number of process for a single instance
#    n = total number of instances
#    i = n - largest instance.
#
#    semmsl = ((s * i) + (m * 2)) + (n * 10))
#
#    semmsl = ((100*2) + (100)*2) + (3 * 10)) = (400 + 30) = 430
#
#    semopm = semmsl = 430
#
# 3. The tunable kernel resource of semmni sets the system wide
#    semaphore sets by creating a semid_ds control structure of
#    84 bytes, so this parameter should not be set arbitrarily large.
#    The Oracle8i and Oracle9i installation manual recommends 100
#    for each Oracle instance. Assuming 2 Oracle8i databases with
#    the init{SID}.ora processes parameter set to 100 and 1 Oracle
#    9iAS server with processes parameter set to 100, the following
#    is the recommended value:
#
#    semmni = 300
#
# 4. The semmsl (maximum number of semaphores per identifier) value
#    is the product of the semmni and semmsl values, as qualified
#    below:
#
#    semmns = (semmni * semmsl) = 300 * 430 = 129000
#
# 5. Therefore, semaphores should be set in the /etc/sysctl.conf
#    file as follows:
# -------------------------------------------------------------------------

 kernel.sem = 430 129000 430 300

# -------------------------------------------------------------------------
# General semaphore rules:
# -----------------------
# 1. The "Oracle9i Installation Guide, Release 2 (9.2.0.1.0) for
#    UNIX Systems: AIX-Based Systems, Compaq Tru64 UNIX, HP 9000
#    Series HP-UX, Linux Intel, and Sun Solaris" manual (A96167)
#    advises default settings for shmmin, shmmni, shmseg and
#    shmvmx shared memory kernel values.
#
# 2. The shmmin should be set to 1.
#
# 3. The shmmni memory variable sets the maximum number of
#    system wide shmid_ds structures and should be equal to the
#    value determined for semmni value.
#
#    shmmni = semmni = 300
#
# 4. The shmmax should be set to 50% of available memory or 2 GB but
#    setting above 50% of available memory can cause some memory use
#    issues in Oracle8i.
#
# 5. The shmmin, shmmsg and shmvmx cannot be set when using the
#    Red Hat Advanced Server 2.1 because alteration of the kernel is
#    not supported by Oracle and these typically tunable parameters
#    are fixed in the supported and shipped kernels.
#
# -------------------------------------------------------------------------

 kernel.shmmni = 300
 kernel.shmmax = 2147483648

# -------------------------------------------------------------------------
# General File Management:
# -----------------------
# The default value of 8192 is not compatible with Oracle's file limit
# of 65536 and should be changed to that value or higher provided memory
# is available. For example, the typical rule-of-thumb is to divide real
# memory by 16,384, or 64 simultaneous open files per 1 MB of memory.
# In systems with large amounts of memory, concurrency of file access
# would be a better rule-of-thumb. The value is set based on 2 GB of
# real memory as follows below.
#
#    fs.file-max = ( 2,097,152,000 / 16384 ) = 128,000
#
# Using the 2.2.x Linux kernel you will need to set the inode-max
# value to 4 to 5 times the file-max value. However, beginning with the
# 2.4.x Linux kernel inode-max is managed dynamically and should not be
# set in the /etc/sysctl.conf file.
# -------------------------------------------------------------------------

 fs.file-max=128000

  1. Start sysctl to effect the changes.
UnitedLinux ships with the sysctl service disabled and no /etc/sysctl.conf file. After creating the /etc/sysctl.conf file as noted above, read and start configuration file by the following command.
 # /etc/init.d/boot.sysctl start
  1. Enable /etc/init.d/boot.sysctl.
UnitedLinux ships with the sysctl service disabled. After creating the /etc/sysctl.conf file, enable the sysctl service as qualified below. This will enable /etc/init.d/boot.sysctl and read the /etc/sysctl.conf file on system initialization.
 # chkconfig boot.sysctl on
  1. Validate kernel boot parameters.
The following command enables validation of kernel parameters that are set in the /etc/sysctl.conf file that are processed at boot time.
# sysctl -p | grep kernel
kernel.sysrq = 0
kernel.core_uses_pid = 1
kernel.sem = 430 129000 430 300
kernel.shmmni = 300
kernel.shmmax = 2147483648               

Linux Tuning Parameters

Kernel

To successfully run enterprise applications, such as a database server, on your Linux distribution, you may be required to update some of the default kernel parameter settings. For example, the 2.4.x series kernel message queue parameter msgmni has a default value (for example, shared memory, or shmmax is only 33,554,432 bytes on Red Hat Linux by default) that allows only a limited number of simultaneous connections to a database. Here are some recommended values (by the IBM DB2 Support Web site) for database servers to run optimally:

- kernel.shmmax=268435456 for 32-bit
- kernel.shmmax=1073741824 for 64-bit 
- kernel.msgmni=1024 - fs.file-max=8192 
- kernel.sem="250 32000 32 1024"

Shared Memory



To view current settings, run command: # more /proc/sys/kernel/shmmax
To set it to a new value for this running session, which takes effect immediately, run command:
 # echo 268435456 > /proc/sys/kernel/shmmax

To set it to a new value permanently (so it survives reboots), modify the sysctl.conf file: ... 
kernel.shmmax = 268435456

Semaphores

To view current settings, run command:
# more /proc/sys/kernel/sem 250 32000 32 1024 

To set it to a new value for this running session, which takes effect immediately, run command: 
# echo 500 512000 64 2048 > /proc/sys/kernel/sem 
Parameters meaning: 
SEMMSL - semaphores per ID 
SEMMNS - (SEMMNI*SEMMSL) max semaphores in system 
SEMOPM - max operations per semop call 
SEMMNI - max semaphore identifiers


ulimits


To view current settings, run command:
# ulimit -a

To set it to a new value for this running session, which takes effect immediately, run command: 
# ulimit -n 8800 
# ulimit -n -1 // for unlimited; recommended if server isn't shared 
 Alternatively, if you want the changes to survive reboot, do the following: 

- Exit all shell sessions for the user you want to change limits on. 
- As root, edit the file /etc/security/limits.conf and add these two lines toward the end: 
 user1 soft nofile 16000 user1 hard nofile 20000 ** 
the two lines above changes the max number of file handles - nofile - to new settings. 
- Save the file. 
- Login as the user1 again. The new changes will be in effect.

Message queues

To view current settings, run command: 
# more /proc/sys/kernel/msgmni 
# more /proc/sys/kernel/msgmax

To set it to a new value for this running session, which takes effect immediately, run command: 
# echo 2048 > /proc/sys/kernel/msgmni 
# echo 64000 > /proc/sys/kernel/msgmax


Network

Gigabit-based network interfaces have many performance-related parameters inside of their device driver such as CPU affinity.  Also, the TCP protocol can be tuned to increase network throughput for connection-hungry applications.


Tune TCP


To view current TCP settings, run command:
# sysctl net.ipv4.tcp_keepalive_time
net.ipv4.tcp_keepalive_time = 7200 // 2 hours
where net.ipv4.tcp_keepalive_time is a TCP tuning parameter.
To set a TCP parameter to a value, run command:
# sysctl -w net.ipv4.tcp_keepalive_time=1800
A list of recommended TCP parameters, values, and their meanings:
Tuning Parameter  Tuning Value    Description of impact 
------------------------------------------------------------------------------
net.ipv4.tcp_tw_reuse
net.ipv4.tcp_tw_recycle 1 Reuse sockets in the time-wait state
---
net.core.wmem_max 8388608 Increase the maximum write buffer queue size
---
net.core.rmem_max 8388608 Increase the maximum read buffer queue size
---
net.ipv4.tcp_rmem 4096 87380 8388608 Set the minimum, initial, and maximum sizes for the
read buffer. Note that this maximum should be less
than or equal to the value set in net.core.rmem_max.
---
net.ipv4.tcp_wmem 4096 87380 8388608 Set the minimum, initial, and maximum sizes for the
write buffer. Note that this maximum should be less
than or equal to the value set in net.core.wmem_max.
---
timeout_timewait echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout Determines the time that must elapse before
TCP/IP can release a closed connection and reuse its resources.
This interval between closure and release is known as the TIME_WAIT
state or twice the maximum segment lifetime (2MSL) state.
During this time, reopening the connection to the client and
server cost less than establishing a new connection. By reducing the
value of this entry, TCP/IP can release closed connections faster, providing
more resources for new connections. Adjust this parameter if the running application
requires rapid release, the creation of new connections, and a low throughput
due to many connections sitting in the TIME_WAIT state.
Disk I/O

Choose the Right File System
Use 'ext3' file system in Linux. 
- It is enhanced version of ext2
- With journaling capability - high level of data integrity (in event of unclean shutdown)
- It does not need to check disks on unclean shutdown and reboot (time consuming)
- Faster write - ext3 journaling optimizes hard drive head motion



# mke2fs -j -b 2048 -i 4096 /dev/sda
mke2fs 1.32 (09-Nov-2002)
/dev/sda is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=2048 (log=1)
Fragment size=2048 (log=1)
13107200 inodes, 26214400 blocks
1310720 blocks (5.00%) reserved for the super user
First data block=0
1600 block groups
16384 blocks per group, 16384 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
16384, 49152, 81920, 114688, 147456, 409600, 442368, 802816, 1327104,
2048000, 3981312, 5619712, 10240000, 11943936

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

Use 'noatime' File System Mount Option

Use 'noatime' option in the file system boot-up configuration file 'fstab'.  Edit the fstab file under /etc.  This option works the best if external storage is used, for example, SAN:

# more /etc/fstab
LABEL=/ / ext3 defaults 1 1
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/sdc2 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0
/dev/sda /database ext3 defaults,noatime 1 2
/dev/sdb /logs ext3 defaults,noatime 1 2
/dev/sdc /multimediafiles ext3 defaults,noatime 1 2

Tune the Elevator Algorithm in Linux Kernel for Disk I/O


After choosing the file system, there are several kernel and mounting options that can affect it. One such kernel setting is the elevator algorithm. Tuning the elevator algorithm helps the system balance the need for low latency with the need to collect enough data to efficiently organize batches of read and write requests to the disk. The elevator algorithm can be adjusted with the following command:
# elvtune -r 1024 -w 2048 /dev/sda
/dev/sda elevator ID 2
read_latency: 1024
write_latency: 2048
max_bomb_segments: 6
The parameters are: read latency (-r), write latency (-w) and the device affected. 
Red Hat recommends using a read latency half the size of the write latency (as shown).
As usual, to make this setting permanent, add the 'elvtune' command to the
/etc/rc.d/rc.local script.
Others

Disable Unnecessary Daemons (They Take up Memory and CPU)
There are daemons (background services) running on every server that are probably not needed. Disabling these daemons frees memory, decreases startup time, and decreases the number of processes that the CPU has to handle. A side benefit to this is increased security of the server because fewer daemons mean fewer exploitable processes.

Some example Linux daemons running by default (and should be disabled). Use command:
#/sbin/chkconfig --levels 2345 sendmail off 
#/sbin/chkconfig sendmail off
Daemon
Description
apmd
Advanced power management daemon
autofs
Automatically mounts file systems on demand (i.e.: mounts a CD-ROM automatically)
cups
Common UNIX� Printing System
hpoj
HP OfficeJet support
isdn
ISDN modem support
netfs
Used in support of exporting NFS shares
nfslock
Used for file locking with NFS
pcmcia
PCMCIA support on a server
rhnsd
Red Hat Network update service for checking for updates and security errata
sendmail
Mail Transport Agent
xfs
Font server for X Windows
Shutdown GUI

Normally, there is no need for a GUI on a Linux server. All administration tasks can be achieved by the command line, redirecting the X display or through a Web browser interface.  Modify the 'inittab' file to set boot level as 3:
To set the initial runlevel (3 instead of 5) of a machine at boot, 
modify the /etc/inittab file as shown:


Linux recommended parameter values
Parameter nameDescription
Recommended value
SHMMNIThe maximum number of segments
256 * <size of RAM in GB>
SHMMAXThe maximum size of a shared memory segment (bytes)
<size of RAM in bytes>
SHMMAX - Set this value to automatically start the server on Red Hat Enterprise Linux 6The maximum size of a shared memory segment (bytes)268435456
SHMALLThe maximum allocation of shared memory pages (bytes)
2 * <size of RAM in bytes> (setting is in 4K pages)
SEMMNIThe maximum number of arrays
256 * <size of RAM in GB>
SEMMSLThe maximum semaphores per array
250
SEMMNSThe maximum semaphores per system
256000
SEMOPMThe maximum operations per semaphore call
32
MSGMNIThe maximum number of system-wide message queues
1024 * <size of RAM in GB>
MSGMAXThe maximum size of messages (bytes)
65536
MSGMNBThe default maximum size of queue (bytes)
65536

Wednesday, 20 July 2011

AIX Logical Volume Manager (LVM)

his is a quick and dirty cheat sheet on LVM using AIX, I have highlighted many of the common attributes for each command however this is not an extensive list, make sure you look up the command.

First a quick review on some of the terminology that AIX LVM uses

Examples

What it means

PHYSICAL VOLUME (PV) Represents a hard disk (hdisk0).

PHYSICAL PARTITION (PP) The smallest allocation unit in the LVM. All PPs within a VG are the same size, usually 4 or 8 MB.

VOLUME GROUP (VG) A set of one or more PVs which form a single storage pool. You can define multiple VGs on each AIX system.

LOGICAL VOLUME (LV) One or more PPs. A file system resides on top of an LV. Only one LV is mapped to a file system. A LV can't span across a VG. Up to 255 LVs in a VG

LOGICAL PARITITION (LP) One or more PPs. LP represents a mirrored copy of a PP. Up to two copies of a PP can be mirrored resulting in a LP count of three (2 mirrors plus original).

Volume Group Descriptor Area(VGDA) Information about all the LVs and PVs within a VG. The first 64K of a PV is reserved for this area - defined in <sys/bootrecord.h>.

The VGDA consists of
BOOTRECORD: - first 512 bytes. Allows the Read Only System (ROS) to boot system
BAD BLK DIRECTORY - found in <sys/bddir.h>
LVM RECORD - found in <lvmrec.h>


Volume Group Status Area(VGSA) Information about which PPs that are stale and which PVs are missing within a VG. The LVM and SCSI driver reserves somewhere between 7-10% of the available disk space for LVM maps, etc.

Physical Volume ID(PVID)
The PVID is an amalgamation of the machine’s serial number (from the systems EPROMs) and the date that the PVID is being generated. This combination insures theextremely low chance of two disks being created with the same PVID. Finally, when a system is booted, the disk configurator goes and looks at the PVID sitting on each disk platter and then compares that to an entry in ODM. If the entry is found, then the disk is given the hdiskX name that is associated with the ODM entry for the PVID.

Quorum
Quorum is a sort of “sanity” check that LVM uses to resolve possible data confliction and prevent data corruption. Quorum is a method by which 51% or more quorum votes must be available to a volume group before LVM actions can continue.

Quorum is issued to a disk in a volume group according to how the disk was created within the volume group. When a volume group consists of one disk, there are two VGDA’s on that disk. Thus, this single disk volume group has a quorum vote of 2. When another disk is added to the volume group with an “extendvg”, then this new disk gets one VGDA, but the original, first disk still retains the two VGDA’s. When the volume group has been extended to three disks, the third disk gets the spare VGDA sitting on the first disk and then each disk has a quorum vote of 1. Every disk after the third disk is automatically given one VGDA, and thus one vote.

Volume Group ID (VGID)
Just as the PVID is a soft serial number for a disk, the VGID is the soft serial number for the volume group. It is this serial number, not the volume group’s ascii name, which all low level LVM commands reference. Additionally, it is the basis for the LVIDs created on that VGID.

Logical Volume Control Block (LVCB)
The logical volume control block (lvcb) consists of the first 512 bytes of a logical volume. This area holds important information such as the creation date of the logical volume, information about mirrored copies, and possible mount points in a journaled filesystem.

Logical Volume ID (LVID)
The LVID is the soft serial number used to represent the logical volume to the LVM libraries and low level commands. The LVID is created from the VGID of the volume group, a decimal point, and a number which represents the order which the logical volume was created on the volume group.
Now for the cheet sheet 
Directory and Files
Directories and Files
Tools
Diagnostic 

diag - used to hot swap the disk

cfgmgr - used make sure the new disk is seen

# to add new disk from the scsi0 controller

cfgmgr -l scsi0

Create/Remove hard disk

cfgmgr -l scsi0

mkdev -c disk -l <pv>

rmdev -dl <pv>

Physical Volumes

display

lspv

lspv <pv> (detailed)

lspv -l <pv> (list logical volumes)

lspv -p <pv> (physical partition usage)

PVID

chdev -l <pv> -a pv=yes

chdev -l <pv> -a pv=clear

Note: PVID's are automatically added when the disk is placed into a vg

adding

chdev -l <pv> -a pv=yes (new)

chpv -v a <pv> (adds back the removed disk)
removing

chpv -v r <pv>
change physical attributes

chpv -a y <pv> (changes allocatable state to YES)

chpv -a n <pv> (changes allocatable state to NO)

moving

migratepv <old pv> <new pv>

Volume Groups

display

lsvg

lsvg <vg> (detailed)

lsvg -l <vg> (list all logical volumes in goup)

lsvg -p <vg> (list all physical volumes in group)

lsvg -o (lists all varied on)

lsvg -M <vg> (lists assicated disks and state)

## Details volume group info for the hard disk

lqueryvg -Atp <pv>

lqueryvg -p <disk> -v (Determine the VG ID# on disk)

lqueryvg -p <disk> -L (Show all the LV ID#/names in the VG on disk)

lqueryvg -p <disk> -P (Show all the PV ID# that reside in the VG on disk)
varyon

varyonvg <vg>

varyonvg -f <vg> (force)

varyonvg -s <vg> (maintenance mode can use VG commands but lv 's cannot be opened for i/o access)

varyoffvg <vg>

Note: the varyon command activiates the volume goup which means it is available for use

ODM related

## Determine if the ODM and VGDA are correct (in sync)

getlvodm -u <vg>

## tries to resync VGDA, LV control blocks and ODM

synclvodm <vg>

## If the message 0516-366 lsvg: Volume group <vg> is locked is ever seen

putlvodm -K `gtlvodm -v <vg>`

creating

mkvg -y <vg> -s <PP size> <pv>

mkvg -y datavg -s 4 hdisk1

Note: the PP size will be the size of the physical partition size you want 4MB, 8MB

extending

extendvg <vg> <pv>

reducing

reducevg -d <vg> <pv>

## removes the PVID from the VGDA when a disk has vanished without using the reducevg command

reducevg <vg> <PVID>

removing

varyoffvg <vg>

exportvg <vg>

Note: the export command nukes everything regardingthe volume goup in the ODM and /etc/filesystems

checking

## check to see if underlying disk has grown in size

chvg -g <vg>

Note: use this command if you are using SAN LUN's that have increased in size
change volume attributes

## auto vary on a volume at system start

chvg -a y

# Turns on/off quorum checking on a volume group

chvg -Q [y|n] <vg>
renaming

varyoffvg <old vg name>

lsvg -p <old vg name> (obtain disk names)

exportvg <old vg name>

import -y <new vg name> <pv>

varyonvg <new vg name>

mount -a

importing

importvg -y <vg> <pv>

importvg <pv> (will use rootvg as default vg)

exporting

varyoffvg <vg>

exportvg <vg>

Note: if the volume has an active paging space this must be turned off before

Logical Volumes

display

lslv <lv>

lslv -l <lv> (list all physical volumes in logical volume)

lslv -m <lv> (list ppartition mapping)

## Display lv control block information

getlvcb -AT <lv>
creating

mklv <vg> <# of PP's> <pv>

mklv -y <lv name> <vg> <# of PP's> <pv>

## Create a mirrored named logical volume

mklv -y <lv> -c <copies 2 or 3> <vg> <# of PP's> <pv>
## create a JFSlog logical Volume

mklv -y <lv name> -t jfslog <vg> <# of PP's> <pv>

extending

extendlv <lv> <additonal # of PP's>

extendlv <lv> <size of volume in B||M|G>

reducing/resizing

see filesystem below

removing

rmlv <lv>

moving

migratepv -l <lv> <old pv> <new pv>

adding a mirror to a non-mirrored volume

mklvcopy -s n <lv> <copies 2 or 3> <pv>

removing a mirror copy from a mirrored volume

rmlvcopy <lv> <copies 1 or 2>

rmlvcopy <lv> <copies 1 or 2> <pv> (specified pv)

unmirrorvg <vg> <pv>

synchronize logical volume

syncvg -p <pv>

syncvg -v <vg>

syncvg -l <lv>
mirror any unmirrored volumes

mirrorvg <vg> <pv>

change volume attributes

## Enable the bad-block relocation policy
chlv -b [y|n] <lv>

renaming

chlv -n <new lv name> <old lv name>

Miscellaneous

## Initialises an LV for use as an JFSlog

logform </dev/lv>

Filesystems

display

lsfs

lsfs -q <fs> (detailed)

Note: use the '-q' to see if the logical volume size is bigger than the filesystem size

create

## create new filesystem, -A means to mount after restart

crfs -v jfs -d <lv> -m <mountpoint> -A yes

## Create logical volume, filesystem, mountpoint, add entry to /etc/filesystems at the specified size

crfs -v jfs2 -g <vg> -m <mountpoint> -a size=<size in 512k blocks|M|G) -A yes

Note: there are two types of filesystems jfs and jfs2, jfs2 allows you to decrease the filesystem size , you cannot reduce a jfs filesystem

remove

rmfs <fs>

Note: if all filesystems have been removed from a logical volume then the logical volume is removed as well.
resize

chfs -a size=<new size> <fs>

chfs -a size=1G /var (specific size, can be used to increase and decrease)

chfs -a size=+1G /var (increase by 1GB)

chfs -a size=-1GB /var (reduce by 1GB)

Note: this will automatically increase or decrease the underlying logical volume as well

freeze/unfreeze

chfs -a freeze=<time in seconds> <fs>

chfs -a freeze=off <fs>
split mirrored copy

chfs -a splitcopy=<split copy mountpoint>-a copy=2 <fs>

chfs -a splitcopy=/backup -a copy=2 /testfs

change

## Change the mountpoint

chfs -m <new mountpoint> <fs>

## Do not mount after a restart

chfs -A no <fs>

## Mount read-only

chfs -p ro <fs>

mount

mount

mount [<fs>|<lv>]

mount -a

mount all

defrag

defragfs -q <fs> (report defrag status)

defragfs -r <fs> (runs in report only mode - no action)

defragfs <fs> (actually defrags the filesystem)

checking and repairing

fsck [-y|-n] <fs> (check a filesystem)

fsck -p <fs> (restores primary superblock from backup copy if corrupt)

Miscellaneous

Complete VG, LV and FS with mirroring example

## Create the volume group

mkvg -s 256 -y datavg hdisk2

## Create the jfs2 log logical volume and initialize it this for the volume group

mklv -t jfs2log -y dataloglv datavg 1

logform /dev/dataloglv

## Create the logical volume

mklv -t jfs2 -y data01lv datavg 8

## Create the filesystems that will use the logical volume

crfs -v jfs -d data01lv -m /data01 -A yes

## Add an additional hard disk to the volume group

extendvg datavg hdisk3

## Now mirror both the volume group log logical volume and the logical volume

mklvcopy dataloglv 2

mklvcopy data01lv 2

## Make sure everything is sync'ed both the log and the logical volume

syncvg -v datavg

## Make sure everything is OK

lsvg -l datavg

## a quick way to perform the above in two steps

mklv -c 2 -t jfs2 -y data02lv datavg 8

crfs -v jfs -d data02lv -m /data02 -A yes

## mount everything and check

mount -a

Replaced failed mirror drive

## break the mirror (two ways to do this)

rmlvcopy <lv name> 1 <broken disk>

unmirrorvg <lv> <broken pv >

## remove the disk from the vg

reducevg <vgname> <broken pv >

## remove the hdisk from ODM

rmdev -dl <broken pv>

## physically replace the disk

diag -> function select -> task selection -> hot plug task -> scsi and scsi raid hot plug manager -> replace/remove a device attached to an scsi hot swap enclosure device -> select disk and follow instructions

## configure new disk an check the new number (hopefully the same)

cfgmgr -v

lsdev -Cc <pv>

## add back to volume group

extendvg <vg> <pv>

## create mirror (two ways to do this)

mklvcopy <lv> 2 <pv>

mirrorvg <lv>

## sync mirror

syncvg -l <lv>

## If this is the rootvg there are additonal steps to take

bosboot -ad /dev/<pv>

bootlist -m normal <pv> <pv>

bootlist -m normal -o

Accidently remove a mirrored disk or SAN LUN disappeared off the network

## This procedure places back a mirror disk that you have accidently pulled or that a SAN LUN disappeared off the network

## and its states is classed as "missing"

## see that the disk is in a missing state (see PV state column), also see stale volumes

lsvg -p <vg>

lsvg -M <vg>

## To make the disk active again we use the varyonvg command

varyonvg <vg>

## see that the disk is in a active state (see PV state column)

lsvg -p <vg>

## Now re-sync the volumes in that volume group

syncvg -v <vg>

## Make sure that no volumes are stale

lsvg -M <vg>

## Determine if the ODM and VGDA are correct (in sync)

getlvodm -u <vg>

Logical Volume Manager (LVM) Commands for AIX

Logical Volume Manager (LVM) Commands for AIX

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

chfs -a size=<#512 byte blocks> <file system>
Increases the size of a journaled file system to the total number of 512 byte blocks specified

chfs -a size=<+512 byte blocks> <mount point> 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 <newname> <oldname> Change the name of a logical volume (it must be inactive)
crfs -v jfs -m <mount point> -g <volume group> -a size=<# of 512 byte blocks>

crfs -v jfs -m <mount point> -d <logical volume>
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 <volume group>
removes a volume group from a machine and entry from ODM

extendvg <volume group> <physical volume> Adds a new physical volume to an existing volume group

importvg -y <volume group> <physical volume> add a volume group to another machine

lslv <logical volume> [-l, m]
Lists information about the logical volumes. The -l option lists the disks in the logical volume.

lspv <physical volume> [-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 <volume group> [-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 <new lv> <vg> Makes a logical volume in a volume group

mksysb -l -f <device> makes a bootable backup of rootvg

mkvg -y <volume group> <physical volume> . . . <physical volume> Makes a volume group out of one or more physical volumes

mount <logical volume> <file system> or
mount <filesystem> if it is already in /etc/filesystems
Mounts the file system for use.

reducevg <volume group> <physical volume> Removes a physical volume from a volume group

rmfs <file system> removes a file system and it's logical volume

rmlv <lv> Removes a logical volume (it must be inactive)

savevg -l -f <device> <volume group> makes a backup copy of another volume group

umount <file system> dismount the file system,Unmounts the filesystem. 

Sample LVM Procedures:

Filesystem ProceduresProcedure 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:

"df" to see the filesystem, it's current size, % utilization and the name of it's logical volume

"lslv <logical_volume>" to show information about the logical volume including it's volume group name.

"lsvg <volume_group>" to show information about the volume group, including number of free pp's and the pp size

If there are not enough free pp's then see below for procedure to add a disk to a volume group.

"chfs -a size= +4194304 <MOUNT_POINT>" to grow the filesystem by 2 GB (4194304=2*1024*1024*1024/512)

NOTE: Growing the file system will automatically grow the logical volume
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 <LV_Name> 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 <new_max_lps> <logical_volume>Procedure to remove a file system

Unmount the filesystem

Remove the logical volume "rmlv <lv_name>"
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

Create the file system
crfs -v jfs -m /usr/sharenew -g rootvg -a size=8192
this makes a logical volume in the root volume group of 4MB that uses jfs

Mount the volume
mount /usr/sharenew

Move the files from the old file system (/usr/shareold)
cd /usr/shareold

tar cf - | (cd /usr/sharenew; tar xvf -)
cd

Unmount the file systems
umount /usr/sharenew
umount /usr/shareold

Remove the old file system and it's logical volume
rmfs /usr/shareold

chfs -m /usr/shareold /usr/sharenew
Mount the new filesystem
mount /usr/shareold
Delete the temporary mount point
rmdir /usr/share

Logical Volume Procedures
Procedure to create a logical volume and filesystem in a volume group using JFS:

lsvg to determine the size of the PP
lslv in similar logical volumes to determine if mirroring is in effect

Calculate the number of PPs needed for the logical volume

bc
scale=2
<size of lv in MB>/<size of PP in MB>
quit

mklv -y "<LV_NAME>" <VG_NAME> <# of LPS> --> creates the logical volume

crfs -v jfs -d <LV_NAME> -m /<MOUNTPOINT> -A yes --> makes the filesystem, creates the mountpoint and puts it in /etc/filesystems

mount /<MOUNTPOINT> --> mounts the new fileystem

df /<MOUNTPOINT> --> verifies the mount and the size of the new filesystem

Check the ownership and permissions of the new mount point
ls -ld <mountpoint>
chown owner:group <mountpoint>
chmod XXX <mountpoint>

If mirroring is in effect, then mirror this logical volume to another disk (original and 1 mirror):
mklvcopy -s y <LV_NAME> 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 <LV_NAME> 2

Volume Group Procedures

Procedure to create a volume group:


lsdev -C -c disk -> lists available disks (and the hdisk#) on the server

mkvg -y "<VG_NAME>" hdisk# --> creates the volume group on the named hard disk

varyonvg <VG_NAME> --> activates the volume groupProcedure to add a disk to a volume group (extend the volume group)

extendvg <vg> <disk#>

Verify the disk has been successfully added to the vg
lsvg -p <vg>
Procedure to mirror the rootvg:

lspv --> determine the hdisk#

extendvg rootvg hdisk<number> --> add the hdisk to the volume group

lspv --> verify that the hdisk has been successfully added to the volume group

chvg -Q 'n' rootvg --> change the quorum so that the vg will stay active if one of the mirrors fail

mirrorvg -S -c 2 rootvg --> mirror all of the logical volumes in the volume group

lsvg -l rootvg --> verify successful mirroring (pps will appear "stale" until synchronization is complete).

bosboot -a --> update the boot image information

bootlist -m normal -o hdisk0 hdisk1 --> create a new bootlist

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:

"lsvg <volume_group>" to show the total PP's available in the volume group =1250

"lsvg -l <volume_group>" 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)

"chlv -x 1248 <logical_volume>" 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 <volume group>


Tuesday, 19 July 2011

GPFS introduction

GPFS introduction

GPFS is a concurrent file system. It is a product of IBM and is short forGeneral Parallel File System. It is a high-performance shared-disk file system that can provide fast data access from all nodes in a homogenous or heterogenous cluster of IBM UNIX servers running either the AIX or the Linux operating system.

All nodes in a GPFS cluster have the same GPFS journaled filesystem mounted, allowing multiple nodes to be active at the same time on the same data.

A specific use for GPFS is RAC, Oracle's Real Application Cluster. In a RAC cluster multiple instances are active (sharing the workload) and provide a near "Allways-On" database operation. The Oracle RAC software relies onIBM's HACMP software to achieve high availability for hardware and the operating system AIX. For storage it utilizes the concurrent filesystem called GPFS.

Data availability

GPFS is fault tolerant and can be configured for continued access to data even if cluster nodes or storage systems fail. This is accomplished though robust clustering features and support for data replication. GPFS continuously monitors the health of the file system components. When failures are detected appropriate recovery action is taken automatically. Extensive logging and recovery capabilities are provided which maintain metadata consistency when application nodes holding locks or performing services fail. Data replication is available for journal logs, metadata and data. Replication allows for continuous operation even if a path to a disk or a disk itself fails. GPFS Version 3.2 further enhances clustering robustness with connection retries. If the LAN connection to a node fails GPFS will automatically try and reestablish the connection before making the node unavailable. This provides for better uptime in environments experiencing network issues. Using these features along with a high availability infrastructure ensures a reliable enterprise storage solution.

GPFS interaction with AIX

GPFS is a means to provide a journaled filesystem that can be mounted on multiple nodes simultaneously. GPFS stripes the data across all disks that belong to that file system. GPFS has a somewhat different approach of dealing with AIX volume groups and disks as we're used to; also mirroring is done in a different way.

A standard AIX setup has a device relationship that follows the following rules: A volumegroup is created that holds one or more physical disks. A disk contains one or more logical volumes, or a logical volume may span multiple disks. There is a one-to-one relation between a logical volume and the filesystem it contains. With LVM-mirroring each logical partition of a logical volume is placed on two separate disks. This typical setup is shown in the figure below:
GPFS introduction
The original AIX filesystem structure.

In a SAN environment, this picture looks like this:

GPFS introduction
The AIX filesystem structure in a SAN environment.

Each volume group of GPFS contains only 1 (one) physical disk. Each disk contains only 1 (one) logical volume. Each filesystem contains multiple logical volumes (one for each disk). LVM mirroring is not supported (there is only one disk in a volume group). This translates in the following picture: 

GPFS introduction
The GPFS filesystem structure in a SAN environment.

In GPFS 2.3 the GPFS volumes are called Network Storage Devices (NSD), that contain each only one physical disk. No volume groups and/or logical volumes are created in this GPFS version. In migrated clusters (from GPFS 2.2 to GPFS 2.3) you will still see volume groups and logical volumes, but only for the "old" disks. New disks and filesystems will be created without them.

We change the picture in a more "stack"-like representation. Here you see one GPFS filesystem that is made up out of four separate disks. AIX multipath-software has created the hdisk and vpath devices.

On the AIX level GPFS creates a separate volume group for each disk, so 4 volume groups in total. GPFS fills each disk with a logical volume, so 4 logical volumes in total. These logical volumes are represented as disk in the GPFS configuration. These GPFS-disks are used in the filesystem. A file stored in the filesystem is striped across the four disks (in 8kb blocks). The command used to create the GPFS disks is mmcrlv.

GPFS introduction
The stacked GPFS filesystem structure.

Usually, only small LUNs of only 17,5 GB are used instead of big luns (of 400 GB), because of performance.

Mirroring versus replication

Traditional AIX mirrorring on the logical volume level can not be done in a typical GPFS device setup. The volume group holds only one disk that is completely filled with one logical volume, so there is no destination possible for the second copy of the lv's logical partitions. GPFS provides replication as the alternative.

GPFS provides a structure called replication that provides a means of surviving a diskfailure. On the file level you can specify how many copies of that file must be present in the filesystem (one or two). When you specify two copies, GPFS will duplicate the file across two "failuregroups". Setting replication on the file level is error-prone, this can easily be forgotten. It is also possible to specify this globally on the filesystem level. Set the "Default number of replicas = 2" and the "Maximum number of replicas = 2" on each GPFS filesystem, so that every file in all the GPFS filesystem are automatically replicated. Keep in mind that replication stores two file copies in the same filesystem. Each file will use twice the amount of space, so the filesystem free space will drop in size twice as fast. An example: The free space in the filesystem is 15 MB. You want to save a file of 10 MB, the result is a FILE SYSTEM FULL ERROR. The reason is that you need at least 20 MB free space to hold both copies of the file!

Failure groups

GPFS groups disks into "failuregroups". A failuregroup is a collection of disks that share a single point of failure (SPOF). In a SAN setup there is usually only one SPOF for the disk: All disks are usually multipath, so a single Host Bay Adapter (HBA) failure is no problem. All systems can be connected to two separate SAN fabrics, so a fabric failure is also no problem. Each disk is hosted by one ESS. When the ESS fails, all disks in that ESS will fail. Unless you have a second ESS, you can prevent this failure by using failuregroups. GPFS uses these failure groups to prevent that both replication copies of a file will fail at the same time. It does this by writing the two copies of a file to disks in separate failuregroups.

GPFS introduction
Each file copy in a separate failuregroup.

In the example above you see that the file is written twice in the filesystem. One copy is striped over lun 1 + 2 and the other copy is striped across lun 3 + 4. When ESS1 fails the second copy of the file is still completely usable on ESS2. 

Striping

Large files in GPFS are divided into equal sized blocks, and consecutive blocks are placed on different disks in a round-robin fashion. To minimize seek overhead, the block size is large (typically 256K). Large blocks have the advantage that they allow a large amount of data to be retrieved in a single I/O from each disk. GPFS stores small files (at the end of large files) in smaller units called sub-blocks, which are as small as 1/32 of the size of a full block. Striping works best when disks have equal size and performance. This is why you should use one disksize for data storage in a filesystem; do not mix and match large and small luns.

GPFS transaction log

Just like JFS, GPFS is a journaled filesystem. GPFS records all metadata updates that affect file system consistency in a journal log. Each node has a separate log for each file system it mounts, stored in that file system. Because this log can be read by all other nodes, any node can perform recovery on behalf of a failed node. It is not necessary to wait for the failed node to come back to life. After a failure, file system consistency is restored quickly by simply re-applying all updates recorded in the failed node's log. Once the updates described by a log record have been written back to disk, the log record is no longer needed and can be discarded. Thus, logs can be fixed size, because space in the log can be freed up at any time by flushing "dirty" metadata back to disk in the background.

GPFS data and metadata

The GPFS filesystem contains two types of data: Data and Metadata. "Data" means the actual files you want to store in the filesystem. This is the usable storage space. "Metadata" refers to all sorts of information used by GPFS internally. For each GPFS disk you can specify what it will contain: DataAndMetadata, MetadataOnly, Dataonly or DescOnly. "DataAndMetadata" is used for normal disks, so most disks in the system will have this designation. "DescOnly" is used for "quorum busters".

GPFS filesystem descriptor quorum 

There is a structure in GPFS called the Filesystem Descriptor (FSDesc) that is written originally to every disk in the filesystem, but is updated only on a subset of the disks as changes to the filesystem occur, such as adding or deleting disks. The subset of disks is usually a set of three or five disks, depending on how many disks and failuregroups are in the filesystem. The disks that constitute this subset of disks can be found by reading any one of the FSDesc copies on any disk. The FSDesc may point to other disks where more up-to-date copies of the FSDesc are located.

To determine the correct filesystem configuration, a quorum of the subset of disks must be online so that the most up-to-date FSDesc can be found. If there are three special disks, then two of the three must be available. GPFS distributes the copies of FSDesc across the failure groups. If there are only two failuregroups, one failure group has two copies and the other failure group has one copy. In a scenario that causes one entire failure group to disappear all at once, if half of the disks that are unavailable contain the single FSDesc that is part of the quorum, everything stays up. On the other hand, if the downed failure group contains the majority of the quorum, the FSDesc cannot be updated and the filesystem must be force unmounted. If the disks fail one at a time, the FSDesc is moved to a new subset of disks by updating the other two copies and a new disk copy. However, if two of the three disks fail simultaneously, the FSDesc copies cannot be updated to show the new quorum configuration. In this case, the filesystem must be unmounted to preserve existing data integrity. To survive a single ESS failure in a dual ESS configuration, there must be a third failure group on an independent disk outside both ESSs (the so-called TieBreaker node, which contains one disk per filesystem which contains the third FSDesc).

The final picture will be:

GPFS introduction
Final GPFS on SAN picture.

Taking all things mentioned above in account, the final solution for a GPFS filesystem is:

All files in the filesystem are replicated across two failuregroups on two nodes (preferably in two sites). This is controlled by the filesystem setting "default number of replicas = 2". The number of disk that hold data is the same at each of the two sites. The number of disk used for data has no practical limit. You will probably create multiple filesystems for other reasons than the disk limit. These disks also hold a copy of the metadata. 

There is a third site with one disk used as quorum buster on the TieBreaker node. These disks hold no data or metadata, only a single filesystem descriptor (FSDesc).

GPFS software

For GPFS 2.2 the following filesets are installed on each node of the GPFS cluster:
  • mmfs.base.cmds
  • mmfs.base.rte
  • mmfs.gpfs.rte
  • mmfs.gpfsdocs.data
  • mmfs.msg.en_US
For GPFS 2.3 the following filesets are installed on each node of the GPFS cluster:
  • gpfs.base
  • gpfs.msg.en_US
  • gpfs.docs.data
For Oracle RAC using GPFS 2.3, installation of HACMP 5.2 (and RSCT) is required. This is specifically necessary for Oracle RAC and not for GPFS.
Twitter Bird Gadget