Assume the iSCSI LUN information is lost due to some unknown issue as show below. Please

use the following steps to try to recover it.


 1. Move to the volume path to check the file(s) of the LUN is still existed or not:

In this example, the volume path is /share/MD0_DATA/.@iscsi.img, and the file name of the LUN is iSCSI-RealLun-4e037f68.000.


2. Check the file count(s) of the LUN and the capacity of the LUN:

Use the command “ls –al” to check the detail capacity of the LUN. It should be multiple times of GB. In this case, 107374182400 = 100 * 1024 * 1024 * 1024 = 100 GB.


3. Use the iSCSI UI to make a fake LUN to create an iSCSI LUN with the same size:

Remember to make the fake LUN with thin provisioning. Since the disk volume may not

have enough space to make a fake LUN with the same size if you choose instant allocation!

Besides, this key value is for record only.

 

4. Disable the iSCSI service:

(1) Disable the iSCSI service by the UI.

 

(2) Disable the iSCSI service by the command line:

Use the following command: “/etc/init.d/iscsitrgt.sh stop”. Note that this step is very important, otherwise you cannot re-start the iSCSI service with the correct LUN file(s)!


5. Modify the LUNName, LUNMetaPath, and LUNPath in the [LUNxInfo] section and the LUN_LUNName of the [LUNKey] section of the configuration file,

/etc/config/iscsi_trgt.conf, according to the real file name of the LUN:


in this example,

[LUNKey]

LUN_FakeLUN = 0  LUN_RealLUN = 0


[LUN0Info]

LUNName = FakeLUN  LUNName = RealLUN

LUNMetaPath = /share/MD0_DATA/.@iscsi.img/iSCSI-FakeLUN-4e0388f0:001 

LUNMetaPath = /share/MD0_DATA/.@iscsi.img/iSCSI-RealLun-4e037f68:001


The LUN0Info Section before modified:

 

The LUNKey Section before modified:


The LUN0Info Section after modified:


The LUNKey Section after modified:


6. Re-start the iSCSI service:

Use the command “/etc/init.d/iscsitrgt.sh start” and enable the iSCSI service in the UI:

Now you can see the correct LUN name in the UI, and try to connect it to check the content!

It should be ok now.


Note:

(1) If there are several LUN files in the same LUN, and the size of the LUN file is not 1TB except

the last LUN file, then you should use LUN expansion to create the fake one.

For example, if there are iSCSI-RealLun-4e037f68.000 and iSCSI-RealLun-4e037f68.001, and if

iSCSI-RealLun-4e037f68.000(not the last one) is just 100GB and iSCSI-RealLun-4e037f68.001

is 300GB, you should create a fake LUN with 100GB first, and then expand it to 400GB.


(2) The LUNMetaPath in the [LUNxInfo] section has two meanings: the LUN path and the file

counts of the LUN.

For example, if in iscsi_trgt.conf you find the MetaPath is iSCSI-RealLun-4e037f68:003, which

means there are 3 LUN files, and the names

are iSCSI-RealLun-4e037f68.000, iSCSI-RealLun-4e037f68.001,

and iSCSI-RealLun-4e037f68.002


(3) If you are not familiar with the linux operation, especially vi, please reference:

http://linux.vbird.org/linux_basic/0310vi.php