I just managed to almost completely delete my main volume’s datasets.
I wanted to duplicate some nested datasets from my SSD pool to my HDD pool. I snapshotted and then tried to restore that snapshot to the HDDs in a new location, but was told that was impossible because the source and destination volumes were different.
I then tried to set up a replication task using the GUI to do the same thing (a process I recently set up successfully for a single dataset, so I thought I was safe in doing so). I set the source as /mnt/ssd_1/apps and the destination as /mnt/volume_1.
The replication task created a snapshot for the parent dataset (“apps”, containing “plex”, “syncthing” and “qbittorrent”, all within my ssd_1 voume). I thought that the replication task would therefore recreate the same structure (i.e. /mnt/volume_1/apps/). When the GUI warned me that all existing snapshots would be deleted, I thought that it was referring to any potential (but not actually existing) snapshots in that new /apps dataset, so I confirmed and carried on.
The replication started, then failed because one of the datasets was “in use”. I looked, and every other dataset was gone, along with all of the snapshots (as the warning message had told me they would be).
No, I don’t have this data backed up elsewhere. To be fair, some of it is backups from other machines, and therefore is recoverable from those machines and their offline backups. The rest is the media for my Plex server, and therefore incredibly frustrating to lose but ultimately replaceable.
I did some panic googling and came across this old post: I followed it’s instructions; find the transaction number that started the destruction, then export the volume and attempt to reimport it with the last preceding transaction (i.e. the bad transaction minus one). This failed, saying " One or more devices is currently unavailable". I tried again with the last visible transaction in the zpool history for the pool, and I got the same error message.
I’ve shut the server down now. Is there any way I can reconstruct the lost datasets, or do I have to rebuild from scratch?
(Further note: the destroyed pool also contained the datasets for virtual machine system (which I wasn’t actually using) and the .bhyve dataset which I think was rendered redundant when I upgraded the server from Core to System a week ago. If I have to rebuild from scratch, how do I get TrueNAS to recreate any of these datasets it deems necessary?)
Thanks in advance.