所有儲存磁碟區皆已設定為 LVM 裝置。若基礎虛擬化技術支援線上磁碟擴充功能,則它們可以在線上調整大小。當虛擬機器開機時,系統會透過 cloud-init 自動擴充磁碟。

若要在開機後擴充磁碟:

  1. 登入 SD-WAN Orchestrator 系統主控台。
  2. 識別支援資料庫磁碟區的實體磁碟。
    vgs -o +devices store

    範例:

    root@vco:~# vgs -o +devices db_data
       \  VG      #PV #LV #SN Attr   VSize   VFree   Devices
         store   1   1   0 wz--n- 500.00g 125.00g /dev/sdb(0)
  3. 識別實體磁碟連結。
    lshw -class volume
    範例:
    /dev/sdb is attached to scsi@2:0.1.0 (Host: scsi2 Channel: 00 Id: 01 Lun: 00)
    root@vco:~# lshw -class volume
      *-volume
           description: EXT4 volume
           vendor: Linux
           physical id: 1
           bus info: scsi@2:0.0.0,1
           logical name: /dev/sda1
           logical name: /
           version: 1.0
           serial: 9d212247-77c4-4f98-a5c2-7f8470fa2da8
           size: 10239MiB
           capacity: 10239MiB
           capabilities: primary bootable journaled extended_attributes large_files huge_files dir_nlink recover extents ext4 ext2 initialized 
           configuration: created=2016-02-22 20:49:38 filesystem=ext4 label=cloudimg-rootfs lastmountpoint=/ modified=2016-02-22 21:18:58 mount.fstype=ext4 mount.options=rw,relatime,data=ordered mounted=2016-10-06 23:22:04 state=mounted 
      *-disk:1
           description: SCSI Disk
           physical id: 0.1.0
           bus info: scsi@2:0.1.0
           logical name: /dev/sdb
           serial: v5V2zm-Lvbh-Mfx3-W8ki-COI9-DAtP-RXndhu
           size: 500GiB
           capacity: 500GiB
           capabilities: lvm2
           configuration: sectorsize=512
      *-disk:2
           description: SCSI Disk
           physical id: 0.2.0
           bus info: scsi@2:0.2.0
           logical name: /dev/sdc
           serial: fTQFJ2-giAV-WsXL-1Wha-V305-oQkV-qqS3SA
           size: 100GiB
           capacity: 100GiB
           capabilities: lvm2
           configuration: sectorsize=512
  4. 在 Hypervisor 主機上,使用匯流排資訊找到連結至虛擬機器的磁碟。範例:SCSI(0:1)
  5. 延伸虛擬磁碟。如需指示,請參閱 VMware 知識庫文章 1004047:http://kb.vmware.com/kb/1004047
  6. 重新登入 SD-WAN Orchestrator 系統主控台。
  7. 重新掃描已調整大小實體磁碟區的區塊裝置。範例:
    echo 1 > /sys/block/$DEVICE/device/rescan

    範例:

    echo 1 > /sys/block/sdb/device/rescan
  8. 調整 LVM 實體磁碟的大小。
    pvresize /dev/sdb
  9. 判斷資料庫磁碟區群組中的可用空間量。
    vgdisplay store |grep Free

    範例:

    root@vco:~# vgdisplay store |grep Free
    Free  PE / Size       34560 / 135.00 GiB
  10. 延伸資料庫邏輯磁碟區。
    lvextend -r -L+#G /dev/store/data

    範例:

    root@vco1:~# lvextend -r -L+1G /dev/store/data
      Size of logical volume store/data changed from 400.00 GiB (102400 extents) to 401.00 GiB (102656 extents).
      Logical volume store/data successfully resized.
    resize2fs 1.44.1 (24-Mar-2018)
    Filesystem at /dev/mapper/store-data is mounted on /store; on-line resizing required
    old_desc_blocks = 50, new_desc_blocks = 51
    The filesystem on /dev/mapper/store-data is now 105119744 (4k) blocks long.
  11. 檢視磁碟區的新大小。
    df -h /dev/store/data

    範例:

    root@vco:~# df -h /dev/store/data
    Filesystem               Size  Used Avail Use% Mounted on
    /dev/mapper/store-data  379G  1.2G  359G   1% /store