How to Recover Deleted Files from an Encrypted ZFS dRAID1
How do you recover deleted files from an encrypted ZFS dRAID1 pool when one drive is unavailable? Using three pools on FreeBSD as examples, this article covers recovery after file deletion, destruction of a pool and its GPT partitions, and retrieval of earlier file versions from ZFS snapshots with Hetman RAID Recovery.

- ZFS dRAID1 test storage configuration
- Test data preparation and three data loss scenarios
- Safely connecting ZFS drives for recovery
- How to recover deleted files and a destroyed dRAID1 pool
- How to recover files from encrypted ZFS snapshots
- Test results and limitations
- Frequently Asked Questions
- Comments
dRAID provides protection against drive failures within the array’s redundancy limits, but not against erroneous commands, file deletion or loss of the encryption key. In our test, we analyzed only three of the four drives and accessed the encrypted contents using a known passphrase.
How to Recover Data from an Encrypted ZFS dRAID1 Pool
ZFS dRAID1 test storage configuration
On a FreeBSD server, we used four SSDs accessible as mfid2, mfid3, mfid4 and mfid5. We created a GPT partition table and three freebsd-zfs partitions on each drive. Partitions with the same number across the drives were combined into separate pools: pool1, pool2 and pool3.

| Parameter | Test configuration |
|---|---|
| Storage devices | 4 SSDs, 59G each as reported by FreeBSD |
| Partition layout | GPT, 3 partitions per drive, 21,160,263,680 bytes each |
| Partition starting LBAs | 2048, 41330688, 82659328 |
| Geometry of each pool | draid1:2d:4c:1s |
| Ashift | 12 (4096 bytes) |
| Encryption | aes-256-gcm, keyformat=passphrase, keylocation=prompt |
| Recovery environment | Windows 10 in a bhyve VM, three of four drives |
In the draid1:2d:4c:1s configuration, draid1 specifies one parity block per redundancy group, 2d specifies two data blocks, 4c specifies four child devices in the vdev, and 1s specifies distributed spare capacity equivalent to one child device. Since the members here are partitions, each pool’s spare capacity is equivalent to one partition, not a whole physical drive. Data, parity and spare capacity are distributed across the members. The spare speeds up redundancy restoration but does not provide a second independent parity block: dRAID1 is designed to tolerate the loss of one member.

To create pool1 in the lab, we ran zpool create -o ashift=12 -O encryption=aes-256-gcm -O keyformat=passphrase -O keylocation=prompt -m /pool1 pool1 draid1:2d:4c:1s /dev/gpt/pool1_mfid2 /dev/gpt/pool1_mfid3 /dev/gpt/pool1_mfid4 /dev/gpt/pool1_mfid5. We prepared pool2 and pool3 in the same way, using the corresponding GPT labels and mount points.
This describes how the test environment was created. Do not run pool creation or destruction commands on storage devices containing lost data.

Native ZFS encryption works at the dataset level, not at the level of individual physical drives. Some structural pool metadata remains accessible without a key. Detecting the dRAID structure and decrypting files are therefore separate stages: access to the contents requires the correct passphrase and intact essential encryption metadata. See the OpenZFS documentation for more about dRAID geometry.
Test data preparation and three data loss scenarios
We copied test files into the General directory of each pool. Its visible contents consisted of 24 files totaling 368.2 MiB and one subdirectory. The files included BMP, JPG and PNG images, DOCX documents, XLSX spreadsheets, MP4 videos, and RAR and ZIP archives. This allowed us to test recovery of different data types rather than just directory metadata.

Scenario 1: deleted files in pool1
We deleted some files using Shift+Delete, bypassing the Trash, and then exported pool1 from FreeBSD to stop using it. The GPT partitions and pool remained, but some files were no longer present in the current filesystem state.
Scenario 2: destroyed pool2 and deleted GPT partitions
In pool2, we first deleted some files. In Thunar, 16 files in the General directory were selected for deletion. We then ran zpool destroy pool2 in the lab and deleted the second GPT partition on each of the four drives.


Do not repeat these destructive operations to recover data. Deleting a pool or its partitions can cause irreversible data loss.
Scenario 3: file deletion after creating pool3 snapshots
In pool3, after copying the original data, we created the pool3@files-uploaded snapshot. We then added a Video directory containing 16 files totaling 136 MiB and created a second snapshot, pool3@additional-files-uploaded. After that, we deleted some of the original files and exported the pool. In the lab, we created snapshots using zfs snapshot pool3@files-uploaded and zfs snapshot pool3@additional-files-uploaded, and checked their list with zfs list -t snapshot -r pool3.

A ZFS snapshot preserves the state of a dataset at the time it was created by retaining the necessary earlier blocks. If a file existed in that state, it can be retrieved from the retained snapshot without rolling back the entire current dataset. However, a snapshot is not an independent backup: it depends on the availability of blocks within the same pool.
Safely connecting ZFS drives for recovery
Stop using the storage after data loss. Do not initialize or format the drives, create a new pool, perform a forced import with transaction rollback, or run scrub, resilver or other repair operations on the original devices. Avoid automatic read-write mounting, background writes and TRIM/discard. If safe, create sector-by-sector images of all available drives on separate healthy storage devices and analyze the copies. If a drive is physically damaged or unstable, even imaging may worsen its condition; consult a specialist.
Hetman RAID Recovery runs on Windows, Linux and macOS. You can connect drives directly to a computer or via a compatible docking station, analyze their images, or connect to the server via SSH if its block devices are accessible. Learn more: how to prepare RAID drives for recovery.
In our test, the drives remained on the FreeBSD server, and three of them were presented to the Windows 10 guest through emulated bhyve AHCI controllers. The VM’s system disk was stored separately from the test drives. This is the mapping of host block devices to virtual disks, not PCI passthrough of a physical controller.
STEP 1. Check the partition layout and pool status on the host
Check the drive identifiers and GPT partition layout. In our configuration, we used the following command:
gpart show -l mfid2 mfid3 mfid4 mfid5
The output shows partitions for pool1 and pool3, with approximately 20G of free space where the second partition was deleted. The entire drive must be presented to the VM so that the software can also analyze this area.

Check which pools are imported on the host:
zpool status
In our test, only the system pool zroot on mfid0p4 remained. Before connecting the drives, make sure no service or application on the host is writing to them. If a pool is still active, first assess its condition and the risks of stopping it; do not perform forced operations on damaged storage.

STEP 2. Configure AHCI disks in bhyve
Shut down the VM completely. In Bhyve Manager, locate its directory and open the configuration file. In our test, it was /zroot/bhyvemgr/windows10/bhyve_config.conf. Make a copy of the configuration before editing it.
Create a separate AHCI controller with an unused PCI address for each drive. Specify the hd type, the path to the entire block device rather than a partition, and the protection parameters. The following settings are from the configuration shown in the video; they are not universal addresses for other servers.
| Configuration parameter | Value for the first drive |
|---|---|
pci.0.3.0.device | ahci |
pci.0.3.0.port.0.nodelete | true |
pci.0.3.0.port.0.path | /dev/mfid2 |
pci.0.3.0.port.0.ro | true |
pci.0.3.0.port.0.type | hd |
In the configuration shown, the remaining drives are configured in the same way: pci.0.4.0 for /dev/mfid3 and pci.0.5.0 for /dev/mfid4, with port.0, type hd and both protection parameters. All lines in a given block must use the same PCI prefix.

According to the bhyve_config documentation, ro=true prevents writes to the corresponding block device through bhyve, while nodelete=true disables translation of guest TRIM requests into DIOCGDELETE. These settings do not protect against host-side writes, undo previous TRIM operations or replace working with disk images.
STEP 3. Start Windows
Save the configuration, refresh its display in Bhyve Manager and check the added devices under Device settings, in the Storage section. Start the VM. If Windows prompts you to initialize or format unknown drives, decline.

How to recover deleted files and a destroyed dRAID1 pool
STEP 1. Automatically detect the pools and missing drive
Launch Hetman RAID Recovery. We used Hetman RAID Recovery 3.1 (Unlimited Edition) in this test. The software automatically detected all three pools, including the destroyed pool2. Select the required pool and inspect its properties in the right-hand pane. The software identified the dRAID1 type and ZFS encryption. The Locked status means a passphrase is still required to access the encrypted contents.

Check each pool's members. In the initial reconstruction screenshots, partitions from three drives were available: mfid2, mfid3 and mfid4; the fourth member (mfid5) was absent from the reconstructed pools and marked Missing disk. Later advanced search screenshots show mfid3–mfid5 in the list of found partitions. These screenshots do not establish that mfid5 was the missing drive in every session. This state does not mean the pool has been repaired: the software reconstructs it for reading and analysis.

Further down the device list, the software also displayed the physical drives and found partitions, including those formerly belonging to pool2. This is a separate result of disk structure detection, not yet proof of the integrity of all files.

STEP 2. Unlock pool1 and run a quick scan
Double-click pool1. When prompted for a password, enter the passphrase set when configuring ZFS encryption.

Select Fast scan and wait for the analysis to finish. Open the General directory in the results. The wizard reported 4 folders and 96 files found in pool1. The software displayed the directory structure, existing files and found deleted files marked with a red cross.

