Skip to content

Clonning to block device should allow partition to be bigger than the archive #15

@Jonathas-Conceicao

Description

@Jonathas-Conceicao

When testing bita for applying changes to a ext4 formatted I've came across the following error:

Error: Size of output device (1430 MiB (1499661312 bytes)) differ from size of archive target file (142 MiB (149934080 bytes))
full command output
root@uh-qemu-x86-64:~# bita clone --seed-output updatehub-image.ext4.bita /dev/vda3
Archive:
  Built with version: 0.7.1
  Archive size: 29 MiB (30866271 bytes)
  Header checksum: 1635e9a121ca79f2cc1fb5e1bf23da9c8a64a5d95e146ba6299c900200d74f0cede30d88f6589abd34d9d07aef580a3d1041b3e722fc3ebc69a12421e03d0511
  Chunking algorithm: RollSum
  Rolling hash window size: 64 bytes
  Chunk minimum size: 16 KiB (16384 bytes)
  Chunk maximum size: 16 MiB (16777216 bytes)
  Chunk average target size: 64 KiB (65536 bytes) (mask: 0b111111111111111)
Source:
  Source checksum: cf895d5a02488c426a6a60dfda220f201a19bc1ba0c7eb4a5c8113319b21e81b2f0bc45923b5d3d21ebc288c03ed134fea5b76a2e42f9c5dc995177bef6e68b0
  Chunks in source: 1463 (unique: 1455)
  Average chunk size: 100 KiB (102909 bytes)
  Source size: 142 MiB (149934080 bytes)

Cloning archive updatehub-image.ext4.bita to /dev/vda3...
Error: Size of output device (1430 MiB (1499661312 bytes)) differ from size of archive target file (142 MiB (149934080 bytes))

Which was caused by the following piece of code:

bita/src/clone_cmd.rs

Lines 136 to 145 in e6d3a9e

if output.is_block_dev() {
let size = output.size().await?;
if size != archive.total_source_size() {
return Err(anyhow!(
"Size of output device ({}) differ from size of archive target file ({})",
size_to_str(size),
size_to_str(archive.total_source_size())
));
}
}

I believe that error should only be raised in case that the partition is smaller than the archive. A bigger partition should not be an issue.

Commenting out that block of the code in order to test the clone as a hole did work for applying the desired changes, but indexing the partition took more time than I would expect. I think the hole output device is being processed in order to perform the clone. If that's the case, wouldn't it be possible (for cases such as this) to index only the chunks up to the archive total source size?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions