On Wed, Sep 4, 2019 at 12:16 AM Swâmi Petaramesh <sw...@petaramesh.org> wrote:
>
> Hi list,
>
> Is there an advised way to completely “clone” a complete BTRFS
> filesystem, I mean to get an exact copy of a BTRFS filesystem including
> subvolumes (even readonly snapshots) and complete file attributes
> including extended attributes, ACLs and so, to another storage pool,
> possibly defined with a different RAID geometry or compression ?

The bottom line answer is no. There are only compromises.

Btrfs seed sprout will do what you want, except you can't change
geometry or compression. Last time I tested multiple devices as either
a source or destination, I ran into problems - but it's possible some
of this has been fixed, which is a question for Anand Jain.

Btrfs send receive can use a destination with different geometry,
compression, and multiple devices - but it doesn't handle relinks /
shared extents between otherwise unrelated subvolumes, although I
think that's what the -c flag is used for. I've never used it. There
also isn't a built-in way to recursively and intelligently send all
subvolumes, taking advantage of incremental send.

But in both cases, all file metadata is preserved. It's not really an
exact copy. The extent layout will be different, the subvolume UUIDs
will change in the 2nd case, and the volume UUID will change in both
cases. Etc. So not exact. But in terms of user visible aspects, yes it
would be exact with either method.

>
> The question boils down to getting an exact backup replica of a given
> BTRFS filesystem that could be restored to something logically
> absolutely identical.

Using words like "exact" and "absolutely identical" you've reduced it
down to a block copy. Only a sector copy does that. So I think you
need a better term that qualifies what you want or what your use case
really is. And also, changing compression, number of devices and
profiles, that's not exact either, and it definitely does not qualify
as identical let alone absolutely identical.


> The usual backup tools have no clue about share extents, snapshots and
> the like, and using btrfs send/receive for individual subvols is a real
> pain in a BTRFS filesystem that may contain hundreds of snapshots of
> different BTRFS subvols plus deduplication etc.

If you only ever deduplicate within a subvolume, and you aren't
deduplicating between subvolumes, then send/receive will do what you
want. Otherwise I think it's clone option. Maybe.

> So on a practical standpoint, how can one backup and restore a full
> BTRFS structure ?

Seed sprout comes the closest. But Btrfs does allow the user too
create a volume that will exceed the present feature set of seed
sprout. Therefore it's possible to create a Btrfs volume that cannot
really be replicated other than a block copy, if your goal is
exactness.


-- 
Chris Murphy

Reply via email to