Restoring and snapshots

David Christensen dpchrist at
Sun Apr 12 21:09:55 UTC 2020

On 2020-04-10 02:30, Andrea Venturoli wrote:
> When I'm doing backups/dumps of ZFS filesystems (with whatever tool),
> I use snapshots. So, suppose I have the following datasets: /etc /usr
> /usr/local /var
> I'll snapshot them and back up /etc/.zfs/snapshot/snapname/ 
> /usr/.zfs/snapshot/snapname/ /usr/local/.zfs/snapshot/snapname/ 
> /var/.zfs/snapshot/snapname/
> Then I'll get the same directory structure when restoring. Any idea 
> how to easily remove the .zfs/snap and go back to the original tree?
> I tried writing a few lines of script, but I found out that's not so 
> easy (due to directories which must overlap, spaces in file names, 
> etc...).
> Any hint?

On 2020-04-11 01:31, Andrea Venturoli wrote:
> I'm wondering if I should abandon sh and use something else
> (Python?).

On 2020-04-12 01:50, Andrea Venturoli wrote:
> On 2020-04-12 10:23, David Christensen wrote:
>> It sounds like you are using file- and directory-level backup tools
>> for ZFS filesystems (?).
> Exactly. As I said, however, I'm having the same problem with UFS... 
> You are focusing on ZFS, but this was not the point of the original 
> post; it was just an example.

>> If you are using file- and directory-level backup tools to back up
>>  ZFS snapshots, that definitely sounds like you are barking up the
>>  wrong tree.
> Sometimes you have complex system, with several machines (some with 
> ZFS, some with UFS, some with a mix and some not even BSD) and you 
> need an integrated solution. Handling ZFS filesystem differently from
> the others would be a pain. Besides, restoring a whole filesystem if
> you just need a couple of files would be very inefficient.

I do not use Bacula and have only a basic understanding of it.

Beware that "integrated solution" can mean "all your eggs in one basket".

That said, two ideas come to mind:

1.  It appears Bacula provides a plug-in API.  So, write a plug-in for 
Bacula that knows how to convert Bacula backup saved paths to client 
filesystem live paths (and vice-versa?) when the former are ZFS snapshots.

2.  Have Bacula restore a set of related ZFS snapshots into a temporary 
directory and then write a script that reassembles everything.

A key parameter in any case will be the ZFS 'mountpoint' property for 
the ZFS snapshots in question.  I don't know if Bacula preserves ZFS 
properties on backup or restore.  If not, this information must come 
from somewhere else.


More information about the freebsd-questions mailing list