Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

5.4. 由​​​​​​​邏​​​​​​​輯​​​​​​​卷​​​​​​​冊​​​​​​​中​​​​​​​移​​​​​​​除​​​​​​​磁​​​​​​​碟​​​​​​​

此​​​​​​​範​​​​​​​例​​​​​​​顯​​​​​​​示​​​​​​​了​​​​​​​如​​​​​​​何​​​​​​​將​​​​​​​磁​​​​​​​碟​​​​​​​由​​​​​​​現​​​​​​​有​​​​​​​的​​​​​​​邏​​​​​​​輯​​​​​​​卷​​​​​​​冊​​​​​​​中​​​​​​​移​​​​​​​除​​​​​​​(為​​​​​​​了​​​​​​​更​​​​​​​換​​​​​​​磁​​​​​​​碟​​​​​​​或​​​​​​​是​​​​​​​使​​​​​​​用​​​​​​​該​​​​​​​磁​​​​​​​碟​​​​​​​來​​​​​​​作​​​​​​​為​​​​​​​不​​​​​​​同​​​​​​​卷​​​​​​​冊​​​​​​​的​​​​​​​一​​​​​​​部​​​​​​​分​​​​​​​)。​​​​​​​若​​​​​​​要​​​​​​​移​​​​​​​除​​​​​​​磁​​​​​​​碟​​​​​​​,您​​​​​​​首​​​​​​​先​​​​​​​必​​​​​​​須​​​​​​​將​​​​​​​ LVM 實​​​​​​​體​​​​​​​卷​​​​​​​冊​​​​​​​上​​​​​​​的​​​​​​​扇​​​​​​​區​​​​​​​移​​​​​​​至​​​​​​​一​​​​​​​個​​​​​​​或​​​​​​​一​​​​​​​組​​​​​​​不​​​​​​​同​​​​​​​的​​​​​​​磁​​​​​​​碟​​​​​​​中​​​​​​​。​​​​​​​

5.4.1. 將​​​​​​​扇​​​​​​​區​​​​​​​移​​​​​​​至​​​​​​​現​​​​​​​有​​​​​​​的​​​​​​​實​​​​​​​體​​​​​​​卷​​​​​​​冊​​​​​​​中​​​​​​​

在​​​​​​​此​​​​​​​範​​​​​​​例​​​​​​​中​​​​​​​,邏​​​​​​​輯​​​​​​​卷​​​​​​​冊​​​​​​​被​​​​​​​分​​​​​​​配​​​​​​​至​​​​​​​ myvg 卷​​​​​​​冊​​​​​​​群​​​​​​​組​​​​​​​中​​​​​​​的​​​​​​​四​​​​​​​個​​​​​​​實​​​​​​​體​​​​​​​卷​​​​​​​冊​​​​​​​上​​​​​​​。​​​​​​​
[root@tng3-1]# pvs -o+pv_used
  PV         VG   Fmt  Attr PSize  PFree  Used
  /dev/sda1  myvg lvm2 a-   17.15G 12.15G  5.00G
  /dev/sdb1  myvg lvm2 a-   17.15G 12.15G  5.00G
  /dev/sdc1  myvg lvm2 a-   17.15G 12.15G  5.00G
  /dev/sdd1  myvg lvm2 a-   17.15G  2.15G 15.00G
