Feature #12928

compression during disk migration

Added by Anonymous about 3 years ago. Updated about 3 years ago.

Status:NewStart date:2016-06-29
Priority:NormalDue date:
Assignee:-% Done:


Target version:-


Could there be any compression of a disk image during
migration. Currently disk are stored sparsely but transferred in full.
So when migrating a large but empty archive disk potentially hours are
spend transferring hundreds of gigabytes of empty space, when the
migration could have been more or less instant.


#1 Updated by Nick Thomas about 3 years ago

When a source flexnbd connects to a destination flexnbd, it cannot make any assumptions about the current state of the destination, and we have no way to query that information within the bounds of the NBD protocol.

This is a real concern - if a migration is restarted, for instance, and a formerly-allocated block is zeroed by the guest, naive sparsity (just skipping the zero blocks) would result in corruption.

Newer revisions of NBD - which we're incompatible with at the moment - have a few possible solutions:

  • Ability for source to query sparsity fro the destination
  • TRIM commands + "trim means zeroes" flag advertised by destination allows source to issue NBD_CMD_TRIM instead of NBD_CMD_WRITE to the destination for zeroed blocks

#2 Updated by Nick Thomas about 3 years ago

Worth noting that transferring these zeroes is the fast part of the migration, although it does have an effect on CPU time total bandwidth required, of course. However, the zeroes (except in the data-loss scenario as described above) are neither read from the source disc, or written to the destination disc.

Also available in: Atom PDF