mwilck / btrfs-clone

A tool for copying a btrfs file system with all its subvolumes to another btrfs file system
GNU General Public License v2.0
116 stars 17 forks source link

--toplevel not working as expected #24

Open dkebler opened 8 months ago

dkebler commented 8 months ago

I have mounted a subvolume @snapshots that is within a partition of a sd card at /tmp/source

drwx------  1 david david  56 Mar  2 14:58  ./
drwxr-x---+ 3 root  root   60 Mar  2 15:03  ../
drwxr-xr-x  1 david david   0 Mar  2 11:05 '@data'/
drwx--x---  1 root  root  148 Feb 27 13:24 '@docker'/
drwxr-xr-x  1 david david  20 Mar  2 07:38  manrpi/
drwxr-xr-x  1 david david  26 Mar  2 10:53 '@snapshots'/

then pass that mountpoint to btrfs-clone

sudo btrfs-clone --toplevel --dry-run -v /tmp/source /tmp/dest

but btrfs-clone is picking up all the subvolumes on that partition and not starting with @snapshot and below

for example @docker is another subvolume on that same partition.

I thought this is what --toplevel was supposed to stop. https://github.com/mwilck/btrfs-clone?tab=readme-ov-file#the---toplevel-option

btrfs property set -ts /tmp/tmpv8m_otsm/@docker/btrfs/subvolumes/65f2ee55a4b823a64c7b0dbef2c0de8e6aa50ffb036dad80a991564956af69b9 ro true
btrfs property set -ts /tmp/tmpv8m_otsm/@docker/btrfs/subvolumes/06232672f2c69a8ef48c66292aa9280abbf78cfa05423325809650171d8f6ee3 ro true
btrfs property set -ts /tmp/tmpv8m_otsm/@docker/btrfs/subvolumes/67e7ff4d1d2c492c9e89d01beca97a554ddcad0f987ae5b4b5f00ba7ae40049e ro true
btrfs property set -ts /tmp/tmpv8m_otsm/@docker/btrfs/subvolumes/b26b4c7a7b0a2cccc7532d9eaf971df84ad1c7538a6f86092b584570f46a40ff ro true
btrfs property set -ts /tmp/tmpv8m_otsm/@docker/btrfs/subvolumes/33d1add0ac153f992bbb6523689054fd2e8073ed89d9eed4f3a4de543b47d841 ro true
btrfs property set -ts /tmp/tmpv8m_otsm/@docker/btrfs/subvolumes/9a129bfe4652a208c091f68a3a39b4c5e43d2cd2e28f4b4bed69156e6805645f ro true
btrfs property set -ts /tmp/tmpv8m_otsm/@docker/btrfs/subvolumes/464e72456633bb7d57bf7eec395ce1e80e4cd25af29f1efca430a85813915abe ro true
btrfs property set -ts /tmp/tmpv8m_otsm/@docker/btrfs/subvolumes/5cc733105a7977d1be3911e17500dbcfd06cad66fe950c54c16e3f2fe4e49a3b ro true
btrfs property set -ts /tmp/tmpv8m_otsm/@docker/btrfs/subvolumes/3363b005cb4c0f361a39832d531201c694797ecdbcf28195068a5a7ce1284258 ro true
btrfs property set -ts /tmp/tmpv8m_otsm/@docker/btrfs/subvolumes/aa0675f35d700a46c58bf029c4ae910f05089cd7ce384fa31625a2893d7d80a4 ro true
btrfs property set -ts /tmp/tmpv8m_otsm/@docker/btrfs/subvolumes/b79031e564422e8dad151506b99c9d1e1989e27891e2f9eb97fa4e3ff451dc21 ro true
btrfs property set -ts /tmp/tmpv8m_otsm/@docker/btrfs/subvolumes/0783b38e85bd4f0b813563ea0df56df45aebaa171b1f38083b3bfb0f6493032e-init ro true
btrfs property set -ts /tmp/tmpv8m_otsm/@docker/btrfs/subvolumes/0783b38e85bd4f0b813563ea0df56df45aebaa171b1f38083b3bfb0f6493032e ro true
btrfs property set -ts /tmp/tmpv8m_otsm/@docker ro true
btrfs property set -ts /tmp/tmpv8m_otsm/@snapshots/manrpi/enabled-backup/@boot ro true
btrfs property set -ts /tmp/tmpv8m_otsm/@snapshots/manrpi/enabled-backup/@root ro true
btrfs property set -ts /tmp/tmpv8m_otsm/manrpi/@boot ro true
btrfs property set -ts /tmp/tmpv8m_otsm/@snapshots/manrpi/added-data/@boot ro true
btrfs property set -ts /tmp/tmpv8m_otsm/@snapshots/manrpi/added-data/@root ro true
btrfs property set -ts /tmp/tmpv8m_otsm/@data ro true
btrfs property set -ts /tmp/tmpv8m_otsm/manrpi/@root ro true
btrfs property set -ts /tmp/tmpv8m_otsm/@snapshots ro true
dkebler commented 8 months ago
sudo btrfs-clone --toplevel -v /tmp/source /tmp/dest
unsharing mount namespace
fileystem /tmp/dest is not empty

yea, I don't think btrfs-clone supports what I am trying to do which is clone a subvolume (and its subvolumes/snapshots) from one device/parition to a subvolume on another device/partition. Looks like this only supports full partition to partition clone.

mwilck commented 8 months ago

Yes, that's what it's made for.

mwilck commented 8 months ago

Note that for just cloning a single subvolume, simple btrfs send | btrfs receive works quite well.