VG Commands in Linux - LVM interview Question

 

VG Related command tips in Linux


This post will help you to keep remember Volume Group - VG related commands in Linux at the time of interview Preparation.

Display Volume Group


vgdisplay -v
vgs -v
vgs -a -o +devices

vgs flags:


#PV - number of physical devices
#LV - number of configured volumes       

vgs attributes are:
1. permissions (r)|(w)
2. resi(z)eable
3. e(x)ported
4. (p)artial
5. allocation policy - (c)ontiguous, c(l)ing, (n)ormal, (a)nywhere, (i)nherited
6. (c)luster

Create VG :


vgcreate VolData00 /dev/sdb1 /dev/sdb2 /dev/sdb3
vgcreate VolData00 /dev/sdb[123]

## Use 32MB extent size

# vgcreate VGName -s 32 /dev/sdb1

Common Attributes that you may want to use:

-l  maximum logical volumes
-p maximum physical volumes
-s physical extent size (default is 4MB)
-A autobackup 


Extend / Reduce / Remove  Volume Group :

vgextend VGName /dev/sdb3

vgreduce VGName /dev/sdb3

vgreduce --removemissing --force VolData00

vgremove VGName

Change in VG :


vgchange -a n VolData00

Common Attributes that you may want to use:

-a control availability of volumes within the group
-l  maximum logical volumes
-p maximum physical volumes
-s physical extent size (default is 4MB)
-x resizable yes or no (see VG status in vxdisplay)

Check and rename Volume Group :


#vgrename VGName VGName_New   //no LV should be activate at the time of rename

#vgck VolData00       //checking consistency of Meta data


Convert / Merge / Split  Volume Group:


#vgconvert -M2 VGName  //convert one type to anothe type (lvm1 to lvm2)

#vgmerge New_Vol_Group Old_Vol_Group  /old vg will be merged to new VG

#vgsplit Old_Vol_Group New_Vol_Group [physical volumes] [-n logical volume name]


Import / Export Volume Group


#vgimport VGName

#vgexport VGName

Backup and Restore:


# vgcfgbackup VGname

# vgcfgrestore -f /var/backup/VGname_bkup VGName









0 comments:

Post a Comment

Blogger Tips and TricksLatest Tips And TricksBlogger Tricks