Caveats backing up pool to USB? Does it confuse any processes on my server?

Status
Not open for further replies.

Dwarf Cavendish

Contributor
Joined
Dec 19, 2017
Messages
121
Recently I tried making a back-up of my entire pool to an USB hard drive. What I used as a source of reference: this and this. I configured a weekly periodic snapshot that I want to use for incremental backups. These are recursive snapshots of my entire pool. The command that I ended up using for the initial backup:

zfs send -R mypool@snapshot1 | zfs recv -F usbpool

And for subsequent incremental backups:

zfs send -R -i snapshot1 mypool@snapshot2 | zfs recv usbpool

It all seemed pretty straight forward. However, when I attempted to do the first incremental backup I was surprised to get a message that my usbpool had changed since the last snapshot and hence the incremental backup could not be executed.

There is one thing that I remember doing that might be responsible for this: I have a cron job for executing cloud backups from an iocage jail. When that cron job triggered iocage told me that it had multiple active pools and didn't know what to do. In response to that I set my actual pool as active in iocage.

Now I want to try this all again from the start and avoid doing anything with iocage until the transfer has been completed. However, I am concerned that there may be other processes on my server that get confused by the presence of two identical pools. I can for example imagine that having two .system datasets during the time that the drive is plugged in is not exactly a great idea.

So basically my question is: is this a viable approach that I just messed up by setting the active pool for iocage or should I expect other things to get hairy when I attempt to do this again?
 

Dwarf Cavendish

Contributor
Joined
Dec 19, 2017
Messages
121
I did another attempt, without any jails running. It failed. I think that I'll be better off backing up separate datasets instead. Too bad that they do not have a common parent dataset. Ah well...
 

Dwarf Cavendish

Contributor
Joined
Dec 19, 2017
Messages
121
I just tried doing an incremental backup to my usb drive, this time with only a couple of datasets rather than my entire pool. I got the same error again. When I added the -vF flags to the zfs recv command it worked though, and I got a message about several snapshots being destroyed.

I suppose this makes sense. I have a couple of periodic snapshot tasks that also destroy older snapshots again, but of course this is only done to my actual pool and not to the detached USB drive pool. So I can see where a message that the USB drive pool has "changed" comes from, although it is not exactly intuitive.

Edit: I tried diffing the supposedly now identical directories in both pools: they weren't. In one case, even all directories were missing. *sigh*
 
Last edited:

Binary Buddha

Contributor
Joined
Mar 6, 2016
Messages
126
Depending on what you mean by "USB Drive". If you mean like a thumbdrive I would say don't do it. Thumbdrives were not exactly designed of a ton of writes. I use a thumbdrive to boot off of but the "System dataset" I set on another zpool using regular drives. If it's like regular SSDs, hybrid, or spin disks that use USB then it should be fine. Except that you'll bottle neck at the speeds of USB 2 controller speeds; not the per USB port speed, since FreeBSD doesn't have stable USB 3 yet.

Why I say this? Before I discover FreeNAS I used to use Linux LVM2 with a crap ton of USB hubs and external drives. Then I discovered ZFS and moved it over to FreeBSD; since ZFS in Linux isn't stable yet. Then I discovered FreeNAS which is pretty much an easier way to do what I what I was doing with it.

Also, I'm assuming you created a separate "parent" zpool for IOcage. If you didn't then it'll have some confusion since for some odd reason it's not recognizing child zpools for jails. I'd do some trickery and create datasets in the zpool to match the directory paths and then do snapshots of the datasets instead of the entire zpool. In 9.10 I used to be able to assign the Jails to use a Dataset instead of a zpool. In that dataset I'd have a dataset for each jail. Granted, I did it to assign quotas per jail not to do snapshot backups.
 
Status
Not open for further replies.
Top