How to recover Immich photos and videos from encrypted ZFS dRAID2 on TrueNAS

How can you recover deleted Immich photos and videos on a TrueNAS server when they are stored in encrypted ZFS datasets and two array members are unavailable? Using dRAID2 as an example, we will look at automatic pool reconstruction, unlocking data with a key and passphrase, finding files deleted over SMB, and recovering files from a snapshot without rolling back the dataset.

How to recover Immich photos and videos from encrypted ZFS dRAID2 on TrueNAS

Immich is a self-hosted application for storing and organizing photos and videos. It can work with files uploaded directly to the application as well as existing media in external libraries. File deletion in these storage locations and loss of access to drives require different recovery approaches.

To analyze the drives outside TrueNAS, we will use Hetman RAID Recovery. We use Windows in this test; the software is also available for Linux and macOS.

Go to view
How to Recover Immich Photos and Videos from Encrypted ZFS dRAID2 on TrueNAS

How to Recover Immich Photos and Videos from Encrypted ZFS dRAID2 on TrueNAS

Test environment: TrueNAS, Immich and ZFS dRAID2

We tested TrueNAS Community Edition 25.10.7 (Goldeye), Immich 3.3.0 and Hetman RAID Recovery 3.2 Unlimited Edition. The server reports an Intel Xeon E5649 and 78.6 GiB of available ECC memory. On the TrueNAS server, we created a pool named tank on five SSDs in a dRAID2 configuration with one distributed spare (draid2:2d:5c:1s). dRAID2 uses double parity and tolerates the loss of two members provided the remaining drives are healthy and the required metadata is accessible. Spare capacity equivalent to one drive is distributed across all five SSDs and is used for reconstruction after a drive failure. It is neither a sixth physical drive nor an additional level of parity. The TrueNAS wizard specifies one vdev, five children, two data devices and one distributed hot spare. The wizard shows a minimum size of 55.38 GiB and classifies the drives as HDDs; the locally connected drives are visibly SSDs. After creation, TrueNAS reports 105.63 GiB of usable capacity. For production dRAID deployments, the TrueNAS wizard recommends at least ten drives per vdev; the five-drive configuration is for lab testing.

TrueNAS Pool Creation Wizard: dRAID2, Children 5, Data Devices 2, Distributed Hot Spares 1, AES-256-GCM
Single-vdev geometry: two data blocks, two parity blocks and distributed spare capacity.
Storage Dashboard: tank, Usable Capacity 105.63 GiB, Auto TRIM Off
Automatic TRIM was disabled when the pool was created.
TrueNAS: tank/immich tree with data and postgres_data, root dataset tank, Type Key
The root dataset key is used for inherited encryption.

Native ZFS encryption (AES-256-GCM) is configured at the dataset level, not independently on each physical drive. In our configuration, application data and the Immich database reside in separate datasets under tank/immich and inherit the key of the root dataset tank. The tank/immich_external dataset has its own passphrase and is attached as an Immich external library. Files were added to it over SMB. In Immich, the external library is configured to use /mnt/external/Photo.

TrueNAS: tank/immich_external, Encryption Root Yes, Type Passphrase
The external dataset has its own encryption root.
StoragePurposeUnlock method
tank/immich/dataApplication files, including uploaded photos and videosRoot dataset key
tank/immich/postgres_dataImmich databaseRoot dataset key
tank/immich_externalExternal library, files added over SMBSeparate passphrase
Immich 3.3.0: New External Library with the path /mnt/external/Photo
The external library originals remain in file storage.

Preparing the data and deletion scenarios

First, we uploaded test photos and videos directly to Immich and copied other media to the external storage over SMB. We created a snapshot of the external dataset named files-uploaded, then added more files to the external library. The snapshot therefore preserves an earlier state of immich_external only, not the entire pool.

TrueNAS Snapshots: tank/immich_external, files-uploaded
The recovery point covers only the external dataset.

We simulated two data loss scenarios:

  • We deleted some files uploaded through Immich and emptied the application’s trash.
  • Separately, we deleted some photos and videos from the external dataset over SMB.

These operations were performed on test data and are not recommended as recovery steps.

Immich Trash: confirmation dialog for permanently emptying the trash
This is the first lab data loss scenario.
Windows File Explorer: Delete Multiple Items dialog in the immich_external/Photo network folder
The second scenario is permanent file deletion over SMB.

We then stopped the SMB service, used Export/Disconnect without destroying data, and shut down the server normally. We had saved the key file and passphrase in advance for subsequent analysis.

