systemd / casync

Content-Addressable Data Synchronization Tool
1.49k stars 117 forks source link

Chunck are downloaded even if files are present in the seed #265

Open agambier opened 1 year ago

agambier commented 1 year ago

On an embedded system. Two partitions are dedicated for the rootfs. Partition A and B.

When the system is running on partition A I use casync to update the partition B with the latest firmware and reboot on partition B. The partition used for the running system is mounted in read-only mode.

To limit the downloaded data I use the current partition / as a seed.

casync extract --seed=/ --store=http://10.0.10.151:8080/rootfs.castr http://10.0.10.151:8080/rootfs.caidx /var/tmp/rootfs-b

While performing some tests I noticed that if I remove one file on the partition B, a file which is still in partition A, then 2 chunks are always downloaded. I thought the file would be copied from the partition A.

10.0.10.184 - - [07/Sep/2022 11:28:09] "GET /rootfs.caidx HTTP/1.1" 200 -
10.0.10.184 - - [07/Sep/2022 11:28:27] "GET /rootfs.castr/c55c/c55cc849439e9bf981b66a5947048e0c1b0bb8535ca610621d4b202039ef1273.cacnk HTTP/1.1" 200 -
10.0.10.184 - - [07/Sep/2022 11:28:27] "GET /rootfs.castr/37c6/37c6fe08e661a6df78fbffef9a74f5619ad23cbc050aabc890c14c65d1271451.cacnk HTTP/1.1" 200 -

If I try the same but the system is running from an sdcard so I can mount and use the partition A as a seed, using the command:

casync extract --seed=/var/tmp/rootfs-a --store=http://10.0.10.151:8080/rootfs.castr http://10.0.10.151:8080/rootfs.caidx /var/tmp/rootfs-b

then no chunk is downloaded.

The store has been created with the command run in a fakeroot environment so the UIG:GID have been changed to 0.

casync make --store=rootfs.castr rootfs.caidx ./rootfs_target --with=unix --without=sec-time --without=usec-time --without=nsec-time --without=2sec-time

The options --verbose and --level debug are not helpful is this case. Is there a way to know what files are stored in the downloaded chuncks ?