Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ซอฟต์แวร์ >> เครื่องเสมือน

การเพิ่มขนาด VMFS Datastore บน VMware ESXi (vSphere)

บทความนี้จะแนะนำ วิธีเพิ่มขนาด VMFS Datastore โดยใช้ vSphere Web Client Interface หรือ VMware ESXi Command Prompt

สมมติเวลา Check Free Space บน VMFS Datastores พบว่าตัวหนึ่งจะหมดพื้นที่ว่าง ต้องการเพิ่มขนาด VMFS Datastore โดยเพิ่ม Storage Space

ขั้นแรก ต้อง Extend ขนาด LUN บน Storage Device วิธีการขึ้นอยู่กับ Vendor ของ Storage หากใช้ Windows Server iSCSI LUN สามารถเพิ่ม VHDX ผ่าน Server Manager (File and Storage Services → iSCSI → Select Disk → Extend iSCSI Virtual Disk) ในตัวอย่าง Extend LUN Size จาก 100GB เป็น 105GB

VMware ESXi รองรับ 2 วิธี Expand VMFS Datastores: ใช้ Unused Space บน LUN เดียวกัน (วิธีนี้อธิบายในบทความ) หรือเพิ่ม LUN เพิ่มเติม (เรียกว่า Extent) VMFS Extent เป็น Partition แบบครอบหลาย LUNs Data จะเขียนไป LUN ที่สองหลัง LUN แรกเต็ม ฯลฯ

วิธีเพิ่มขนาด VMFS Datastore ด้วย vSphere Web Client

  1. เลือก Storage ใน vSphere Client Interface
  2. Right-click Datastore เลือก Increase Datastore Capacity;
    การเพิ่มขนาด VMFS Datastore บน VMware ESXi (vSphere)
  3. เลือก Disk (LUN) ที่ต้องการเพิ่ม สังเกตค่าใน Column Expandable ควรเป็น Yes หมายถึง VMFS Datastore นี้ขยายได้ หากเป็น No สามารถเพิ่ม Capacity ได้แค่ด้วย VMFS Extent (ขยาย Datastore ไป 2 LUNs)
    การเพิ่มขนาด VMFS Datastore บน VMware ESXi (vSphere)
  4. ขั้นตอนถัดไป เลือกว่าจะเพิ่มขนาด Storage เท่าไหร่ โดย Default Wizard เสนอใช้ Free Space ทั้งหมด (Use Free space 5Gb to expand the datastore) จะเห็น Warning ว่ากำลังขยาย Current Partition ด้วย Free Space;
    การเพิ่มขนาด VMFS Datastore บน VMware ESXi (vSphere)
The datastore already occupies one or more extents on this device. Selecting free space adjacent to an extent in the datastore will expand that extent. Selecting any other option will add a new extent to the datastore.

ถ้าตรงใจ คลิก Next จะเห็นว่า VMFS Datastore จะโตเท่าไหร่ (Increase Datastore Size by) และขนาดใหม่ (Future Datastore Size) ในหน้า Summary
การเพิ่มขนาด VMFS Datastore บน VMware ESXi (vSphere)

ขนาดสูงสุดของ VMFS Datastore สำหรับ VMFS6 คือ 64TB Storage อาจประกอบด้วย 1 LUN หรือถึง 32 Extents รวมขนาดถึง 64TB

บางกรณีไม่สามารถ Expand VMFS Datastore จาก vSphere Client GUI ได้ บ่อยที่สุดเกี่ยวกับความไม่สามารถเพิ่ม VMFS Storage บน Boot Disk Device ได้ จะเจอ Error:

Failed to expand VMFS datastore VMFSstore - Cannot change the host configuration.

การเพิ่มขนาด VMFS Datastore บน VMware ESXi (vSphere)

ในกรณีนี้ ต้อง Expand Datastore จาก VMware ESXi Command Prompt

การขยาย VMFS Datastore บน VMware ESXi จาก Command Line

  1. SSH เข้า ESXi Host (บน Windows ใช้ Built-in SSH Client)
  2. Rescan Storage Adapters: esxcli storage core adapter rescan --all
  3. ระบุ Disk (LUN) ที่ VMFS Datastore อยู่: vmkfstools -P /vmfs/volumes/DCx2VMFS1 ในกรณีนี้ Disk เป็น /vmfs/devices/disks/naa.6000f3fdc1175dacd86b623db26e4d1f.:1 หมายถึง VMFS Datastore อยู่ Partition แรกของ Disk
    การเพิ่มขนาด VMFS Datastore บน VMware ESXi (vSphere)
  4. Check Partition Table ของ Disk: partedUtil get /vmfs/devices/disks/naa.6000f3fdc1175dacd86b623db26e4d1f
    13706 255 63 220200960
    1 2048 209713152 0 0
    ในกรณีนี้ First Partition Sector คือ 2048 และ Last Sector คือ 209713152
  5. หา Last Sector Number ที่ใช้ได้ คือ Sector ที่ VMFS Partition อาจขยายไป: partedUtil getUsableSectors /vmfs/devices/disks/naa.6000f3fdc1175dacd86b623db26e4d1f
  6. ในกรณีของผม คำสั่งคืน Error:
    Error: The backup GPT table is not at the end of the disk, as it should be. This might mean that another operating system believes the disk is smaller. Fix, by moving the backup to the end (and removing the old backup)?
    Warning: Not all of the space available to /dev/disks/naa.6000f3fdc1175dacd86b623db26e4d1f appears to be used, you can fix the GPT to use all of the space (an extra 10485760 blocks) or continue with the current setting?
    This will also move the backup table at the end if is not at the end already.
    diskSize (220200960)
    AlternateLBA (209715199)
    LastUsableLBA (209715166)
    NewLastUsableLBA (220200926)
    การเพิ่มขนาด VMFS Datastore บน VMware ESXi (vSphere)
  7. Fix GPT Table Error: partedUtil fixGpt /vmfs/devices/disks/naa.6000f3fdc1175dacd86b623db26e4d1f
    FixGpt tries to fix any problems detected in GPT table. Please ensure that you don't run this on any RDM (Raw Device Mapping) disk. Are you sure you want to continue (Y/N): Exiting ...
    gpt 13706 255 63 220200960
    1 2048 209713152 AA31E02A400F11DB9590000C2911D1B8 vmfs 0
  8. แสดง Last Available Sector (NewLastUsableLBA) อีกครั้ง: partedUtil getUsableSectors /vmfs/devices/disks/naa.6000f3fdc1175dacd86b623db26e4d1f ในตัวอย่างขยาย Partition ไป Sector 220200926
    การเพิ่มขนาด VMFS Datastore บน VMware ESXi (vSphere)
  9. มี First Sector (2048) และ Last Sector (220200926) แล้ว ขยาย Partition: partedUtil resize /vmfs/devices/disks/naa.6000f3fdc1175dacd86b623db26e4d1f 1 2048 220200926
  10. Grow VMFS File System: vmkfstools --growfs /vmfs/devices/disks/naa.6000f3fdc1175dacd86b623db26e4d1f:1 /vmfs/devices/disks/naa.6000f3fdc1175dacd86b623db26e4d1f:1
  11. Refresh Datastore List: vmkfstools –V
  12. Check Local Datastore Sizes: df –h
    การเพิ่มขนาด VMFS Datastore บน VMware ESXi (vSphere)

เห็นว่า VMFS Datastore ขยายสำเร็จ 5 GB Operation ทำ Online โดยไม่ Unmount Datastore หรือ Stop VM

แนะนำอ่านคู่มือวิธี Shrink VMware VM Disk (VMDK Files) ด้วย