ESXi mount/un-mount iscsi

 

 

目錄

 


Activate/Disable the Software iSCSI Adapter

 

Activate the Software iSCSI Adapter

vSphere Client -> Configuration tab -> Storage Adapters ->

Add -> select Software iSCSI Adapter -> Properties -> Configure -> select "Enabled"

Disable the Software iSCSI Adapter

vSphere Client -> Configuration -> Storage Adapters ->

Select "software iSCSI adapter" -> Properties -> Configure -> deselect "Enabled"

 


Config Software iSCSI Adapter

 

1. Add Software iSCSI Adapter

Configuration -> Storage adapters -> Add -> Click "Add Software 'iSCSI' Adapter"

2. Set local adapter name

Click "created adapter" -> Properties

Click "Configure" and set the Name to the IQN for the esxi

3. Assign NIC

"Network Configuration" Tab -> select NIC

4. Add LUN

Click the "Dynamic Discovery Tab" then click the "Add"

CHAP -> Use CHAP -> input Name & Secret

Right-click "created adapter" -> Rescan

The device turns gray and is 'unmounted' -> Right-click the device name and select attach

5. Add Storage

"Storage" Tab -> Add Storage... -> Disk/LUN -> 在 Storage Adapters 見到的 Devices

 


Enable Jumbo Frames for iSCSI

 

Configuration -> Networking -> Select switch(use for iSCSI traffic) Properties -> Ports tab -> select vSwitch -> Edit -> MTU
 

 


Un-mount

 

Unmount

just going to detach the device from that host and you do not loose any data

CLI

esxcli storage filesystem unmount -l LUN01
esxcli storage filesystem unmount -u 4e414917-a8d75514-6bae-0019b9f1ecf4
esxcli storage filesystem unmount -p /vmfs/volumes/4e414917-a8d75514-6bae-0019b9f1ecf4

Detach

You might need to detach the device to make it inaccessible to your host,

when, for example, you perform a hardware upgrade on the storage side.

Delete

This option will delete the data from your datastore.

The datastore delete operation permanently deletes all files associated with virtual machines on the datastore.

Although you can delete the datastore without unmounting, it is preferable that you unmount the datastore first.

 

Unmount 前要 ...

If the LUN is being used as a VMFS datastore, all objects, (such as virtual machines, snapshots, and templates)

stored on the VMFS datastore are unregistered or moved to another datastore.

All CD/DVD images located on the VMFS datastore must also be unregistered from the virtual machines.

補充

From the vSphere Client, this information is visible in the Properties window of the datastore.

CLI

esxcli storage vmfs extent list

Volume Name  VMFS UUID                            Extent Number  Device Name                           Partition
-----------  -----------------------------------  -------------  ------------------------------------  ---------
RAID6        57b8930b-a409c0a6-c88b-d4ae5275577e              0  naa.6782bcb0138478001f540cc410d12907          3
6000G_R1     59f931f8-c85576f2-939c-782bcb780071              0  naa.600140519d4ed05191948a1b9d6a2f04          1

use the vsphere client to:

1)perform the unmount for each host (or can be done for all hosts at once from the datastores and clusters view), then
2)perform the "detach" operation for each host individually from the vsphere client (step 3 below)
3)unpresent the LUN using vendor-specific storage tools/consoles
4)rescan from all hosts using the vsphere client

When  the device is detached, it stays in an unmounted state even if the device is represented (that is, the detached state is persistent).

To bring the device back online, the device must be attached.

After you unmount a VMFS datastore, the datastore becomes inactive and is dimmed in the host's datastore list.

An unmounted NFS datastore no longer appears on the list.

 

When the device is detached, it stays in an unmounted state even if the device is re-presented (that is, the detached state is persistent).

To bring the device back online, the device must be attached.

permanently decommission from an ESXi host

=> manually remove the NAA entries from the host configuration:

# To list the permanently detached devices, run this command:

esxcli storage core device detached list

Device UID State
------------------------------------ -----
naa.50060160c46036df50060160c46036df off
naa.6006016094602800c8e3e1c5d3c8e011 off

# To permanently remove the device configuration information from the system, run this command:

esxcli storage core device detached remove -d NAA_ID

 


Remove dead lun

 

 

# 當 Guest 沒有 mount 它上面的檔案( iso) 或沒東西要寫入(sync)時, 就可以用以下 cmd remove 佢

esxcfg-rescan -d vmhba35;

 


Disconnect the connection

 

# List session

esxcli iscsi session list

vmhba35,iqn.2003-01.org.linux-iscsi.backup2.x8664:sn.ee167d963b96,00023d000001
   Adapter: vmhba35
   Target: iqn.2003-01.org.linux-iscsi.backup2.x8664:sn.ee167d963b96
   ISID: 00023d000001
   TargetPortalGroupTag: 1
   AuthenticationMethod: none
   DataPduInOrder: true
   DataSequenceInOrder: true
   DefaultTime2Retain: 0
   DefaultTime2Wait: 2
   ErrorRecoveryLevel: 0
   FirstBurstLength: 65536
   ImmediateData: true
   InitialR2T: true
   MaxBurstLength: 262144
   MaxConnections: 1
   MaxOutstandingR2T: 1
   TSIH: 9180

# Disconnect the session

# The iSCSI adapter name, for example, vmhba34. This option is required.
-A|--adapter=str

# The iSCSI target name, for example, iqn.X.
-n|--name=str

esxcli iscsi session remove -A vmhba35 -n iqn.2003-01.org.linux-iscsi.backup2.x8664:sn.ee167d963b96

 

 


Doc

 

http://kb.vmware.com/kb/2004605