|
Softpanorama |
May the source be with you, but remember the KISS principle ;-)
Softpanorama Search
|
LVM stands for Logical Volume Manager and JFS is a Journaled File System.
The role of LVM is to present a simple logical view of underlying physical storage space, ie. harddrive(s). LVM manages individual physical disks - or to be more precise, the individual partitions present on them (for a short glossary of terms, look at the end of the article). LVM hides the numbers, size and location of physical partitions from users. Instead it presents the concept of logical volume. A logical volume may correspond to a physical partition (but that obviously almost defeats the purpose of LVM) but it doesn't have to. One volume may be composed of several partitions located on multiple physical disks. Not only that, the volumes can even be extended (not shrunk - people usually want more space, not less). They can even be extended while the OS is running and the filesystem is being accessed! Of course, most home and SOHO users don't have the hardware required for this.
The more experienced readers are now probably wondering how 'traditional' file systems like FAT or HPFS could be extended at runtime. The answer is, they can't. To take full advantage of LVM, it is necessary to use a filesystem designed for it. This file system is of course JFS. JFS is not really tied to LVM, both LVM and JFS can exist separately, but only when working in concert both can reach their full potential.
The following is a list of the common features in the LVM and VxVM methods of storage management:
Both VxVM and LVM enable file systems to be expanded while the file system is mounted and in use. Both volume managers are tied closely to specific file systems. VxVM only works with the Veritas File System, and LVM only works with the JFS or JFS2 (enhanced JFS) file system found on AIX. The one difference between VxVM and LVM is the philosophy on the concept of file system shrinkage. LVM/JFS/JFS2 does not allow the user the ability to shrink the file system. The reasoning behind this is that sometimes portions of files are spread out over the file system for performance reasons. And when a file system needs to be shrunk, the file system must go out and gather up the "pieces" of a file and relocate them to a portion of the file system that will not be eliminated. This method is time-consuming and not very efficient for performance. Thus on AIX, file system reduction is not permitted on JFS and JFS2.
VxVM takes a different approach to this. It does allow the reduction of a file system size, but it is very simplistic and has drawbacks. They literally "chop" off the end of the logical volume and file system up to the point where the user wants the file system reduced. Warnings are included in the VxVM product regarding this practice; if the user has data at the end of the file system, the data may be corrupted or lost. Thus, for the purposes of this paper, the ability of VxVM to reduce file system size is considered limited.
Terminology:
Terminology:
Advantages:
Limitations:
File system - allocate more space
- chfs -a size='+500' /usr/acct (To enlarge file system)
- Use chlv -x 256 <lv-name> if you get an errorwhen running the above command (To expand beyond maximum LV's)
Logical Volumes striping
- From AIX 4.3.3 (not backward compatible) LVM support striping
- Often called fine striping (i.e. not PP level striping)
- Recommend 32K, 64K or 128K stripe width = 4 to 16 times I/O size most databases do 4K or 8K I/O
- Excellent for balancing serial and random I/O across disks
- Excellent read ahead serial I/O boost
Using LVM commands (with smit)
- Find unused disks: lspv
- Add them to a VG or create a VG: smitty lvm + VG + Add VG
- Check unused space in VG: lsvg <vgname>
- Create a LV: smitty lvm + LV + Add LV
- Create a Filesystem (JFS)smitty jfs + Add jfs + standard + which VG (see below)
If the command changes the VG, PV or LV then the VG is locked i.e. one command at a time.
This is needed to allow recovery of the change - if the system fails during the update.Creating Stripes Tips:
- Stripes LV must contain a whole number of items, that is the number of PPs must divide evenly into the number of disks
- Or put another way: each disk have the same number of PPs
- Hint: use multiples of No. of disks to make this easier
LVM Create Mirrors
There are three ways to create a mirror:
- One Step = create LV with mirror
- These can be slow as you can have to wait until mirror complete before creating next lv
- Create LV and later add mirror synchronise=yes
- again slow as you can have to wait for silvering
#Create LV and later add mirror synchronise=no and then sychronise all mirrors together- Use this when creating lots of lv because all mirrors can be created at the same time
So (with smit)
- create lv's
- add mirrors sync=no
- syncvg -l <lvname>
to remove "stale" partitions = resilver
Warning:
- resilvering hurts performance
- often forgotten when recommending mirror breaking for backup purposes
LVM Higher Level Management Commands
Disown disks ready to connect them to another system
- varyoffvg <vgname>
- exportvg <vgname>
or smitty lvmActivate newly attached disks
- cfgmgr – finds disks
- importvg hdiskN – any one of the disks
- varyonvg <vgname> – mounts file systems
Moving LVs
migratelv (not striped)
- Use smit lvm
- Can migrate LV on a disk to another disk
- Can empty whole disk to remove it later or replac a fault disk
Disks can be added and removed from a VG- extendvg and reducevg
- Use smit lvm recommended
LVM rootvg good practice
Small rootvg - 1 or 2 disks (for mksysb backup)
Mirror rootvg for AIX disk protection
- Add disk hdisk1
- chvg -Qn rootvg
- For hd1 to hd8 and hd9var copy the LV
- mklvcopy hd{1,2,3,4,5,6,7,8,9var} 2 hdisk1
- syncvg -v rootvg
- bosboot -a
- bootlist -m normal hdisk0 hdisk1
Or- mirrorvg -s rootvg
- this second option is recommended
TIP: This command will show you formatted list of active Volume groups
for i in $(lsvg -o);do lsvg $i;done \ | awk ' BEGIN { printf("%-10s\t%10s\t%10s\t%10s\t%10s\n","VG","Total(MB)","Free","USED","Disks") };/VOLUME GROUP:/ \ { printf("%-10s\t", $3) };/TOTAL PP/ { B=index($0,"(") + 1;E=index($0," megaby");D=E-B;printf("%10s\t", substr($0,B,D) );};/FREE PP/ \ { B=index($0,"(") + 1;E=index($0," megaby");D=E-B;printf("%10s\t", substr($0,B,D) );};/USED PP/ \ { B=index($0,"(") + 1;E=index($0," megaby");D=E-B;printf("%10s\t", substr($0,B,D) );};/ACTIVE PV/ { printf("%10s\t\n", $3) } 'Put other disks into other volume groups
- use min PP size ( 8MB or 16 MB)
- use 16 to 32 disks per volume group
- use different vg for data that might be moved elsewhere
Avoid hot disks- Spread data across disk with LVs or RAID5
- Mirrors add protection and performance
- Use striping whenever possible
- Think spindles not disk size
reorgvg- this will move physical partitions (PP) around in an attempt to get PPs in the right place
migratepv- this can be used to spread PPs across move disks
- also to remove all PPs from a suspect disk before replacement (due to errors being reported)
AVOIDING Disk Crashes
- Rule One: RAID5 or mirror everything
- Rule Two: monitor error logs. Make sure you know when a disk failed
- Rule Three: call hardware support. That is what they are for
- Rule Four: Don't meddle. Only try, if you know what you are doing
- Rule Five: Read and practise. Get the Redbooks and try it safely
http://www.networktechnologist.com/tips-aix-lvm.html
http://web.utanet.at/mario/exam/5129fm.htm#tocbrvH1 - old (AIX 4.3 but good
description) http://www.redbooks.ibm.com/redbooks/SG246584/
Chapter 5. Device management
5.1 Overview
5.2.2 Managing device drivers
5.2.3 Configuring a device
5.2.4 Adding a new device to a SCSI bus
5.2.5 Remove a SCSI device
5.3 Device management in AIX 5L Version 5.1
5.3.1 Listing devices
5.3.3 Removing a device
5.3.4 Changing a device
5.4 Quick reference
Chapter 6. Logical Volume Manager and disk management
6.1 Logical volume management overview
6.2 Introducing the logical volume solutions
6.2.1 Solaris Solstice DiskSuite: Introduction
6.2.2 VERITAS Volume Manager: Introduction
6.2.3 AIX 5L Version 5.1 LVM: Introduction
6.3 Working with logical volume manager
6.3.1 Volume groups
6.3.2 Working with logical volumes
6.3.3 Working with physical disks
6.3.4 Additional features: Hotspare disks
Chapter 7. File system management
7.1.1 Solaris file systems types and commands
7.1.2 AIX file systems types and commands
7.2 Formatting and partitioning a disk (Solaris only)
| 7.4 Mounting and unmounting a file system |
| 7.5 Checking file system consistency |
| 7.6 Changing file system attributes |
| Chapter 8. Backup and restore |
Chapter 6. Logical Volume Manager and disk management
|
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 |
Definition |
|---|---|
| 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 |
| 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. |
Procedure to list the PVs in a volume group:
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:
Last modified: August 15, 2009