Performing a regular iocage jail(s) backup, _not_ just snapshots.

Status
Not open for further replies.

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,377
I recently had an issue where I lost an entire jail folder.

/mnt/iocage/jails/JAILNAME.
Because the root folder got nuked, all snapshots just decided to up and disapear also.

What is the definitive way to back this up. I'm quite content with some kind of RAR or CP solution which just drops an entire copy of /iocage/*.* elsewhere.
Mine isn't much larger than 50GB, glad to dump it elsewhere once a day.

Any thoughts, anyone else got a solution for this?
Important bonus points, eventually I will be moving to a cloud based backup, it'd be nice drop this daily backup into the cloud too.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
Snapshots (mandatory)
Replication job to localhost or other host (make sure to set the zfs property "canmount=noauto" on the replica datasets once they are created if on localhost as the /mnt/iocage mount is a problem otherwise on reboot)
Optional copy to cloud from the replica at your leisure (using the cloud sync feature or whatever you want)
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,377
What about a rar though, to a folder or a zip?
I'd like to manually capture the data, the whole lot /iocage/*.* - oldschool style, just once a week or a day. I could set up a cron job, but I'm not sure if I would lose any permissions etc?
I want to be able to pull data out manually, in a last case scenario. Couldn't be more than 10 or 15GB compressed.
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
What about a rar though, to a folder or a zip?
I'd like to manually capture the data, the whole lot /iocage/*.* - oldschool style, just once a week or a day. I could set up a cron job, but I'm not sure if I would lose any permissions etc?
I want to be able to pull data out manually, in a last case scenario. Couldn't be more than 10 or 15GB compressed.
I'm not sure if my technique would help you but I use a script to backup plex and other jails to a tar files. Then I use syncback free to copy to my windows computer after running the backup scripts as a daily cron job. Just learning snapshots and wanted to have another way to backup my jails.
 

gt2416

Patron
Joined
Feb 4, 2018
Messages
262
You could just use iocage export <JAILNAME>
it will be stored as a tarball on your iocage Harddrive and be mounted at iocage/images.
To restore you can use iocage restore <Nameoffile>
This is better than cp or anything as you could break permissions if you're not careful.
The ONLY caveat is that the jails must be stopped during an export.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
What about a rar though, to a folder or a zip?
I'd like to manually capture the data, the whole lot /iocage/*.* - oldschool style, just once a week or a day. I could set up a cron job, but I'm not sure if I would lose any permissions etc?
I want to be able to pull data out manually, in a last case scenario. Couldn't be more than 10 or 15GB compressed.
If you set snapshots to be the frequency you want (one per week or day as you mentioned), and had a replication job, you would have exactly what you're looking for. (and can keep the jails online while this happens... although shoutout to @gt2416 for the good solution if you're OK with offline backups )
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,377
I have literally 3 solutions in a row, which I appreciate!


Here's a couple of questions.
If I have the qbittorrent plugin installed, I then export "qbittorrent_1" (jail for said plugin)

I then get a brand new fresh FreeNAS machine, install "qbittorrent" plugin again and then import the "qbittorrent_1" tarball, would this effectively be a full migration from one machine to another?

I want a total, bulletproof copy of it and I'd prefer it be only once a week, so I'm happy to blow a little extra CPU time and really use high compression.


I don't know much about snapshot exports and imports, do they get stored as a single file or are they at a different layer of the filesystem? (long story short, can I literally copy one, to /mnt/data/backups/iocagesnapshotrawfiles/jailname.JAIL and then copy that to a USB drive over SMB) (I do this via robocopy, once a week)

As a Windows guy, NasKars solution and the export solution from gt2416 work for me from a "I can see and touch these files, across operating systems and filesystems" if I need to.

Thanks guys
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,377
Well rather than just ask questions, I thought I'd test.

I exported my sickrage_1 iocage jail, dumped the files on my test NAS and attempted to import them.

