On 2019/9/5 下午9:06, Anand Jain wrote: > > >> On 5 Sep 2019, at 1:55 AM, Chris Murphy <lists@xxxxxxxxxxxxxxxxx> wrote: >> >> On Wed, Sep 4, 2019 at 12:16 AM Swâmi Petaramesh <swami@xxxxxxxxxxxxxx> 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 ? >> > > Remote replication is a planned feature, when ready, it can be > used with a local target to meet this requisite. In fact, I have submitted patches to implement btrfs-image data dump feature, which can be used here. https://patchwork.kernel.org/project/linux-btrfs/list/?series=141937 Further more, since it's btrfs-image, it can even support cloning a RAID5 fs into single device! But I doubt btrfs-image -r would restore into another profile other the original profile or single device. Thanks, Qu > >> 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. > > Thanks for the report. I just tested the below test case[1], > it does not fail. Any idea? > > [1] > Create and mount a two devices seed fs, and create a sprout. > > umount /btrfs; mkfs.btrfs -fq -dsingle -msingle /dev/sdb /dev/sdc && mount /dev/sdb /btrfs && fillfs /btrfs 100 && umount /btrfs && btrfstune -S1 /dev/sdb && mount /dev/sdb /btrfs && btrfs dev add /dev/sdd /btrfs && umount /btrfs > > Mount the sprout device and delete the seed devices to make > it an independent but identical fs. > > mount /dev/sdd /btrfs && btrfs dev del /dev/sdb /btrfs && btrfs dev del /dev/sdc /btrfs > > Thanks, Anand > > > > >
