Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Sep 2011
How does partimage distinguish between free vs. empty blocks?
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?
So the difference between partimage and dd is that partimage understands filesystems.
When you have dd copy a partition, it just reads everything and writes it. It doesn't care what content, if any, there is.
partimage, however, asks the filesystem for what blocks have files on them. It then only copies those blocks.
How exactly this works is beyond the scope of this forum (you can read about how filesystems if you want), but I can give you some simple examples:
The "FAT" of FAT32 stands for "File Allocation Table". This essentially uses a bitmap of blocks, with a 1 indicating that the block is used, and a 0 indicating unused. So it's easy to tell if a given block is in use.
ext2 does something somewhat similar, and each "block group" contains a block bitmap for that group.
Using these maps, a tool that understands the filesystem can ask the status of each block.