Code:
root@freenasnew[/mnt/TANK/iocage/images]# ls -l
total 696100
-rwxrwxrwx  1 root  wheel		 64 Nov  5 13:57 sickrage_1_2018-11-05.sha256
-rwxrwxrwx  1 root  wheel  714276629 Nov  5 13:57 sickrage_1_2018-11-05.zip
root@freenasnew[/mnt/TANK/iocage/images]# iocage import sickrage_1_2018-11-05.zip
sickrage_1_2018-11-05.zip not found!
root@freenasnew[/mnt/TANK/iocage/images]#



I even changed permissions, owner, nope - so I'm kinda baffled, but it's a start.
 

colmconn

Contributor
Joined
Jul 28, 2015
Messages
174
reading the code for iocage suggests that you place the zip file in the images directory as you have done and then import by jail name rather than using the zip file. So
Code:
iocage import sickrage_1

However, I've not tried this.
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,377
I just tried it, it worked better, imported a jail.
That being said, the jail starts but no sign of sickrage at http://<newIPotherServer>:8081/home (same URL as the actual jail on my main machine, except IP)

One difference I notice is the release version is 10.3 on the old server, 11.1-RELEASE on the new. Hmmm, that maybe?
What's the command again to start a process in a jail?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
Iocage exec jailname command

Or did you mean iocage console jailname

Either way, there you go.
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,377
Iocage exec jailname command

Or did you mean iocage console jailname

Either way, there you go.
Nope neither of those, sorry.

The one where I can start the sick rage service.

It's like service start service name, but I have no idea the name or why my imported jail isn't working, sadly.

Maybe the release version being wrong?
 

gt2416

Patron
Joined
Feb 4, 2018
Messages
262
The release 10.3 could definitely be an issue. Try importing the jail from the same version FreeNAS or higher. I have tried it and it works. I setup a NextCloud jail for my friend and sent him the zip files which worked flawlessly.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
Service servicename start.

That's the one you mean, I think.
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,377
EDIT: as documented below, I've confirmed a bug. Job / incident logged in the bug tracker.



Well darn,

I've been testing this for hours and I think I /might/ have found a bug, as usual.


So my main machine, I type
iocage export sickrage_1
It creates some zip files in /mnt/iocage/images/

I then copy those zip files to my new server in the iocage/images folder.
(NOTE: old server is /mnt/iocage/images. New server mount point is /mnt/SSD/iocage/images, seems odd)
ANY combination of iocage import, will not work for me unless I not only create a jail for it to import over the top of first, but I also must name the new jail sickrage (no _1 ?) for some reason?

See below, fail with "sickrage_1" - the actual name of the originally exported jail??
Code:
root@freenasnew[/mnt/TANK/iocage/images]# iocage list
+-----+-------------+-------+--------------+---------------+
| JID |	NAME	 | STATE |   RELEASE	|	  IP4	  |
+=====+=============+=======+==============+===============+
| -   | TestJail01  | down  | 11.2-RELEASE | DHCP		  |
+-----+-------------+-------+--------------+---------------+
| 1   | sabnzbdtest | up	| 11.2-RELEASE | DHCP		  |
+-----+-------------+-------+--------------+---------------+
| -   | sickrage_1  | down  | 10.3-RELEASE | 192.168.0.246 |
+-----+-------------+-------+--------------+---------------+
root@freenasnew[/mnt/TANK/iocage/images]# ls
sickrage_1_2018-11-06.sha256	sickrage_1_2018-11-06.zip
root@freenasnew[/mnt/TANK/iocage/images]# iocage import sickrage_1
Importing dataset: sickrage/2018-11-06
cannot open 'TANK/iocage/jails/sickrage/2018-11-06': dataset does not exist
cannot receive new filesystem stream: dataset does not exist
root@freenasnew[/mnt/TANK/iocage/images]#





