8

I want to calculate the size of btrfs send stream in order to take an appropriate action.

For now, I can get the size with the following code:

exec 5>&1 size=$(btrfs send -v -p $ref_snapshot $src | pv -f 2>&1 > /dev/null | tee >(cat - >&5) ) echo "Calculated size is: $(echo $size | awk '{print $1}')" 

Problem is that this process take too long (32 minutes for 119GiB, for example), so it can't be considered useful.

Is there any way to get the stream size (or a close estimation) in a quicker way?

1
  • You have transparent compression on? You may try the compsize tool. This will return uncompressed and compressed size. If it is faster? Probably yes, but you need to test it. Commented Nov 11, 2024 at 9:20

1 Answer 1

0

The subvolume will give you the metadata which should have the size.

You can check the size of the snapshot directly:

btrfs subvolume show /path/to/snapshots/$src 

You can try to estimate size of the snapshot using du:

size=$(du -sh /path/to/snapshots/$src | awk '{print $1}') echo "Estimated size: $size" 

Not sure if du is faster, or the same, but it's worth a try.

There is a --dry-run option, but I've never used it. Might be worth a look.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.