­I've got a drive with data, and 3 snapshots of that data. I've transferred all 
the snapshots to another drive using btrfs send and receive. The send drive has 
3.62 GB of data, the receive drive has 4.99 GB of data. It seems like the 
snapshots don't share data between them that was unchanged.

How can I transfer the snapshots in such a way that the snapshots only occupy 
the difference between the snapshots?

The data on the original drive is organized like this:
/mnt/send/storage/ <= here's all the data
/mnt/send/storage_snapshots/ <= here are the 3 snapshots

The data on the receiving drive is organized like this:
/mnt/rec/storage/ <= this folder is empty
/mnt/rec/storage_snapshots/ <= here are the 3 snapshots
/mnt/rec/btrfs_receive/ <= here are the 3 files generated by btrfs send 

How can I transfer the snapshots in such a way that /mnt/rec/storage/ holds the 
latest version of the data, just like on the original drive?

In detail:
# mkfs.btrfs -L SEND /dev/sda3
# mount /dev/sda3 /mnt/send/ -o,compress,noatime
# mkfs.btrfs /dev/sdd2 -L DATA
# mount /dev/sdd2 ./mnt/rec/ -o,compress,noatime
# btrfs subvolume create /mnt/rec/btrfs_receive/
Create subvolume '/mnt/rec/btrfs_receive'
# btrfs subvolume create /mnt/rec/storage_snapshots

# btrfs subvolume create /mnt/send/storage
# btrfs subvolume create /mnt/send/storage_snapshots
# cd /mnt/send/storage
# /home/cedric/mkfiles_and_md5.sh <<generates/ change data on the send drive >>
# btrfs subvolume snapshot -r /mnt/send/storage 
/mnt/send/storage_snapshots/storage-$(date +%Y_%m_%d-%H%m)
Create a readonly snapshot of '/mnt/send/storage' in 
'/mnt/send/storage_snapshots/storage-2021_01_09-1301'
# /home/cedric/mkfiles_and_md5.sh <<generates/ change data on the send drive >>
btrfs subvolume snapshot -r /mnt/send/storage 
/mnt/send/storage_snapshots/storage-$(date +%Y_%m_%d-%H%m%S)
Create a readonly snapshot of '/mnt/send/storage' in 
'/mnt/send/storage_snapshots/storage-2021_01_09-130120'
# /home/cedric/mkfiles_and_md5.sh <<generates/ change data on the send drive >>
# btrfs subvolume snapshot -r /mnt/send/storage 
/mnt/send/storage_snapshots/storage-$(date +%Y_%m_%d-%H%m%S)
Create a readonly snapshot of '/mnt/send/storage' in 
'/mnt/send/storage_snapshots/storage-2021_01_09-130146'

# btrfs send /mnt/send/storage_snapshots/storage-2021_01_09-1301 -f 
/mnt/rec/btrfs_receive/storage-2021_01_09-1301.btrfssend
At subvol /mnt/send/storage_snapshots/storage-2021_01_09-1301
[root@bcache-test rec]# btrfs send -p 
/mnt/send/storage_snapshots/storage-2021_01_09-1301 
/mnt/send/storage_snapshots/storage-2021_01_09-130120 -f 
/mnt/rec/btrfs_receive/storage-2021_01_09-130120.btrfssend
At subvol /mnt/send/storage_snapshots/storage-2021_01_09-130120
[root@bcache-test rec]# btrfs send -p 
/mnt/send/storage_snapshots/storage-2021_01_09-130120 
/mnt/send/storage_snapshots/storage-2021_01_09-130146 -f 
/mnt/rec/btrfs_receive/storage-2021_01_09-130146.btrfssend
At subvol /mnt/send/storage_snapshots/storage-2021_01_09-130146

# btrfs receive -f /mnt/rec/btrfs_receive/storage-2021_01_09-1301.btrfssend  
/mnt/rec/storage_snapshots
At subvol storage-2021_01_09-1301
# btrfs receive -f /mnt/rec/btrfs_receive/storage-2021_01_09-130120.btrfssend  
/mnt/rec/storage_snapshots
At snapshot storage-2021_01_09-130120
# btrfs receive -f /mnt/rec/btrfs_receive/storage-2021_01_09-130146.btrfssend 
/mnt/rec/storage_snapshots
At snapshot storage-2021_01_09-130146

# rm /mnt/rec/btrfs_receive/storage-2021_01_09-1301*
# btrfs filesystem show
Label: 'SEND'  uuid: 61b7e45f-62a7-4b04-bc0c-ba1304548b02
        Total devices 1 FS bytes used 3.62GiB
        devid    1 size 5.00GiB used 4.52GiB path /dev/sda3

Label: 'DATA'  uuid: 95e85fa4-217c-429a-be55-833bb63e2c71
        Total devices 1 FS bytes used 4.99GiB
        devid    1 size 931.01GiB used 10.02GiB path /dev/sdd2


---

Take your mailboxes with you. Free, fast and secure Mail &amp; Cloud: 
https://www.eclipso.eu - Time to change!


Reply via email to