Friday, 31 August 2012

Logical Volume Manager Commands

LVM COMMANDS

VG Commands:

lsvg                                        Display all VGs

lsvg -o                                      Display all active VGs

lsvg rootvg                                  Display info about rootvg

lsvg  -l rootvg                              Display info about all LVs in rootvg

lsvg -o |lsvg -il                            Display info about all LVs in all VGs

lsvg  -p rootvg                              Display info about all PVs in rootvg

mkvg  -s 8 hdisk1                          Create VG with name vgxx on hdisk1 with partition size 8MB

mkvg -s 8 -y sivg hdisk1                     Create VG with name sivg on hdisk1 with partition size 8MB

mkvg -s 4 -t 2 -y sivg hdisk1              Create sivg on hdisk1 with PP size 4 and no of partions 2 * 1016

chvg -a y newvg                            To cuase VG newvg automatically activated at startup

chvg -a n newvg                            To deactivate the automatic activation at startup

chvg -t 2 newvg                           To change maximum no. of PP to 2032 on vg newvg

chvg -Q n newvg                           To disable quorum on VG newvg

reorgvg  newvg                            Reorganises PP allocation of  VG newvg

extendvg newvg hdisk3 hdisk4              Add PV hdisk3 and hdisk4 to VG newvg

exportvg newvg                            Exports the VG newvg

importvg -V 44 -y newvg   hdisk2            Import the hdisk2 with name  newvg, and assign major number 44

redcucevg newvg hdisk3                    Remove PV hdisk3 from VG newvg

varyoffvg newvg                                 To deactviate VG newvg

varyonvg newvg                                  To activate VG newvg

syncvg -v sivg                                       To sync the mirrored LV in the VG sivg

mirrorvg -S -m sivg hdisk2                 To mirror LVs of sivg with hdisk2 (-m for exact mirror, -S 

forbackground  mirror)

unmirrorvg sivg hdisk2                       To remove the mirrored PV from the set.


FILE SYSTEM COMMANDS:

lsfs                                                          Lists all filesystems in the /etc/filesystems entry

lsfs -q                                                     List all filesystems with detailed info

lsfs -a                                                     To list all filesystems (default)

lsfs -l                                                       Specify the output in list format

lsfs -c                                                      Specify the output in column format

lsfs -v jfs                                                Lists all jfs filesystems

chfs -a size=24576 /si                         Change size of FS /si to 24576 x 512 bytes blocks (12 MB)

chfs -a size=+24576 /si                       Add 24576 x 512 byte blocks to FS /si

chfs -m /si /bi                                        Change the mount point from /si to /bi

chfs -A /si                                              To auto mount the filesystem si

chfs -d account /si                               Remove account attribute of /si. ( from /etc/filesystems file)

chfs -a splitcopy=/backup -a copy=2 /oracle  This will mount the 2nd copy of mirrored filesystem oracle to 

/backup in read-only mode

crfs -v jfs -g testvg -a size=64465 -m /SHIVA    Creates FS /SHIVA of type jfs in VG testvg of blocksize 64465

crfs -v jfs -d /dev/lv00 -m /SHIVA  Create FS /SHIVA of type jfs on device /dev/lv00

rmfs /SHIVA                                        Deletes FS /SHIVA and associated LV

rmfs -r /SHIVA                                    Deletes FS /SHIVA its mount point and associated LV

defragfs /sifs                                         To defragment the file system /sifs

defragfs -q /sifs                                    Display the current defrag status of the file system

fsck  -y n /dev/lv00                             To fsck the filesystem associated to /dev/lv00 assuming response "yes"

fsck -p /dev/lv00                                 To restore superblock from backup superblock  


PV COMMANDS:


lspv hdisk0                                            Display status and characteristics of the PV

lspv -p hdisk0                                       Display  PP usage of hdisk0                                                              

lspv -l hdisk0                                        To list all logical volumes on PV hdisk0

chpv -v r hdisk1                                   Close the PV (Used while removing PV without varyon)

chpv -v a hdisk1                                  Open the PV

chpv -c hdisk0                                      Clear the master boot record on PV hdisk0

migratepv  hdisk1 hdisk2                   To move PPs from PV hdisk1 to hdisk2

migratepv -l silv hdisk1 hdisk2         To migrate LV silv from PV hdisk1 to hdisk2



LV COMMANDS:

lslv -l lv00                                              Display info about LV by PV

lslv -p hdisk1                                        Display LV allocation map for hdisk1

chlv -t copy lv00                                  To change the lv00 to copy type

chlv -p r lv00                                        To change the lv00 to readonly mode

rmlv silv                                                 To remove silv

rmlv -f silv                                             To remove silv without user intervention

mklv  -s n -c 3 silv hdisk1                   To make LV silv  with three copies on hdisk1

extendlv  silv 5                                     To extend the LV silv with 5 LPs

mklvcopy -s n lvsi 2 hdisk1               To mirror LV lvsi on same PV with 2 copies

mklvcopy lvsi 3 hdisk1 hdisk2         To mirror LV lvsi on PV hdisk1 and hdisk2 with 3 copies

rmlvcopy lvsi 2 hdisk1                       Will remove one copy of  LV lsvi from hdisk1 

mklv -t jfslog -y log00 newvg 2        To create a jfslog with name log00 on VG newvg with 2LPs

logform /dev/log00                             To format jfslog volume log00




No comments:

Post a Comment