Red Hat Training
A Red Hat training course is available for Red Hat Enterprise Linux
4.4.9. 延伸等量的卷冊
若要增加等量邏輯卷冊的大小,用來製作支援 stripe 的卷冊群組的基本實體卷冊上就必須要有足夠的空間。比方說,若您有個雙向的 stripe 而它使用了所有的卷冊群組,新增一個單獨的實體卷冊至卷冊群組將無法讓您延伸該 stripe。您必須要新增至少兩個實體卷冊至卷冊群組中。
比方說,請參考一個包含著兩個基本實體卷冊的卷冊群組
vg
,如下列透過 vgs
指令所示。
# vgs
VG #PV #LV #SN Attr VSize VFree
vg 2 0 0 wz--n- 271.31G 271.31G
您可透過使用卷冊群組中的所有空間來建立磁條。
#lvcreate -n stripe1 -L 271.31G -i 2 vg
Using default stripesize 64.00 KB Rounding up size to full physical extent 271.31 GB Logical volume "stripe1" created #lvs -a -o +devices
LV VG Attr LSize Origin Snap% Move Log Copy% Devices stripe1 vg -wi-a- 271.31G /dev/sda1(0),/dev/sdb1(0)
請注意,卷冊群組現在已無可用空間。
# vgs
VG #PV #LV #SN Attr VSize VFree
vg 2 1 0 wz--n- 271.31G 0
下列指令會增加額外的實體卷冊至卷冊群組,如此一來它便會含有 135G 的額外空間。
# vgextend vg /dev/sdc1 Volume group "vg" successfully extended # vgs VG #PV #LV #SN Attr VSize VFree vg 3 1 0 wz--n- 406.97G 135.66G
在此情況下,您無法將等量邏輯卷冊延伸為整個卷冊群組的大小,因為需要兩個基本的裝置才可 stripe 資料。
# lvextend vg/stripe1 -L 406G
Using stripesize of last segment 64.00 KB
Extending logical volume stripe1 to 406.00 GB
Insufficient suitable allocatable extents for logical volume stripe1: 34480
more required
若要延伸等量的邏輯卷冊,請新增另一個實體卷冊,然後再延伸邏輯卷冊。在此範例中,在新增了兩個實體卷冊至卷冊群組之後,我們便可將邏輯卷冊延伸為卷冊群組的完整大小。
#vgextend vg /dev/sdd1
Volume group "vg" successfully extended #vgs
VG #PV #LV #SN Attr VSize VFree vg 4 1 0 wz--n- 542.62G 271.31G #lvextend vg/stripe1 -L 542G
Using stripesize of last segment 64.00 KB Extending logical volume stripe1 to 542.00 GB Logical volume stripe1 successfully resized
在您沒有足夠的基本實體裝置來延伸等量邏輯卷冊的情況下,若延伸沒有被 stripe 無所謂的話,您依然還是能夠延伸該卷冊,而這將有可能造成效能上的不一致。當增加邏輯卷冊的空間時,預設的作業就是使用和現有邏輯卷冊的最後一個區段相同的 striping 參數,不過您可將這些參數置換掉。下列範例在初始的
lvextend
指令失敗後延伸了現有的等量邏輯卷冊來使用剩下的可用空間。
#lvextend vg/stripe1 -L 406G
Using stripesize of last segment 64.00 KB Extending logical volume stripe1 to 406.00 GB Insufficient suitable allocatable extents for logical volume stripe1: 34480 more required #lvextend -i1 -l+100%FREE vg/stripe1