Use iSCSI Storage2024/01/15 |
Attach iSCSI Storages on the network and use them as Datastore.
On this example, it uses iSCSI storage by Linux Server like here.
Also it allows the IQN below on the iSCSI Target Server for ESXi Host. ⇒ iqn.2024-01.world.srv:ctrl.initiator01 |
|
[1] | To configure on shell access, set like follows. |
# enable iSCSI feature [root@ctrl:~] esxcli iscsi software set --enabled true Software iSCSI Enabled [root@ctrl:~] esxcli iscsi software get true esxcli iscsi adapter list Adapter Driver State UID Description ------- --------- ------ ------------- ----------- vmhba64 iscsi_vmk online iscsi.vmhba64 iSCSI Software Adapter[root@ctrl:~] esxcli iscsi adapter get -A vmhba64 vmhba64 Name: iqn.1998-01.com.vmware:ctrl.srv.world:723525480:64 Alias: iscsi_vmk Vendor: VMware Model: iSCSI Software Adapter Description: iSCSI Software Adapter Serial Number: Hardware Version: Asic Version: Firmware Version: Option Rom Version: Driver Name: iscsi_vmk Driver Version: TCP Protocol Supported: false Bidirectional Transfers Supported: false Maximum Cdb Length: 64 Can Be NIC: false Is NIC: false Is Initiator: true Is Target: false Using TCP Offload Engine: false Using ISCSI Offload Engine: false # changte IQN to the one that is set in ACL of iSCSI Target # * if you do not like to change the default IQN, allow the default IQN on the iSCSI Target side [root@ctrl:~] esxcli iscsi adapter set -A vmhba64 -n iqn.2024-01.world.srv:ctrl.initiator01 [root@ctrl:~] esxcli iscsi adapter get -A vmhba64 vmhba64 Name: iqn.2024-01.world.srv:ctrl.initiator01 Alias: iscsi_vmk Vendor: VMware ..... ..... # set username and password for CHAP authentication configured on iSCSI Target ACL [root@ctrl:~] esxcli iscsi adapter auth chap set --direction=uni --authname=username --secret=password --level=discouraged -A vmhba64
# discover iSCSI Target [root@ctrl:~] esxcli iscsi adapter discovery sendtarget add --address=10.0.0.30 -A vmhba64 # login to iSCSI Target [root@ctrl:~] esxcli storage core adapter rescan -A vmhba64 esxcli iscsi session list vmhba64,iqn.2024-01.world.srv:dlp.target01,00023d000001 Adapter: vmhba64 Target: iqn.2024-01.world.srv:dlp.target01 ISID: 00023d000001 TargetPortalGroupTag: 1 AuthenticationMethod: chap DataPduInOrder: true DataSequenceInOrder: true DefaultTime2Retain: 0 DefaultTime2Wait: 2 ErrorRecoveryLevel: 0 FirstBurstLength: 65536 ImmediateData: true InitialR2T: true MaxBurstLength: 262144 MaxConnections: 1 MaxOutstandingR2T: 1 TSIH: 3[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
naa.6001405a0ddc10da9914ab39dfe05eef 512 512 20971520 10240 MiB 512n
# ↑ iSCSI storage
t10.ATA_____QEMU_HARDDISK___________________________QM00009_____________ 512 512 335544320 163840 MiB 512n
t10.ATA_____QEMU_HARDDISK___________________________QM00003_____________ 512 512 335544320 163840 MiB 512n
t10.ATA_____QEMU_HARDDISK___________________________QM00005_____________ 512 512 335544320 163840 MiB 512n
|
[2] | After conneting to iSCSI storage, it's the same way to create Datastore on it with Localdisk. |
[root@ctrl:~]
partedUtil get "/vmfs/devices/disks/naa.6001405a0ddc10da9914ab39dfe05eef" 1305 255 63 20971520
[root@ctrl:~] partedUtil setptbl \
"/vmfs/devices/disks/naa.6001405a0ddc10da9914ab39dfe05eef" gpt \
"1 2048 $(expr 20971520 - 2048) AA31E02A400F11DB9590000C2911D1B8 0"
gpt
0 0 0 0
1 2048 20969472 AA31E02A400F11DB9590000C2911D1B8 0
[root@ctrl:~] vmkfstools -C vmfs6 -S iSCSI-Store \
"/vmfs/devices/disks/naa.6001405a0ddc10da9914ab39dfe05eef:1"
create fs deviceName:'/vmfs/devices/disks/naa.6001405a0ddc10da9914ab39dfe05eef:1', fsShortName:'vmfs6', fsName:'iSCSI-Store'
deviceFullPath:/dev/disks/naa.6001405a0ddc10da9914ab39dfe05eef:1 deviceFile:naa.6001405a0ddc10da9914ab39dfe05eef:1
Checking if remote hosts are using this device as a valid file system. This may take a few seconds...
Creating vmfs6 file system on "naa.6001405a0ddc10da9914ab39dfe05eef:1" with blockSize 1048576, unmapGranularity 1048576, unmapPriority default and volume label "iSCSI-Store".
Successfully created new volume: 65a4fbbe-a24b1307-e785-5254003acc4c
[root@ctrl:~] esxcli storage vmfs extent list Volume Name VMFS UUID Extent Number Device Name Partition ------------------------------------------ ----------------------------------- ------------- ------------------------------------------------------------------------ --------- iSCSI-Store 65a4fbbe-a24b1307-e785-5254003acc4c 0 naa.6001405a0ddc10da9914ab39dfe05eef 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/65a4fbbe-a24b1307-e785-5254003acc4c iSCSI-Store 65a4fbbe-a24b1307-e785-5254003acc4c true VMFS-6 10468982784 8960081920 /vmfs/volumes/658296fd-86bd1530-6a78-5254003acc4c OSDATA-658296fd-86bd1530-6a78-5254003acc4c 658296fd-86bd1530-6a78-5254003acc4c true VMFSOS 77040975872 73564946432 /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 |
[3] | To detach iSCSI Storages, operate like follows. |
# switch to maintenance mode [root@ctrl:~] esxcli system maintenanceMode set --enable true [root@ctrl:~] esxcli system maintenanceMode get Enabled # remove iSCSI session [root@ctrl:~] esxcli iscsi session remove -A vmhba64 # remove iSCSI Target setting [root@ctrl:~] esxcli iscsi adapter discovery sendtarget remove --address=10.0.0.30 -A vmhba64 # set CHAP setting to the default to clear the current setting [root@ctrl:~] esxcli iscsi adapter auth chap set --default -A vmhba64
# restart system [root@ctrl:~] esxcli system shutdown reboot -r "2024-01-15 Maintenance" # after restarting, release maintenance mode [root@ctrl:~] esxcli system maintenanceMode set --enable false # if also disable iSCSI feature, set like follows [root@ctrl:~] esxcli iscsi software set --enabled false Software iSCSI Disabled. |
To configure on VMware Host Client, set like follows.
|
|
[4] | Login to VMware Host Client with root user account and click [Storage] icon that is under [Navigator] menu. |
[5] | Click [Software iSCSI] button. |
[6] | Input CHAP username and password, Hostname or IP address of iSCSI Target, and Click [Save configuration] button. |
[7] | After successfully connected to iSCSI storage, it will be listed under the [Devices] pane. |
Sponsored Link |
|