VMware ESXi 8
Sponsored Link

Add Datastore (Local Disk)2024/01/15

 
Add Datastore (Local Disk) to ESXi Host.
On this example, it attaches a new local disk to ESXi computer and create Datastore on it with entire volume.
[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___________________________QM00001_____________: 167772160 sectors,     0
Logical sector size: 512
Disk identifier (GUID): 1b312cd7-882f-4a40-86a9-48e7cc59ca13
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
Disk /dev/disks/t10.ATA_____QEMU_HARDDISK___________________________QM00003_____________: 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___________________________QM00003_____________ doesn't contain a valid partition table
# ↑ new disk

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

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

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

20886 255 63 335544320
# create GPT partition table
# 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___________________________QM00003_____________" 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___________________________QM00003_____________"

20886 255 63 335544320
1 2048 335542272 0 0

# configure Datastore
# -S (any Datastore name)
# :1 ⇒ partiton number

[root@ctrl:~] vmkfstools -C vmfs6 -S VM-Data \
"/vmfs/devices/disks/t10.ATA_____QEMU_HARDDISK___________________________QM00003_____________:1" 
create fs deviceName:'/vmfs/devices/disks/t10.ATA_____QEMU_HARDDISK___________________________QM00003_____________:1', fsShortName:'vmfs6', fsName:'VM-Data'
deviceFullPath:/dev/disks/t10.ATA_____QEMU_HARDDISK___________________________QM00003_____________:1 deviceFile:t10.ATA_____QEMU_HARDDISK___________________________QM00003_____________:1
ATS on device /dev/disks/t10.ATA_____QEMU_HARDDISK___________________________QM00003_____________:1: not supported
.
Checking if remote hosts are using this device as a valid file system. This may take a few seconds...
Creating vmfs6 file system on "t10.ATA_____QEMU_HARDDISK___________________________QM00003_____________:1" with blockSize 1048576, unmapGranularity 1048576, unmapPriority default and volume label "VM-Data".
Successfully created new volume: 65a4d8f4-5bbdd866-c7e6-5254003acc4c

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

Volume Name                                 VMFS UUID                            Extent Number  Device Name                                                               Partition
------------------------------------------  -----------------------------------  -------------  ------------------------------------------------------------------------  ---------
VM-Data                                     65a4d8f4-5bbdd866-c7e6-5254003acc4c              0  t10.ATA_____QEMU_HARDDISK___________________________QM00003_____________          1
OSDATA-658296fd-86bd1530-6a78-5254003acc4c  658296fd-86bd1530-6a78-5254003acc4c              0  t10.ATA_____QEMU_HARDDISK___________________________QM00001_____________          7

[root@ctrl:~]
esxcli storage filesystem list

Mount Point                                        Volume Name                                 UUID                                 Mounted  Type            Size          Free
-------------------------------------------------  ------------------------------------------  -----------------------------------  -------  ------  ------------  ------------
/vmfs/volumes/65a4d8f4-5bbdd866-c7e6-5254003acc4c  VM-Data                                     65a4d8f4-5bbdd866-c7e6-5254003acc4c     true  VMFS-6  171530256384  170019258368
/vmfs/volumes/658296fd-86bd1530-6a78-5254003acc4c  OSDATA-658296fd-86bd1530-6a78-5254003acc4c  658296fd-86bd1530-6a78-5254003acc4c     true  VMFSOS   77040975872   73569140736
/vmfs/volumes/0df11024-834cb32d-0dac-c488aa9626f7  BOOTBANK1                                   0df11024-834cb32d-0dac-c488aa9626f7     true  vfat      4293591040    4000382976
/vmfs/volumes/e704ddac-404e317b-7284-6597e86d9b29  BOOTBANK2                                   e704ddac-404e317b-7284-6597e86d9b29     true  vfat      4293591040    4293525504
 
To add Datastore on VMware Host Client, Configure 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 [Create new VMFS datastore] and proceed to next.
[5] Available disks you can create Datastore are listed. Select a disk and input any Datastore name.
[6] Specify disk space you like to assign to Datastore and also select VMFS version.
[7] If that's OK, click [Finish] button to create Datastore.
[8] The warnings is shown that existing data in the disk are erased with this operation. If no ploblem, Answer [Yes].
[9] After new Datastore successfully added, it is listed on Datastores table like follows.
Matched Content