How to Recover Data from a RAID-z Array, ZFS File System, and a Network-Attached Storage with TrueNAS Core

How to build RAID-z and RAID-z2 arrays using the example of a device running TrueNAS operating system, and how to get data from a damaged RAID array, or how to recover it if such data is lost, accidentally removed or destroyed by formatting.

How to Recover Data from a RAID-z Array, ZFS File System, and a Network-Attached Storage with TrueNAS Core

ZFS file system offers its own version of a software-based RAID known as RAID-Z. In addition to a certain performance boost, it can also fix slightest aspects of data corruption. To monitor the situation, it detects bad blocks by using checksums and then corrects logical errors immediately. This feature helps the array to maintain integrity for all of its data.

However, even the most reliable file system and equipment cannot completely guarantee your data against software and hardware failures.

Go to view
How to Install and Configure TrueNAS Core 💿

How to Install and Configure TrueNAS Core 💿

ZFS: a brief description

ZFS is a open-source file system which is mostly used in FreeNAS storage systems and other solutions based on Free BSD.

The data distribution mechanism in RAID-z is similar to the conventional RAID 5, but with slight differences. It uses dynamic striping instead of fixed-width stripes.

The information about the size of each stripe is written to metadata. Due to the dynamic nature of this file system, its data can only be recovered if the metadata is not damaged.

ZFS was developed with reliability in mind, which is achieved by using various features such as copy-on-write, redundant metadata, journaling and others.

Because of the complicated structure of this file system, conventional data recovery tools are useless when it comes to restoring information from RAID-z arrays.

However, Hetman RAID Recovery can analyze its metadata to identify the proper structure of RAID-z and then rebuilds the damaged RAID on the fly, and does it automatically.

How to create a RAID-z2

In one of our videos, you can see how to install and configure such operating system and how to create a RAID-z.

Now let’s find out how to build RAID-z2 (that is, an array of the second level).

Start by accessing the TrueNAS management menu and expanding the tab “Storage”“Pools”. Here, click the buttons “Add” and then “Create Pool”.

Storage – Pools

Give the pool name, and select disks – for RAID-z2 you need at least 4 disks – and then click on this arrow below to add storage devices to the list. Choose the drives here, and select the RAID level from the drop-down list, then click “Create”.

Choose at least four disks

In the pop-up window saying that all data will be erased, check the box here and click “Create pool”, and it starts the process of formatting the drives and building the RAID.

Create a RAID-z2 pool

How to configure an FTP connection

For example, let’s configure an FTP connection, write data to the RAID array, then imitate a situation involving loss or failure of the storage devise so that the data inside it is no longer accessible.

Let’s begin by adding a new dataset for FTP connection. Open the tab “Storage”“Pools” – hit the three-dots button – “Add Dataset”.

Add Dataset

Assign a name, don’t change other settings, and click “Submit”. Create a new user for FTP: “Accounts”“Users”“Add”.

Create a new user for FTP

Give the name and password, uncheck the box next to “New Primary Group” and choose “ftp” from the list. Then select the directory we have created before, set the required permissions, and save the settings.

FTP user settings

Let’s go back to the dataset we have created, and modify its permissions. Click on the three-dots button – “Edit Permission”.

Add the user to the pool

Choose the user – “ftp” and group – “Ftp”, check the box here, confirm it, then check the boxes for “Apply User” and “Apply Group”, then save the settings.

Configure pool access via FTP

Now the last step is to enable the FTP server. Open “Services”, drag the slider to the “enabled” position, and check the box for automatic startup.

Enable FTP

The FTP connection is configured, so let’s check access in the Explorer: in the address bar, type the FTP address of the server, and then the user’s login and password.

How to recover data from RAID-z of the first and second level

Recovering RAID-z data

Go to view
How to Recover Data from a RAID-z Array, ZFS File System, and a NAS with TrueNAS Core

How to Recover Data from a RAID-z Array, ZFS File System, and a NAS with TrueNAS Core

Now let’s explore how to recover some information that was removed accidentally from a RAID-z array.

RAID-Z1 makes sure that every unique block of data is written, so that recovery is possible if any of the drives suffers a failure or breakdown. In this case, data is distributed across the array in the most optimal way. RAID-Z1 is very similar to RAID 5, as it uses single-parity data storage pattern, and it is designed to survive losing one of the disks in its array. But as I said before, only a few data recovery tools can handle this specific RAID type.