How to prepare TrueNAS drives for safe recovery

Before you start recovering data:

  • Stop writes to the entire pool, not just the dataset containing the deleted files.
  • Stop Immich, automatic uploads from phones, synchronization, SMB and any other services that may write data.
  • Do not empty the trash or delete snapshots if they are still available.
  • Do not initiate TRIM, RAID rebuilds, forced mounts or repair operations on the original drives.

After TRIM/discard, deleted data on SSDs may become unrecoverable.

If the pool is functional and the required data is in the trash, a snapshot or a separate backup, check those sources first. For analysis outside TrueNAS, after stopping services and writes, detach the pool using Export/Disconnect without enabling data destruction. Shut down the server normally before physically disconnecting drives. If a drive has a physical fault, avoid stressing it with repeated scans; where safe, create byte-for-byte images of the accessible drives on other healthy media or consult specialists.

Connect the drives to a computer via SATA or a compatible docking station. For direct SATA connections, the computer must also be switched off. Alternatively, read the physical drives over SSH if the server is reachable over the network, writes to the pool have stopped and the account has appropriate permissions. For more on connection methods and images, see the RAID recovery guide.

In the test, we connected only three of the five SSDs through a docking station to test dRAID2 reconstruction with two members missing. This is a lab condition: in a real case, use all available healthy members rather than deliberately disconnecting any.

If Windows prompts you to initialize or format the ZFS drives, decline. Do not create partitions or write data to the source media.

Three drives in a MAIWO docking station
Only three of the five SSDs were used in the local test.
For recovering data from failed RAID arrays, NAS devices, and other multi-disk storage systems.

How to recover Immich photos and videos from encrypted ZFS dRAID2

STEP 1. Automatically reconstruct the array

Launch Hetman RAID Recovery. In our test, its main window displayed three connected SSDs with ZFS partitions. Using the array metadata, the software automatically reconstructed the array structure for reading. The tank pool appeared under RAID Volumes.

Select the pool and examine the information pane on the right. In the test, HRR displayed the dRAID2 type, ZFS file system and a size of 219.13 GB. This is not the usable capacity of the datasets: TrueNAS reported 105.63 GiB of usable capacity. Under RAID Disks, three available members and two Missing disk entries are displayed. Under Encryption, the software shows ZFS Native Encryption with the status Locked. Detecting the array geometry does not mean the encrypted files are already accessible.

Hetman RAID Recovery 3.2: tank, 219.13 GB, dRAID2, Locked and two Missing disk entries
The software automatically identified the structure from the three available drives.

STEP 2. Unlock the datasets and scan ZFS

Double-click the tank pool. In our configuration, the software prompted for two different decryption credentials in succession because the external library has its own encryption root. In the first dialog, we selected Password, entered the passphrase for immich_external and clicked Unlock.

Unlock Disk (1 of 2): Password, password masked
The first prompt requests the external library passphrase.

In the second dialog, we selected Key file, clicked the file selection button to the right of the path field, specified the previously saved key file for the tank root dataset and clicked Unlock. This key is required to access the Immich datasets that inherit encryption. An Immich or SMB account password is not a substitute for the ZFS key.

Unlock Disk (2 of 2): Key file
The second prompt requests the root dataset key file.
File Recovery Wizard: Fast scan and ZFS in the file system list
Start with a fast scan; full ZFS analysis is available in this version.

After unlocking, select Fast scan and start scanning. When it finished, the pool root displayed immich, immich_external, system datasets and the Snapshots folder.

Root of tank with Snapshots, immich, immich_external and Unlocked status
The pool structure is accessible after unlocking.

STEP 3. Find deleted files in the current pool state

Open immich_external and navigate to the photo and video folders. In the test, alongside existing files, the software displayed files deleted over SMB, marked with a red cross. Distinguish detected metadata from file contents: a name or size alone does not establish that the entire file can be read. Check the thumbnails and previews of the media you need.

immich_external/Photo: BMP, JPG and PNG thumbnails marked with red crosses
Correct thumbnails establish the recoverability of the specific deleted photos.

Return to the pool root and open immich. The software displayed the application and database datasets. The directory immich/data/library/admin/2026/10/13 shows 11 existing photos and videos, but the files deleted through Immich followed by emptying the trash were not found in immich/data after Fast scan.

immich/data/library/admin/2026/10/13: existing photos and videos after Fast scan
Existing media files are accessible after a fast scan.

