Initial LVM howto - bits of practical knowledge
How many free space is available in a particular VG?
$ lsvg rootvgVOLUME GROUP: rootvg VG IDENTIFIER: 005529fc00004c000000012aee01c41bVG STATE: active PP SIZE: 64 megabyte(s)VG PERMISSION: read/write TOTAL PPs: 1094 (70016 megabytes)MAX LVs: 256 FREE PPs: 330 (21120 megabytes)LVs: 18 USED PPs: 764 (48896 megabytes)OPEN LVs: 17 QUORUM: 1 (Disabled)TOTAL PVs: 2 VG DESCRIPTORS: 3STALE PVs: 0 STALE PPs: 0ACTIVE PVs: 2 AUTO ON: yesMAX PPs per VG: 32512MAX PPs per PV: 1016 MAX PVs: 32LTG size (Dynamic): 256 kilobyte(s) AUTO SYNC: noHOT SPARE: no BB POLICY: relocatablePV RESTRICTION: noneSo you have TOTAL PPs: 1094 (70016 megabytes) = 70GB total and FREE PPs: 330 (21120 megabytes) =20GB free in this volume group, rootvg.
The actual usable amount is determined by mirroring.
$ lsvg -l rootvgrootvg:LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINThd5 boot 1 2 2 closed/syncd N/Ahd6 paging 32 64 2 open/syncd N/Ahd8 jfs2log 1 2 2 open/syncd N/Ahd4 jfs2 4 8 2 open/syncd /hd2 jfs2 32 64 2 open/syncd /usrhd9var jfs2 16 32 2 open/syncd /varhd3 jfs2 4 8 2 open/syncd /tmphd1 jfs2 4 8 2 open/syncd /homehd10opt jfs2 8 16 2 open/syncd /optTaking a look at LP -> PP proportions, you may say that every LV (under every FS) has two copies.
Mirroring is defined per LV, not for the whole VG.
You have:
- 20GB of free space for an unmirrored new LV, or
- 10GB of free space if you want to keep the new LV mirrored, or
- 10GB for extending existing mirrored LVs (= filesystems).
Should you have to increase anything by PPs (physical partitons) - for example, paging space with chps - , refer to 'PP SIZE' in the lsvg output.
Which VG contains my filesystem?
lsvg | lsvg -ilshould give a listing of every LV/FS known to AIX at the moment.
If you go from the filesystem toward the VG, these are the required steps:
df /myfs or lsfs /myfs -> get the LV name
lslv mylv (without /dev/) -> get the VG name
See also: lsvgfs
What size are my disks?
$ lsvg -p rootvgrootvg:PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTIONhdisk0 active 547 165 00..00..00..55..110hdisk1 active 547 165 00..00..00..55..110You need to know the PP size defined for the VG. Here, 547 PPs of 64MB make up the 36GB PVs (disks).
The PP size of the rootvg is defined automatically during installation.
The (deprecated) bootinfo command can be used for any disk, including those not belonging to any VG:
bootinfo -s hdisk0
Parameters
Sorry about the look, I will try to improve it later.
...
Is a certain filesystem in frozen state?
Freezing a JFS2 filesystem works this way:
chfs -a freeze=120 /freezeThe fsdb utility shows the FM_CLEANQUIESCED flag with the 'su(perblock)' command:
> su[1] s_magic: 'J2FS' [18] s_fscklog: 1[2] s_version: 2 [19] s_fsckloglen: 50[3] s_size: 0x000000000007fe58 [20] s_bsize: 4096[4] s_logdev: 0x8000000a00000003 [21] s_logserial: 0x0000000d[5] s_l2bsize: 12 [22] s_logpxd.len: 0[6] s_l2bfactor: 3 [23] s_logpxd.addr1: 0x00[7] s_pbsize: 512 [24] s_logpxd.addr2: 0x00000000[8] s_l2pbsize: 9 s_logpxd.address: 0[9] s_rsv: Not Displayed [25] s_fsckpxd.len: 53[10] s_agsize: 0x00002000 [26] s_fsckpxd.addr1: 0x00[11] s_flag: 0x00000100 [27] s_fsckpxd.addr2: 0x0000ffcb s_fsckpxd.address: 65483 [28] s_ait.len: 4 J2_GROUPCOMMIT [29] s_ait.addr1: 0x00 [30] s_ait.addr2: 0x0000000b s_ait.address: 11[12] s_state: 0x00001001 [31] s_fpack: 'freeze' FM_MOUNT FM_CLEANQUIESCED [32] s_fname: ''[13] s_time.tj_sec: 0x0000000050a674c0 [33] s_time.tj_nsec: 0x00000000[14] s_ait2.len: 4 [34] s_xfsckpxd.len: 0[15] s_ait2.addr1: 0x00 [35] s_xfsckpxd.addr1: 0x00[16] s_ait2.addr2: 0x0000001d [36] s_xfsckpxd.addr2: 0x00000000 s_ait2.address: 29 s_xfsckpxd.address: 0[17] s_xsize: 0x0000000000000000 [37] s_xlogpxd.len: 0[40] feature_compat: 0x0000000000000001 [38] s_xlogpxd.addr1: 0x00[41] feature_rdonly: 0x0000000000000000 [39] s_xlogpxd.addr2: 0x00000000[42] feature_incompat: 0x0000000000000000 s_xlogpxd.address: 0[43-49] <...snapshot info...> [50] s_maxext: 0x00000000So, to detect this, here is an example:
# echo "su\n" | fsdb /freeze 2>&1 | grep -q FM_CLEANQUIESCED && echo "FS is frozen"There is a new errpt enrty logged each time a filesystem freeze period expires:
LABEL: J2_FREEZE_TIMEOUTIDENTIFIER: 86CA9D0CClass: OType: INFOResource Name: SYSJ2DescriptionFILE SYSTEM FREEZE TIMEOUT EXPIRED. FILE SYSTEM IS THAWED.Probable CausesFREEZE TIMEOUT REQUESTED TOO SHORTDetail DataJFS2 MAJOR/MINOR DEVICE NUMBER000A 000BFILE SYSTEM DEVICE AND MOUNT POINT/dev/freezelv, /freezeManage mirror pools
Mirror pools provide an efficient method of separating LUNs from different sides of a redundant storage.
Things like running cfgmgr, identifying disks and sizes etc are not mentioned here.
Make sure you adjust disk parameters before assigning them to VGs because most of them requires re-initialization of disks (rmdev/mkdev).
Make sure you record LUN IDs for the storage admins before removing them.
I assume that new disk devices are available.
Example: "myvg" with 2x3 LUNs in VG mirror, migrated to 2x1 LUNs. Pool names speak for themselves.
Pool layout
# lsvg -P myvgPhysical Volume Mirror Poolhdisk1 oldpool1hdisk2 oldpool2hdisk3 oldpool1hdisk4 oldpool2hdisk5 oldpool1hdisk6 oldpool2You can have a maximum of 3 pools at once. Add newpool1 and build 3rd mirror copy.
# extendvg -p newpool1 myvg hdisk101# mirrorvg -S -c 3 -p copy1=oldpool1 -p copy2=oldpool2 -p copy3=newpool1 myvg hdisk101Check if mirroring has finished (STALE PPs should be 0)
# lsvg myvg | grep STALERemove oldpool1 disks
# unmirrorvg -c 2 myvg hdisk1 hdisk3 hdisk5# reducevg myvg hdisk1 hdisk3 hdisk5# for d in hdisk1 hdisk3 hdisk5; do rmdev -dl $d; doneRepeat for newpool2 and oldpool2
# extendvg -p newpool2 myvg hdisk201# mirrorvg -S -c 3 -p copy1=oldpool2 -p copy2=newpool1 -p copy3=newpool2 myvg hdisk201# lsvg myvg | grep STALE# unmirrorvg -c 2 myvg hdisk2 hdisk4 hdisk6# reducevg myvg hdisk2 hdisk4 hdisk6# for d in hdisk2 hdisk4 hdisk6; do rmdev -dl $d; doneResulting layout
# lsvg -P myvgPhysical Volume Mirror Poolhdisk101 newpool1hdisk201 newpool2Low level command flags
lqueryvg -g -c VG's number of disks
lqueryvg -g -n VG's number of LVs
lqueryvg -g -P VG's PVIDs
lqueryvg -g -s/S? PP size
getlvodm –C (lspv)
getlvodm -e LV name
getlvodm -m LV mount point
getlvodm -y LV type
getlvodm -c LV copies
getlvodm -N stripped or not
getlvodm -v VGID
getlvodm -g name of (one) PV
getlvodm -L all LVs/LVIDs of a VG
getlvcb -AT all information about the LV
getlvcb -a intrA-physical volume allocation policy
getlvcb -c copies
getlvcb -f file system name
getlvcb –L label
getlvcb -r inteR-physical volume allocation policy
getlvcb –P stripe expn
getlvcb –S striping width
getlvcb -s strictness
getlvcb –t type of filesystem
getlvcb –u upper limit
---
...