SOLVED Accidentally deleted all jails... How to restore from snapshots?

zamana

Contributor
Joined
Jun 4, 2017
Messages
163
I accidentally delete all my jails/plugins.

I have backup of everything and I have access to the files.

My question is: how do I make them appear again in the system (and in the GUI)?

Do I need to create them all, one by one, and then restore the files? Or is there a way to just restore them, files and configuration and everything else needed by FreeNAS so they "appear" again?

Thanks.
Regards.
 

Heracles

Wizard
Joined
Feb 2, 2018
Messages
1,401
Hi,

Well... The first thing is to reconcile your post's subject with your post's object...

The subject asks about restoring snapshots while the object asks about restoring files.

So what is it that you need to restore ? A ZFS snapshot or a bunch of files ?

The best way to restore a snapshot is to clone the snapshot you are looking for and mount it where you need it. A more aggressive way is to promote that snapshot back to master, but that procedure will destroy all the snapshots you took after the one that you will promote.

If you are about to restore a bunch of files, it all depends of what these files are...

Here, for my Nexcloud server, I have a file that is a dump of the MySQL database. That file is to be restored using the database client tools with some commands. The other are tarballs of specific directories to be restored to the proper place from where they have been taken. So for each of them, the command is different and move from a folder to another.
 

zamana

Contributor
Joined
Jun 4, 2017
Messages
163
Hi!

Thanks for reply and sorry for the misunderstanding...

My target is to restore my jails (all of them). By the way, I have the dataset where they are (or were) backed up through the snapshot resource offered by ZFS.

So, to summarize, I would like to know if there is a way to restore all the jails by restoring the latest snapshot, without recreating them, one by one, and restoring the files after.

Regards.
 

Heracles

Wizard
Joined
Feb 2, 2018
Messages
1,401
Hi,

So Yes, you need to restore a snapshot and Yes, that is certainly doable. I explained to you how to do it in my first post.
 

zamana

Contributor
Joined
Jun 4, 2017
Messages
163
The snapshot restore part is done. The problem now is that the restored jails aren't being recognized by FreeNAS. iocage list shows nothing. The GUI shows nothing.

So, the next step is: once the files are restored, what's need to be done for the jails itself reappears in the system?
 

zamana

Contributor
Joined
Jun 4, 2017
Messages
163
Old thread... I know. But as I'm the OP, I guess I have the right to answer my own question, at least.

And the solution was hidden in plain sight, as detectives used to say: the solution is to use "iocage export/import". It's the most portable way to backup and restore jails, FreeNAS database and UI aware.

Thanks.
Regards
 
Top