New writes may reuse blocks freed by deletion. Because datasets in the same ZFS pool share free capacity, writes to other datasets also pose a risk. TRIM is an additional factor on SSDs. The exact reason for the unsuccessful result in this test was not established. If the required files are missing, try Full analysis for ZFS, preferably on disk images. This mode is available in HRR 3.2. The outcome of full analysis was not investigated in this experiment.

STEP 4. Recover files from a snapshot without rollback

Return to the root of tank and open Snapshots. Locate the external library snapshot named files-uploaded. In HRR, it is displayed as immich_external (2026-10-12 11:26). It contains the state of the dataset at creation time, including files deleted later.

Snapshots: Photo directory of the immich_external snapshot and a photo preview
The October 12, 2026 snapshot contains files from before subsequent changes.

Photos and videos added after this snapshot was created are absent from it. Nor does it cover the separate dataset containing files uploaded directly to Immich. Check the required files in preview. In our case, we were able to read the contents of several files from the snapshot.

There is no need to perform a rollback in TrueNAS: it changes the current dataset state and can cause later changes to be lost. Selectively saving files from the snapshot to another drive leaves the current state untouched.

STEP 5. Search for and verify the required photos and videos

If data is scattered across many folders, use Find File. Return to the root of tank so the search covers nested datasets and the available snapshot. Enter the file name or part of it and start searching. Check the path of each result: files with the same name may exist in both the current external library and the snapshot.

Search results in tank: 23 results for jpg, including thumbnails of deleted files
Searching from the pool root covers nested folders; identical names require checking paths.

Open Advanced if you need to filter by size or date, or include hidden and system files. In the demonstration, a jpg search with a filter for files larger than 1 MB returned 23 results. Repeat the search using the parameters you need.

Advanced: jpg search with the Big (more than 1 MB) size filter
Size and date criteria help narrow the search.

Before saving, open the photos and videos you need in preview and expand to full screen if necessary. Correct thumbnails and previews help you check file contents before saving. In the test, we previewed the existing video river.mp4 in full screen.

Full-screen Preview of the existing river.mp4 from the Immich library
Full-screen playback helps you check a video before saving it.

STEP 6. Save files from different folders and the snapshot

Right-click a file you need and select Add for recovery. Collect the required deleted files from the external library in the Recovery list pane on the right. Then open the snapshot and drag the required files from it into the same pane. This lets you save files from different directories and dataset states in one session.

Recovery list with six files and the open immich_external snapshot
Selected files from the current state and snapshot can be saved together from the list.

Review the list, click Recovery, select the option to save to disk and specify a folder on another physical drive. Confirm the settings and start saving. If files have identical names, make sure the required versions are not overwritten during saving.

Do not save recovered files to the source SSDs, another dataset in the same pool, or the image from which you are recovering data.

File Recovery Wizard: Save to hard disk
Selecting the save method for a separate physical drive.

When the operation finishes, open the destination folder in File Explorer. Explorer shows six exported files in the Restored Files folder on the computer’s C: drive. In Windows, we opened the previously deleted photo jpg_3mb_deleted.jpg and the existing video river.mp4. Snapshot files are shown in HRR preview, and the selected files appear in the final list and export folder.

Windows File Explorer: Restored Files folder on C: with six files
The selected media files have been exported to the computer's drive.
The photo jpg_3mb_deleted.jpg opened in Windows
The file marked as deleted in the source library was actually saved and opened.
Playback of the saved river.mp4 in Windows
The exported existing video opens outside the source pool.

Recovery results and limitations

ScenarioTest result
Two SSDs missingThe dRAID2 pool was automatically identified from the three available SSDs.
Two encryption rootsData was unlocked with the passphrase and key file.
Deletion over SMBCorrect thumbnails of deleted photos and photo export were confirmed.
Deletion through Immich followed by emptying the trashThe required deleted files were not found in immich/data after Fast scan.
Snapshot files-uploadedReading photos from the snapshot and including files in the shared export list without rollback were confirmed.

The test demonstrates access to media files, not complete restoration of the Immich application. The presence of the database directory does not establish that the database is functional. To restore the entire system, including albums, accounts and metadata, you need a consistent backup of the database and files; see the official Immich backup and restore documentation. For recovered external library originals, you can configure the library in a working Immich instance once recovery is complete and rescan it; preservation of the former albums and metadata is not guaranteed.

Double parity is not a substitute for a backup: it does not protect against file deletion, loss of a key or overwritten blocks. Snapshots also depend on the availability of the source pool. Keep separate backups of media, the database and encryption keys. Another example of reconstructing storage with native encryption is presented in the article on recovering files from encrypted ZFS dRAID1.

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.