Hetman RAID Recovery supports the ZFS file system and RAID-z arrays of all levels. This program can automatically rebuild a RAID system created with the help of that file system. This is a comprehensive solution for NAS data recovery to help you restore your files in a number of different scenarios. This program supports most popular file systems and RAID types.

For recovery, take the disks out of the server and connect them to a Windows computer. If your motherboard doesn’t have enough ports to connect all the drives, there are all kinds of various adapters and expansion cards to fix this problem.

SATA expansion cards and adapters

The program will scan the drives for service information automatically, and then it will rebuild the RAID system on the fly. As you can see, my RAID-z array is displayed in the Drive Manager.

Hetman RAID Recovery

To start the recovery process, analyze the drive: right-click on the array – “Open”“Fast scan”. With Fast Scan the program didn’t manage to find the deleted files, but the files which are still on the disks are all available for recovery. The bottom line is that Fast Scan will help you get your data back in case of a hardware error or when your storage system breaks down.

Fast Scan

The metadata structure in ZFS file system and RAID-z is designed in such a way that the fast scan algorithm cannot find the deleted data because all information about it is erased from the journal.

That is why you need to run Full Analysis in order to find the deleted files.

Right-click on the partition, select “Analyze again” and go for “Full analysis”, choose the file system – Next – and wait until the scan is over. This process can be quite long and the actual time required to complete it depends on the size of your array.

When the scan is over, browse to the directory where the deleted files used to be and find the ones you need to recover: for your convenience, there is a feature to search for files by name. Also, you can check file contents with the preview option.

Deleted files

As you can see, the program managed to find all the files that have been removed from the disk. As the final step, select the ones you need and click “Recovery”; don’t forget to select where exactly the files have to be saved. We don’t recommend saving them to the same disk, so make sure you have another storage device to put your recovered data to. When the recovery process is over, you’ll find all of the files in the folder you have chosen.

How to recover data from a RAIDz2 system (second level)

In order to recover any information, from RAID-z2 (that is, a second-level array) you also need to connect its disks to a Windows computer and then run Hetman RAID Recovery.

RAID-Z2 is more failure-resistant as it uses two parity blocks and two data blocks for every single bunch of data. It is similar to RAID 6 and it can survive even if two disks are down. In RAID-Z2, you are required to use at least four disks. So if your computer doesn’t have enough ports to connect all disks, you can easily exclude two of them from the array.

The program was able to rebuild the RAID even though two disks are missing. Right-click on the RAID and run Fast Scan. As a result, you can see the files which are still on the disks. Select the ones you need to restore and do it.

A RAID-z2 array missing two disks

If the program failed to find certain files, they may have been erased; in this case, try “Full analysis”.

Conclusion

As a result of this testing, Hetman RAID Recovery was able to find 100% of data from a RAID-Z array based on the ZFS file system and deployed on a TrueNAS server. The program managed to recover the files in their original form, without any damage or loss of quality.

Hetman RAID Recovery will help you recover lost data if files are removed accidentally from a hard disk inside a NAS system, if a hard disk is formatted, the disk array is misconfigured, if there are any firmware issues, software errors, or in other scenarios involving loss of data, or loss of access to the network drive, or damage to the RAID volume.

Go to view
ZFS File System on Linux Ubuntu and Its Key Advantages

ZFS File System on Linux Ubuntu and Its Key Advantages

Vladimir Artiukh

Author: , Technical Writer

Vladimir Artiukh is a technical writer for Hetman Software, as well as the voice and face of their English-speaking YouTube channel, Hetman Software: Data Recovery for Windows. He handles tutorials, how-tos, and detailed reviews on how the company’s tools work with all kinds of data storage devices.

Oleg Afonin

Editor: , Technical Writer

Oleg Afonin is an expert in mobile forensics, data recovery and computer systems. He often attends large data security conferences, and writes several blogs for such resources as xaker.ru, Elcomsoft and Habr. In addition to his online activities, Oleg’s articles are also published in professional magazines. Also, Oleg Afonin is the co-author of a well-known book, Mobile Forensics - Advanced Investigative Strategies.

Recommended For You

Hello! This is AI-based Hetman Software virtual assistant, and it will answer any of your questions right away.
Start Chat