我​​​​​​​們​​​​​​​希​​​​​​​望​​​​​​​將​​​​​​​ /dev/sdb1 的​​​​​​​扇​​​​​​​區​​​​​​​移​​​​​​​除​​​​​​​,如​​​​​​​此​​​​​​​一​​​​​​​來​​​​​​​我​​​​​​​們​​​​​​​才​​​​​​​能​​​​​​​將​​​​​​​該​​​​​​​磁​​​​​​​碟​​​​​​​由​​​​​​​卷​​​​​​​冊​​​​​​​群​​​​​​​組​​​​​​​中​​​​​​​移​​​​​​​除​​​​​​​。​​​​​​​
若​​​​​​​卷​​​​​​​冊​​​​​​​群​​​​​​​組​​​​​​​中​​​​​​​的​​​​​​​其​​​​​​​它​​​​​​​實​​​​​​​體​​​​​​​卷​​​​​​​冊​​​​​​​上​​​​​​​有​​​​​​​足​​​​​​​夠​​​​​​​的​​​​​​​可​​​​​​​用​​​​​​​扇​​​​​​​區​​​​​​​的​​​​​​​話​​​​​​​,您​​​​​​​可​​​​​​​針​​​​​​​對​​​​​​​於​​​​​​​您​​​​​​​希​​​​​​​望​​​​​​​移​​​​​​​除​​​​​​​的​​​​​​​裝​​​​​​​置​​​​​​​執​​​​​​​行​​​​​​​ pvmove 指​​​​​​​令​​​​​​​並​​​​​​​且​​​​​​​不​​​​​​​使​​​​​​​用​​​​​​​其​​​​​​​它​​​​​​​選​​​​​​​項​​​​​​​,如​​​​​​​此​​​​​​​一​​​​​​​來​​​​​​​扇​​​​​​​區​​​​​​​便​​​​​​​會​​​​​​​被​​​​​​​分​​​​​​​配​​​​​​​置​​​​​​​其​​​​​​​它​​​​​​​裝​​​​​​​置​​​​​​​上​​​​​​​。​​​​​​​
[root@tng3-1 ~]# pvmove /dev/sdb1
  /dev/sdb1: Moved: 2.0%
 ...
  /dev/sdb1: Moved: 79.2%
 ...
  /dev/sdb1: Moved: 100.0%
當​​​​​​​ pvmove 指​​​​​​​令​​​​​​​執​​​​​​​行​​​​​​​完​​​​​​​成​​​​​​​後​​​​​​​,扇​​​​​​​區​​​​​​​的​​​​​​​分​​​​​​​配​​​​​​​會​​​​​​​如​​​​​​​下​​​​​​​所​​​​​​​示​​​​​​​:
[root@tng3-1]# pvs -o+pv_used
  PV         VG   Fmt  Attr PSize  PFree  Used
  /dev/sda1  myvg lvm2 a-   17.15G  7.15G 10.00G
  /dev/sdb1  myvg lvm2 a-   17.15G 17.15G     0
  /dev/sdc1  myvg lvm2 a-   17.15G 12.15G  5.00G
  /dev/sdd1  myvg lvm2 a-   17.15G  2.15G 15.00G
請​​​​​​​使​​​​​​​用​​​​​​​ vgreduce 指​​​​​​​令​​​​​​​來​​​​​​​將​​​​​​​ /dev/sdb1 實​​​​​​​體​​​​​​​卷​​​​​​​冊​​​​​​​由​​​​​​​卷​​​​​​​冊​​​​​​​群​​​​​​​組​​​​​​​中​​​​​​​移​​​​​​​除​​​​​​​。​​​​​​​
[root@tng3-1 ~]# vgreduce myvg /dev/sdb1
  Removed "/dev/sdb1" from volume group "myvg"
[root@tng3-1 ~]# pvs
  PV         VG   Fmt  Attr PSize  PFree
  /dev/sda1  myvg lvm2 a-   17.15G  7.15G
  /dev/sdb1       lvm2 --   17.15G 17.15G
  /dev/sdc1  myvg lvm2 a-   17.15G 12.15G
  /dev/sdd1  myvg lvm2 a-   17.15G  2.15G
磁​​​​​​​碟​​​​​​​現​​​​​​​在​​​​​​​可​​​​​​​被​​​​​​​實​​​​​​​體​​​​​​​移​​​​​​​除​​​​​​​或​​​​​​​分​​​​​​​配​​​​​​​給​​​​​​​其​​​​​​​他​​​​​​​用​​​​​​​戶​​​​​​​。​​​​​​​