A guide for beginners. How to Recover Data from iSCSI LUN of QNAP TS-412 Disk

In this article for beginners, we will discuss how to return data from an iSCSI LUN using the example of a QNAP TS-412 device. How to repair a network drive or retrieve data from a damaged network device.


Although the iSCSI protocol is quite old, it has not lost its popularity in the construction of network attached storage. It is a protocol for communicating and managing storage systems between servers and clients.

This protocol is used to transfer data over the network and allows you to see the network media as a local physical, while in fact the data storage is located on another device. Such media are called LUNs.

LUN is the logical unit number. In other words, this is a network drive or its partition, which has its own number in the iSCSI network. This functionality is available on Synology, QNAP and other server devices.

How to recover?

If you accidentally deleted an iSCSI LUN, or deleted data from it, or simply cannot access the files stored on your NAS, you cannot do without third-party data recovery software. There are few software solutions for recovering data from iSCSI drives. If you need a proven utility that can recover information from such disks, use Hetman RAID Recovery

First, let’s take a look at how to recover a lost NAS.

Before starting the recovery process, take care of the presence of a drive with a volume exceeding or equal to the network media from which you will recover information.

Connect the media to the Windows operating system, then download, install and run Hetman RAID Recovery, scan the desired media.


After completing the analysis, you need to find the following folder “@iSCSI”


The directory will contain all your iSCSI LUN media in the form of images. Determine the required drive by size, mark all important data and click “Recover”.

Specify the location where to save and click on the button again, upon completion of the process, the file will be in the specified folder.


The file has ceased to be sparse, the actual occupied space has increased to the full size of 330 GB.


Now there are several solutions in order to get information from it:

The first is to restore the functionality of the network media with QNAP.
And the second is to load the image into our program, scan it and return the required data.

How to restore the performance of a network drive

For the first solution, you will need to connect a blank drive to the QNAP device, boot it, and create a new virtual disk. Same size as the previous one. And then copy the file to this drive.


To copy the image, connect both media to a Linux computer or use other tools to access the QNAP file system.


Mount and open the new media in the file manager, on the mounted disk at the root you will find a folder with this name iscsi.img.


Rename this directory, for example, to iscsi.img2and then create a folder with the same name iscsi.img


Next, you need to copy our file to the directory we just created. To do this, we will use the terminal, since we need to convert this image to a sparse one. This can be done by executing the copy command – “cp”.

Open a terminal and enter the following command:

cp /media/lin/1/iSCSI-q330-606d5c77.000 /media/lin/38c8b452-81c2-4347-afb4-49d71eaf7e6e/@iscsi.img/iSCSI-q330-606d5c77.000 --sparse=always


  • /media/lin/1/iSCSI-q330-606d5c77.000 – path to the image.
  • /media/lin/38c8b452-81c2-4347-afb4-49d71eaf7e6e/@iscsi.img/iSCSI-q330-606d5c77.000 – path where you want to copy the image.
  • And the argument –sparse = always – converts it to sparse.


With a large image size, the copying process will take quite a long time.

The terminal does not display any information about the status of the copying process, this information can be viewed in the system monitor, the amount of copied information is displayed here, by which you can approximately determine how soon the process will end.

Well, the file has been successfully copied to the new media, to check, run the command:

du -h iSCSI-q330-606d5c77.000


Open this directory in the terminal and enter the command with the name.

As you can see, the image occupies less than 200 MB on disk, although its apparent size is 330GB. 1GB, 10GB. 5GB.

du -h --apparent-size iSCSI-q330-606d5c77.000

This is a confirmation that it was converted to sparse when copied.

After a successful copy operation, you need to correct the configuration file, replace the name of the new NAS with the desired one.

Connect the media to your QNAP device and boot it up. Use Winscp or another utility to set up a connection to the server. Enter ip, username, password, and click enter.


Program Winscp By default, it does not see hidden files, since the directory may be hidden, you must first enable their display. Open Settings – Panels – Show Hidden Files.


Then follow this path /mnt/HDA_ROOT/.config, find the file called iscsi_trgt.conf and open it. Here you need to find the line LunMetapath and replace the name of the new LUN with the name of the file that we restored (iSCSI-q330-606d5c77.000).



The number “001” at the end means how many parts your iSCSI has. In my case, it consists of one drive.

Then save your changes. If you have several carriers, you need to change all their names.

Reboot QNAP and wait for it to load. After booting, open the iSCSI initiator and reconnect the drive. After that, the drive will appear in the explorer with all the data.


How to get data back from an iSCSI image file

For the second solution, you need to “feed” the file to the Hetman RAID Recovery program.

Open the utility, go to the “Service” tab and click “Mount”. Specify the path to the image so that the program will display it in the “Images” field. List All Files here, then check it and click Open.


The mounted media will appear in the manager. Click on it with the right mouse button and click “Open”, select “Full analysis”, select the file system and click “Next”, and when finished, Finish. As you can see, the program has found and displayed the data that was on the network media. To return them, mark the ones you need and click “Restore”, specify the path where to save them and click on the button again. Upon completion, they will all be in the previously specified folder.

As you can see, the second method is much easier. If the LUN was not deleted, but the NAS device failed, it is enough just to mount the image in the program and restore the information.

For the full version of the article with all additional video tutorials, see source… And also visit our Youtube channel, there are more than 400 training videos collected there.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *