VMware ESXi 7
Sponsored Link

データストアを拡張する2023/03/01

 
ESXi ホストに作成済みのデータストアを拡張します。
当例では、新たに増設した空のローカルディスクを、既存のデータストア領域に割り当てて、データストアの容量を拡張します。
[1] シェルアクセスして設定する場合は、以下のように実行します。
[root@ctrl:~]
/usr/lib/vmware/misc/bin/fdisk -l

Found valid GPT with protective MBR; using GPT

Disk /dev/disks/t10.ATA_____QEMU_HARDDISK___________________________QM00005_____________: 167772160 sectors,     0
Logical sector size: 512
Disk identifier (GUID): b0862907-2625-4ce0-89f6-eb5a72566c04
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 167772126

Number  Start (sector)    End (sector)  Size Name
     1            2048       167770112 79.9G
Disk /dev/disks/t10.ATA_____QEMU_HARDDISK___________________________QM00007_____________: 160 GB, 171798691840 bytes, 335544320 sectors
20886 cylinders, 255 heads, 63 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Disk /dev/disks/t10.ATA_____QEMU_HARDDISK___________________________QM00007_____________ doesn't contain a valid partition table
Found valid GPT with protective MBR; using GPT
# ↑ 新規増設ディスク

Disk /dev/disks/t10.ATA_____QEMU_HARDDISK___________________________QM00001_____________: 167772160 sectors,     0
Logical sector size: 512
Disk identifier (GUID): 2ccb2252-4403-4683-8e8f-92cfd09865d9
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 167772126

Number  Start (sector)    End (sector)  Size Name
     1              64          204863  100M BOOT
     5          208896         8595455 4095M BOOTBANK1
     6         8597504        16984063 4095M BOOTBANK2
     7        16986112       167772126 71.9G OSDATA
Found valid GPT with protective MBR; using GPT

Disk /dev/disks/t10.ATA_____QEMU_HARDDISK___________________________QM00003_____________: 335544320 sectors,     0
Logical sector size: 512
Disk identifier (GUID): 18b24210-e47c-4dbe-b654-0ea98a503a3b
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 335544286

Number  Start (sector)    End (sector)  Size Name
     1            2048       335542272  159G

[root@ctrl:~]
esxcli storage core device capacity list

Device                                                                    Physical Blocksize  Logical Blocksize  Logical Block Count        Size  Format Type
------------------------------------------------------------------------  ------------------  -----------------  -------------------  ----------  -----------
t10.ATA_____QEMU_HARDDISK___________________________QM00007_____________                 512                512            335544320  163840 MiB  512n
t10.ATA_____QEMU_HARDDISK___________________________QM00001_____________                 512                512            167772160   81920 MiB  512n
t10.ATA_____QEMU_HARDDISK___________________________QM00003_____________                 512                512            335544320  163840 MiB  512n
t10.ATA_____QEMU_HARDDISK___________________________QM00005_____________                 512                512            167772160   81920 MiB  512n

[root@ctrl:~]
partedUtil get "/vmfs/devices/disks/t10.ATA_____QEMU_HARDDISK___________________________QM00007_____________"

20886 255 63 335544320
# 増設ディスクに GPT パーティションテーブルを作成
# partedUtil setptbl [デバイス] gpt ["パーティション番号 開始セクター 終了セクター タイプ 属性"]
# 開始セクター ⇒ VMFS-6 は 2048 を指定
# タイプ ⇒ VMFS データストアを指定 → AA31E02A400F11DB9590000C2911D1B8
# VMFS : Virtual Machine File System

[root@ctrl:~] partedUtil setptbl \
"/vmfs/devices/disks/t10.ATA_____QEMU_HARDDISK___________________________QM00007_____________" gpt \
"1 2048 $(expr 335544320 - 2048) AA31E02A400F11DB9590000C2911D1B8 0" 
gpt
0 0 0 0
1 2048 335542272 AA31E02A400F11DB9590000C2911D1B8 0

[root@ctrl:~]
partedUtil get "/vmfs/devices/disks/t10.ATA_____QEMU_HARDDISK___________________________QM00007_____________"

20886 255 63 335544320
1 2048 335542272 0 0

[root@ctrl:~]
esxcli storage vmfs extent list

Volume Name                                 VMFS UUID                            Extent Number  Device Name                                                               Partition
------------------------------------------  -----------------------------------  -------------  ------------------------------------------------------------------------  ---------
VM-Data                                     63f86748-0a69d2d8-dc5c-52540094d817              0  t10.ATA_____QEMU_HARDDISK___________________________QM00003_____________          1
ISO-Data                                    63f86a02-6a87729a-0e75-52540094d817              0  t10.ATA_____QEMU_HARDDISK___________________________QM00005_____________          1
OSDATA-63edd31c-7f6b194e-4446-52540094d817  63edd31c-7f6b194e-4446-52540094d817              0  t10.ATA_____QEMU_HARDDISK___________________________QM00001_____________          7

# [VM-Data] パーティションを拡張
# vmkfstools -Z [拡張パーティション] [ヘッドパーティション]

[root@ctrl:~] vmkfstools -Z \
/vmfs/devices/disks/t10.ATA_____QEMU_HARDDISK___________________________QM00007_____________:1 \
/vmfs/devices/disks/t10.ATA_____QEMU_HARDDISK___________________________QM00003_____________:1 

VMware ESXi Question:
All data on /vmfs/devices/disks/t10.ATA_____QEMU_HARDDISK___________________________QM00007_____________:1 will be lost. Continue and format?

0) _Yes
1) _No

Select a number from 0-1: 0

Successfully spanned volume

[root@ctrl:~]
df -h /vmfs/volumes/VM-Data

Filesystem   Size   Used Available Use% Mounted on
VMFS-6     319.5G   1.4G    318.1G   0% /vmfs/volumes/VM-Data
 
VMware Host Client で設定する場合は以下のように実行します。
[2] VMware Host Client に root ユーザーアカウントでログインし、左側の [Navigator] から [Storage] アイコンをクリックします。
[3] [New datastore] ボタンをクリックします。
[4] 別パーティションを追加してデータストアを拡張する場合は、[Add an extent to existing VMFS datastore] を選択します。
[5] 拡張したいデータストアを選択します。
[6] データストア領域に追加可能なディスクの一覧が表示されます。追加したいディスクを選択して次へ進みます。
[7] 使用するディスク容量と、ファイルシステムのバージョンを選択します。
[8] 内容に問題なければ [Finish] ボタンをクリックして、データストアを作成します。
[9] 新規追加するディスク内の既存データが消去される旨の確認です。
[10] データストアが正常に拡張されると、追加ディスク分の容量がプラスされた容量表示になります。
関連コンテンツ