LVM – PV 指令

pvcreate 將實體的分割區轉換成 Physical Volume
# pvcreate /dev/sdb1
  Physical volume “/dev/sdb1” successfully created

pvdisplay 顯示 PV 相關資訊
# pvdisplay /dev/sdb1
  — Physical volume —
  PV Name               /dev/sdb1
  VG Name               diskvg
  PV Size               1.00 GiB / not usable 4.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              255
  Free PE               141
  Allocated PE          114
  PV UUID               CblZP6-Xks3-1TwD-E26S-iBkW-2c4f-zzj3vb

[@more@]pvscan 掃描系統中所有的 PV 資訊
# pvscan
  PV /dev/sdb1   VG diskvg   lvm2 [1020.00 MiB / 564.00 MiB free]
  PV /dev/sdb2   VG diskvg   lvm2 [1020.00 MiB / 1020.00 MiB free]
  PV /dev/sdb3   VG diskvg   lvm2 [1020.00 MiB / 1020.00 MiB free]
  Total: 3 [2.99 GiB] / in use: 3 [2.99 GiB] / in no VG: 0 [0   ]

pvmove 搬移 Physical Volume 內的資料
# pvmove [-n <lv>] < source pv> [<destination pv>]
pvmove 這個並不是搬移 PV,而是搬移 PV 內的資料,其實就是將 PV 中的 PE 資料搬移到同一個 VG 中的另一個 PV 內(註:一定要在同一個 VG 內的 PV),這個指令通常是用於我們要將某個 PV 從 VG 中移除時(註:利用 vgreduce 指令時),先將 PV 中的資料搬移到另一個 PV 之中,再進行移除 PV 的動作。

pvremove 移除 PV
# pvremove /dev/sdb1 /dev/sdb2 /dev/sdb3
Labels on physical volume “/dev/sdb1” successfully wiped
Labels on physical volume “/dev/sdb2” successfully wiped
Labels on physical volume “/dev/sdb3” successfully wiped