Now here, with an incorrectly named, new jail to import the files into andthe 'dataset does not exist' error is gone.
_HOWEVER_ none of the files actually end up in the jail anyhow unfortunately!
(This explains my earlier problems wondering why sickrage wasn't starting)
See below:
Code:
root@freenasnew[/mnt/TANK/iocage/images]# iocage list
+-----+-------------+-------+--------------+---------------+
| JID |	NAME	 | STATE |   RELEASE	|	  IP4	  |
+=====+=============+=======+==============+===============+
| -   | TestJail01  | down  | 11.2-RELEASE | DHCP		  |
+-----+-------------+-------+--------------+---------------+
| 1   | sabnzbdtest | up	| 11.2-RELEASE | DHCP		  |
+-----+-------------+-------+--------------+---------------+
| -   | sickrage	| down  | 10.3-RELEASE | 192.168.0.246 |
+-----+-------------+-------+--------------+---------------+
root@freenasnew[/mnt/TANK/iocage/images]# ls
sickrage_1_2018-11-06.sha256	sickrage_1_2018-11-06.zip
root@freenasnew[/mnt/TANK/iocage/images]# iocage import sickrage
Importing dataset: sickrage/2018-11-06
Importing dataset: sickrage/2018-11-06/root
could not find any snapshots to destroy; check snapshot names.
root@freenasnew[/mnt/TANK/iocage/images]#


(Note the "importing dataset" this time?)

So, that's that, I'm utterly baffled here, how does one export a jail and then import it on another machine? Seriously :/
 
Last edited:

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,377
Upon further testing, I can create a brand new, 11.2 DHCP jail on my test and production systems, copy the files between the two systems and successfully import them.
So either my sickrage jail is not exportable, or there's an issue with 10.3 jails being exported or something else.
Testing continues, but if anyone can help, it would be appreciated.
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,377
Upon final testing, I believe I have isolated this down to a damn bug with any jail with _1 in the jailname.
Can someone else please confirm, I'm about to log a fault for it on the bug tracker. Golly :(

EDIT:
Yep, after a lot of messing around (long story) I've absoloutely confirmed that even a quite complicated jail (my Radarr one) can easily be transferred from one system to another, with some work. The export function works, it just has a legitimate bug.
This bug is very bad, because *I* was the idiot who suggested they start naming the jails and plugins with the _1 and _2 naming convention (we had it in Warden and it was useful for multiple plugins)


https://redmine.ixsystems.com/issues/56211 (Bug logged)
 
Last edited:

gt2416

Patron
Joined
Feb 4, 2018
Messages
262
Ok you're probably right. I just spun up another vm to test and it worked flawlessly, but my jail is called sonarr not sonarr_1
Code:
root@freenas:/mnt # ls
iocage  md_size test
root@freenas:/mnt # iocage import sonarr
Importing dataset: sonarr
Importing dataset: sonarr/root

Imported: sonarr
root@freenas:/mnt # ioacge list
ioacge: Command not found.
root@freenas:/mnt # iocage list
+-----+---------+-------+--------------+--------------+
| JID |  NAME   | STATE |   RELEASE	|	 IP4	  |
+=====+=========+=======+==============+==============+
| 1   | codeiad | up	| 11.1-RELEASE | 192.168.1.38 |
+-----+---------+-------+--------------+--------------+
| -   | sonarr  | down  | 11.1-RELEASE | 192.168.1.30 |
+-----+---------+-------+--------------+--------------+
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,377
Yeah I'm definitely right, they've accepted the bug on the tracker, just need to know if it's iocage core code or FreeNAS - hopefully it's something in FreeNAS which can be fixed rather than all the way up at FreeBSD land.

I'm (generally) pretty darn thorough with my testing :)
 

gt2416

Patron
Joined
Feb 4, 2018
Messages
262
I'm (generally) pretty darn thorough with my testing :)

Good to know !! We need people like you. FreeBSD 11.1 is end of life so 11.2 is an essential upgrade. So good to find these bugs a week before release lol
At least now we know.
Could you link me to the issue tracker please? I am not updating to 11.2 if this isnt fixed, ill wait for 11.2-U1.
I cant have my backups failing, thats insanity.
 
Status
Not open for further replies.
Top