Replicate iSCSI LUN
For the advanced iSCSI (for Intel x86-based models with firmware 3.2.0 or later), below instruction shows you how to replicate the iSCSI targets and LUNs from one to another, and can successfully run the replicated iSCSI targets on the backup NAS.
Before Getting Started:
- Assume you have the A NAS as the source (10.8.12.111), and B NAS as the destination/backup (10.8.12.12), and the iSCSI LUNs are located in MD0_data
- Make sure there's no connection on the source iSCSI targets (better make it offline) - This is my own notes, so use it your own risk.
- This requires some basic console knowledge
To Replicate the LUNS:
a. Mount a NFS share on NAS B via CLI
# mount -t nfs 10.8.12.111:/share/MD0_data/.@iscsi.img /share/Public/LUN_temp
b. Copy the LUNs from NAS A to NAS B (or you can use rsync as well). Note that the ".@iscsi.img" folder will only be created if you have ever created any LUN, therefore, if you can't find this directory or if you have never created the LUN on the destination (NAS B), please create one first, and then you can remove it right away.
# cp --sparse=always /share/Public/LUN_temp/* /share/MD0_data/.@iscsi.img/
c. Copy the configuration file (iscsi_trgt.conf) from NAS A to NAS B, it's under /etc/config/.
d. Disable the iSCSI target and then enable it, then you should be able to connect it via your initiator.
Remark (using Remote Replication):
There are still some other ways to back up the LUNs to another NAS, for example, using Remote Replication. But here are some prerequisites if you want to do it via the web GUI:
1. You have to create the new share folder (e.g. MyLUN) on the source NAS for temporary use, and then change its path to the directory where iSCSI LUNs are stored by editing the share folder property.
2. Also create a share folder (e.g. BackupLUN) on the destination NAS, and do just like what you have done in the previous step. Note that the ".@iscsi.img" folder will only be created if you have ever created any LUN, therefore, if you can't find the directory, please create one first, and then you can remove it right away.
3. Simply create a new remote replication job on the source NAS, set "BackupLUN" as the destination path, and use "MyLUN" as the source path.
* Please make sure you have enabled the "Handle sparse files efficiently" option in the job settings. This option is available since 3.2.5 (but is being included in 3.2.4 natively)
4. After the replication job has been finished, following the step C & D in the previous section, copy the configuration file from A to B, and then restart the iSCSI target on NAS B, and you should be able to use it.
Note that this (rsync) might take more time than using copy (cp)