Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Apr 2020 14:09:51 -0700
From:      David Christensen <dpchrist@holgerdanske.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Restoring and snapshots
Message-ID:  <d8a44050-d190-fec8-6a7c-58af7aced8e1@holgerdanske.com>
In-Reply-To: <e3ffd38c-847a-4ca8-316b-6bc78015f82b@netfence.it>
References:  <56b4e678-0e66-e65b-b9d2-a2e79a5b7b6f@netfence.it> <e8fb0530-917a-f259-9238-5306e63b89df@holgerdanske.com> <dbe79517-3d72-3af9-48df-129c7ec89bf7@netfence.it> <b80878d8-4a37-7f79-e94f-d3c44cb036bc@holgerdanske.com> <2a0ee11a-eb32-7ae2-256f-ad1b00d1e49d@netfence.it> <a3a8403b-f5ef-fbac-372e-2a807371cf8b@holgerdanske.com> <e3ffd38c-847a-4ca8-316b-6bc78015f82b@netfence.it>

next in thread | previous in thread | raw e-mail | index | archive | help
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.


David



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d8a44050-d190-fec8-6a7c-58af7aced8e1>