If the required files are missing after a quick scan, try Full analysis for ZFS if this mode is available in your software version. Work with copies, especially if repeated scans are needed. A full analysis does not guarantee recovery of overwritten blocks or blocks made inaccessible by TRIM.
STEP 3. Analyze the destroyed pool2
Double-click pool2, enter the password and start Fast scan. When it finishes, open the found directories. The quick scan wizard for pool2 also reported 4 folders and 96 files. Despite the destruction of the pool and deletion of its partitions, the test found both files that remained at the time of destruction and some files deleted earlier.

Check the required images, documents or other supported formats in the preview pane. A name and size alone do not prove that contents are intact. A correct thumbnail or preview generated from the file data confirms that the corresponding file can be recovered with a very high likelihood that its contents are intact. On Windows 10, the software cannot generate previews or thumbnails for every file. The absence of a thumbnail alone does not mean a file is corrupt or recovery has failed. In this test, files without displayed thumbnails were also recovered. For such files, check their contents in the appropriate application after saving them to another storage device.
STEP 4. Save the recovered files
Select the required files and click Recovery. In the wizard, choose to save to a disk and specify a directory on a different physical drive. Wait for copying to finish. If needed, save the files found in pool1 in the same way.
Do not save the results to any drive from which the pool is being recovered, even if the target partition appears empty. Writes may overwrite lost blocks belonging to other pools on those same drives.

How to recover files from encrypted ZFS snapshots
Snapshots allow you to retrieve a previous file version or a file deleted after the snapshots were created. In this scenario, you do not need to run zfs rollback or change the pool's current state. Hetman RAID Recovery lets you browse detected snapshots and copy individual files.
STEP 1. View the current contents of pool3
Open pool3, enter the passphrase and start Fast scan. The test results displayed the General and Video directories and the Snapshots section. The wizard reported 17 folders and 320 files found; these are counts of found objects, not confirmed counts of recovered files. The General directory contained existing files and found deleted files marked with red crosses.


STEP 2. Compare the two snapshots
Open Snapshots and the first snapshot, files-uploaded. It contains the original General directory, while Video does not yet exist there. For example, mp4_40mb_deleted.mp4 and png_14mb_deleted.png are marked as deleted in the current state but appear without red crosses and with thumbnails in the first snapshot.

Return to the snapshot list and open additional-files-uploaded. Both directories, General and Video, are present here. Check the required files in the corresponding state: if a file was deleted later, it may still be present in a snapshot as a regular existing file, without a red cross.

STEP 3. Search current data and snapshots for files
If you know the filename or part of it, use Find File. Open the root of pool3, enter a search expression and click Find. The search covers the current directory and its subdirectories, so starting at the pool root lets you search the detected snapshots as well. In the test, searching for the filename fragment ocean returned 24 results, including a video with an available preview.

In the Advanced section, you can also specify file size, date or attributes. In the example of a search for files larger than 1 MB, the software reported 248 found objects. Compare the found copies and their locations to select the required state.

STEP 4. Collect and save files from different states
If the required files are in different directories or snapshots, right-click a file and select Add For Recovery. The Recovery list pane will open. Navigate to other directories and snapshots and drag the required files into the list.

Click Recover in the list pane and save the selected data to a separate physical drive. If the list contains multiple versions of the same file, make sure the copies you need are not replaced by others when saving.
Test results and limitations
| Scenario | Test result |
|---|---|
pool1: file deletion | Automatic detection, unlocking with a password, existing and found deleted files after Fast scan. |
pool2: file deletion, destruction of the pool and its partitions | Automatic detection of the destroyed pool, detection of former GPT partitions, preview and saving of selected files, including previously deleted ones. |
pool3: deletion after creating two snapshots | Access to current contents and two snapshots, searching and saving selected files from different states. |
In all three scenarios, a quick scan was sufficient for analysis, and three of the four dRAID1 members were sufficient for reconstruction. After saving the selected files, we opened them in the appropriate applications and checked that the contents were displayed. The test also recovered files for which the Windows version of the software did not display thumbnails. This does not constitute a byte-for-byte comparison with the originals or confirmation that every file from every pool was recovered.
Recovery depends on the preservation of ZFS metadata, block availability, dRAID geometry, the correct passphrase and the condition of the drives. Distributed spare capacity does not make dRAID1 tolerant of simultaneous loss of two members. On SSDs, previously issued TRIM operations and internal drive processes may make some data inaccessible. Recovering files does not mean that the original pool has been repaired or can safely be returned to service.
For another ZFS configuration on FreeBSD, see also recovering a deleted RAIDZ2 pool and files from a snapshot. If you recover the required data, verify it and create an independent backup.







