Scientific Linux 6
Sponsored Link

Volume Group2011/05/09

[1] Create a Volume Group
[root@dlp ~]#
vgcreate vg_dlp /dev/sdb1
 
# create a Volume group 'vg_dlp'

  Volume group "vg_dlp" successfully created

# insert a space like follows if you specify some devices

[root@dlp ~]#
vgcreate vg_dlp /dev/sdb1 /dev/sdd1

  Volume group "vg_dlp" successfully created
[2] Display Volume Groups
[root@dlp ~]#
vgdisplay

  --- Volume group ---
  VG Name
vg_dlp

  System ID
  Format
lvm2

  Metadata Areas
1

  Metadata Sequence No
1

  VG Access
read/write

  VG Status
resizable

  MAX LV
0

  Cur LV
0

  Open LV
0

  Max PV
0

  Cur PV
1

  Act PV
1

  VG Size
100.00 GiB

  PE Size
4.00 MB

  Total PE
25599

  Alloc PE / Size
0 / 0

  Free PE / Size
25599 / 100.00 GiB

  VG UUID
eoFugC-cEfQ-0qeq-xMuu-yynx-wZA0-qTMt3x
[3] Rename a Volume Group
[root@dlp ~]#
vgrename vg_dlp vg_data
 
# change name from 'vg_dlp' to new name 'vg_data-7'


  Volume group "vg_dlp" successfully renamed to "vg_data"
[root@dlp ~]#
vgdisplay

  --- Volume group ---
  VG Name
vg_data

  System ID
  Format
lvm2

  Metadata Areas
1

  Metadata Sequence No
1

  VG Access
read/write

  VG Status
resizable

  MAX LV
0

  Cur LV
0

  Open LV
0

  Max PV
0

  Cur PV
1

  Act PV
1

  VG Size
100.00 GiB

  PE Size
4.00 MB

  Total PE
25599

  Alloc PE / Size
0 / 0

  Free PE / Size
25599 / 100.00 GiB

  VG UUID
eoFugC-cEfQ-0qeq-xMuu-yynx-wZA0-qTMt3x
[4] Output reports of Volume Groups
[root@dlp ~]#
vgs

  VG
#PV
#LV
#SN
Attr
VSize
VFree

  vg_data
  1
0
0
wz--n-
100.00g
100.00g

  vg_dlp
  1
3
0
wz--n-
29.51g
0

[5] Scan Volume Groups
[root@dlp ~]#
vgscan

  Reading all physical volumes. This may take a while...
  Found volume group "vg_data" using metadata type lvm2
  Found volume group "vg_dlp" using metadata type lvm2
[6] Extend a Volume Group
[root@dlp ~]#
vgextend vg_data /dev/sdc1
 
# add sdc1 in vg_data

  Volume group "vg_data" successfully extended
[root@dlp ~]#
vgdisplay

  --- Volume group ---
  VG Name
vg_data

  System ID
  Format
lvm2

  Metadata Areas
2

  Metadata Sequence No
4

  VG Access
read/write

  VG Status
resizable

  MAX LV
0

  Cur LV
0

  Open LV
0

  Max PV
0

  Cur PV
2

  Act PV
2

  VG Size
199.99 GiB

  PE Size
4.00 MB

  Total PE
51198

  Alloc PE / Size
0 / 0

  Free PE / Size
51198 / 199.99 GiB

  VG UUID
eoFugC-cEfQ-0qeq-xMuu-yynx-wZA0-qTMt3x


[7] Reduce a Volume Group
[root@dlp ~]#
vgreduce vg_data /dev/sdc1
 
# remove sdc1 from vg_data

  Removed "/dev/sdd1" from volume group "vg_data"
[root@dlp ~]#
vgdisplay

  --- Volume group ---
  VG Name
vg_data

  System ID
  Format
lvm2

  Metadata Areas
1

  Metadata Sequence No
5

  VG Access
read/write

  VG Status
resizable

  MAX LV
0

  Cur LV
0

  Open LV
0

  Max PV
0

  Cur PV
1

  Act PV
1

  VG Size
100.00 GiB

  PE Size
4.00 MB

  Total PE
25599

  Alloc PE / Size
0 / 0

  Free PE / Size
25599 / 100.00 GiB

  VG UUID
eoFugC-cEfQ-0qeq-xMuu-yynx-wZA0-qTMt3x


[8] Remove a Volume Group
[root@dlp ~]#
vgchange -a n vg_data
 
# turn non-active first

  0 logical volume(s) in volume group "vg_data" now active
[root@dlp ~]#
vgremove vg_data
 
# remove vg_data

  Volume group "vg_data" successfully removed
Matched Content