Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

Question

How does partimage distinguish between free vs. empty blocks

Sep 25, 2011 12:07PM PDT

I'm trying to figure out exactly how partimage distinguishes
between a free block (containing old/garbage data) and an empty (zero)
block when it comes to disk imaging.

In other words, since "dd" copies all the blocks, what technique does
partimage use that enables it to only clone the used blocks?
Everywhere I've looked online says partimage has this ability, but HOW does it do it?

Any ideas?

Discussion is locked

- Collapse -
Answer
"Read the source Luke"
Sep 25, 2011 12:15PM PDT
- Collapse -
Sorta Found Something
Sep 25, 2011 3:43PM PDT

I already did, but it's not exactly easy to decipher what it's doing.

Anyway, after some research on the source code I have a slight clue as to how it's doing this.

Partimage basically looks for the bits that are set ("1") and treats those as used bits. Everything else is treated as unused/"0"/empty. Look for "isBitSet" function in the source code.

I think that's how it works...still need more research to figure it out exactly. Anyway, hoped this helped some people.

- Collapse -
So far that's how most tests for "empty" work.
Sep 26, 2011 6:14AM PDT

And it's a good reason to go to the trouble of ZERO FILLING A DRIVE if you have the time when starting fresh.
Bob