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.

- Test environment: TrueNAS, Immich and ZFS dRAID2
- Preparing the data and deletion scenarios
- How to prepare TrueNAS drives for safe recovery
- How to recover Immich photos and videos from encrypted ZFS dRAID2
- STEP 1. Automatically reconstruct the array
- STEP 2. Unlock the datasets and scan ZFS
- STEP 3. Find deleted files in the current pool state
- STEP 4. Recover files from a snapshot without rollback
- STEP 5. Search for and verify the required photos and videos
- STEP 6. Save files from different folders and the snapshot
- Recovery results and limitations
- Frequently Asked Questions
- Comments
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.
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.



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.

| Storage | Purpose | Unlock method |
|---|---|---|
tank/immich/data | Application files, including uploaded photos and videos | Root dataset key |
tank/immich/postgres_data | Immich database | Root dataset key |
tank/immich_external | External library, files added over SMB | Separate passphrase |

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.

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.


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.

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.

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.

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.


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

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.

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.

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.

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.

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.

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.

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.

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.

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.



Recovery results and limitations
| Scenario | Test result |
|---|---|
| Two SSDs missing | The dRAID2 pool was automatically identified from the three available SSDs. |
| Two encryption roots | Data was unlocked with the passphrase and key file. |
| Deletion over SMB | Correct thumbnails of deleted photos and photo export were confirmed. |
| Deletion through Immich followed by emptying the trash | The required deleted files were not found in immich/data after Fast scan. |
| Snapshot files-uploaded | Reading 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.



