VMware ESXi 7
Sponsored Link

Add extents to Datastore2023/03/01

 
Add extents to existing VMFS datastore.
On this example, it attaches a new local disk to ESXi computer and add it to existing VMFS datastore.
[1] To configure on shell access, set like follows.
[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
# ↑ new disk

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
# create GPT partition table on the new disk
# partedUtil setptbl [device] gpt ["(partiton num) (start sector) (end sector) (type) (attribute)"]
# start sector ⇒ specify 2048 on VMFS-6
# type ⇒ specify VMFS Datastore → 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

# add new partition to [VM-Data] partition
# vmkfstools -Z [span-partiton] [head-partition]

[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
 
To configure on VMware Host Client, set like follows.
[2] Login to VMware Host Client with root user account and click [Storage] icon that is under [Navigator] menu.
[3] Click [New datastore] button.
[4] Select [Add an extent to existing VMFS datastore].
[5] Select datastore you like to extend.
[6] Available devices are listed, select a device to add to datastore.
[7] Specify disk space you like to assign to Datastore and also select VMFS version.
[8] If that's OK, click [Finish] button to create Datastore.
[9] The warnings is shown that existing data in the new disk are erased with this operation. If no ploblem, Answer [Yes].
[10] After Datastore successfully extended, it is listed with new capacity.
Matched Content