CentOS 6
Sponsored Link

Manage Phisical Volumes2015/07/18

 
This is the basic operation of managing Phisical Volumes.
It needs to create LVM type partiton first.
[1] Create Phisical Volume.
[root@dlp ~]#
pvcreate /dev/sdb1

  Physical volume "/dev/sdb1" successfully created
# specify like follows if you'd like to specify volume size

[root@dlp ~]#
pvcreate --setphysicalvolumesize 50G /dev/sdb1

  Physical volume "/dev/sdb1" successfully created
[2] Display Phisical Volumes.
[root@dlp ~]#
pvdisplay /dev/sdb1

  PV Name               /dev/sdb1
  VG Name
  PV Size               80.00 GiB
  Allocatable           NO
  PE Size               0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               PJnOPg-9KwO-5xJz-Z8tn-9zP7-VKn5-ADrGzy
[3] Change size of Phisical Volume.
# change to 50G

[root@dlp ~]#
pvresize --setphysicalvolumesize 50G /dev/sdb1

  Physical volume "/dev/sdb1" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized
[root@dlp ~]#
pvdisplay /dev/sdb1

  PV Name               /dev/sdb1
  VG Name
  PV Size               50.00 GiB
  Allocatable           NO
  PE Size               0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               PJnOPg-9KwO-5xJz-Z8tn-9zP7-VKn5-ADrGzy
[4] Display reports of Phisical Volumes.
[root@dlp ~]#
pvs /dev/sdb1

  PV         VG   Fmt  Attr PSize  PFree
  /dev/sdb1       lvm2 ---  80.00g 80.00g
[5] Scan Phisical Volumes.
[root@dlp ~]#
pvscan

  PV /dev/vda2   VG centos   lvm2 [49.51 GiB / 0    free]
  PV /dev/sdb1               lvm2 [80.00 GiB]
  Total: 2 [129.51 GiB] / in use: 1 [49.51 GiB] / in no VG: 1 [80.00 GiB]
[6] Delete Phisical Volume.
[root@dlp ~]#
pvremove /dev/sdb1

  Labels on physical volume "/dev/sdb1" successfully wiped
[root@dlp ~]#
pvdisplay /dev/sdb1

  Failed to find physical volume "/dev/sdb1".
Matched Content