|
Softpanorama
(slightly skeptical)
Open Source Software Educational Society |
May the
source be with you,
but remember the KISS principle ;-)
|
AIX LVM Tasks
what disks are in the
root volume group
# lsvg -p rootvg
rootvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk0 active 546 186 00..00..00..77..109
|
Now let's see how many
disks are on the system
# lspv
hdisk0 00cf4f5d02a3c139 rootvg active
hdisk1 00cf4f5da1ca9590 none
#
|
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 group
Add a disk to the root
volume group (extend the volume
group) extendvg <vg> <disk#>
# extendvg -f rootvg hdisk1
|
- Verify the disk has been successfully added to the vg
lsvg -p <vg>
Make sure the
disks are in an active state
# lspv
hdisk0 00cf4f5d02a3c139 rootvg active
hdisk1 00cf4f5da1ca9590 rootvg active
|
Mirror athe logical
volumes that exist on a given volume group
# /usr/sbin/mirrorvg rootvg hdisk0 hdisk1
0516-1124 mirrorvg: Quorum requirement turned off, reboot system for this
to take effect for rootvg.
0516-1126 mirrorvg: rootvg successfully mirrored, user should perform
bosboot of system to initialize boot records. Then, user must modify
bootlist to include: hdisk0 hdisk1.
|
Check to see if all of the logical
volumes in a volume group are mirrored
Mirror a logical volume after the fact
- mklvcopy -s y <LV_NAME> 2
Create the boot image on the new disk and put it on the bootlist
# bosboot -ad /dev/hdisk1
bosboot: Boot image is 25166 512 byte blocks.
bootlist -m normal hdisk0 hdisk1
|
Confirming that all of the volumes are on the boot image
# lsvg -p rootvg
rootvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk1 active 546 186 00..00..00..77..109
hdisk0 active 546 186 00..00..00..77..109
|
Logical Volume
Manager (LVM) Commands for AIXFilesystem Procedures
Procedure to create a filesystem using JFS:
- See below the procedure for creating a logical volume and a filesystem
using JFS:
Extend the size of filesystem :
- "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>
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
Create a logical volume and filesystem in
a volume group:
- 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
Volume Group Procedures
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:
Logical Volume Manager
During the early stages of UNIX®, the management of physical disks was
always a daunting task because of the restrictions on allocating the actual
physical space. You'd have to define physical partitions, and each physical
partition would actually be of a fixed size. Additionally, a physical disk
could only have eight physical partitions, so the customer had to select
the correct size of each partition before installing the system.
A major restriction of the physical partition was that each partition
had to be contiguous; meaning you could not span multiple drives. What evolved
from this messy picture was a new, flexible technique to manage the allocation,
known as logical volumes. Here are some of the benefits:
- Logical volumes solve non-contiguous space problems.
- Logical volumes can span multiple disks.
- The size of logical volumes can dynamically increase.
- You can relocate and mirror them.
AIX and Solaris offer different methods for using logical volumes. With
Solaris, it does not come ready out of the box. You need to determine which
LVM to use, and decide whether or not to use SVM or VERITAS. While VERITAS
offers the VERITAS Foundation suite for AIX 5L™, it is typically not used
in AIX environments, as it is not necessary. VERITAS Volume Manager (VxVM)
is a storage management subsystem that enables you to manage physical disks
as logical devices called volumes. It is important to reiterate that this
product is third-party software, and you will pay handsomely for it.
The LVM has been a feature of the AIX operating system since Version
3, and it is installed automatically with the operating system.
Table 1 helps lay out some of the differences between
AIX and VERITAS, and it also compares the commands (for the complete table,
see Resources). While the version numbers might
be different, the concepts and commands remain the same.
Figure 1 illustrates how the physical disk
relates to the actual logical partitions.
Transition from Solaris to AIX
AIX File Structure
Volume Logical Tips
Copyright © 1996-2009 by Dr. Nikolai Bezroukov.
www.softpanorama.org was
created as a service to the UN Sustainable Development Networking Programme (SDNP)
in the author free time.
Submit
comments This document is an industrial compilation designed and created
exclusively for educational use and is placed under the copyright of the
Open Content License(OPL).
Site uses AdSense so you need to be aware of Google privacy policy. Original materials copyright belong to respective owners. Quotes are made
for educational purposes only in compliance with the fair use doctrine.
Disclaimer:
- The statements, views and opinions presented on
this web page are those of the author and are not endorsed by, nor do they necessarily
reflect, the opinions of the author present and former employers, SDNP or any other
organization the author may be associated with.
- We do not warrant the correctness of the information provided or its
fitness for any purpose
- In no way this site is associated with or endorse cybersquatters
using
the term "softpanorama" with other main or country domains (e.g. softpanorama.com) with
bad faith intent to profit from the goodwill belonging to
someone else.
Last modified:
August 15, 2009