Results 1 to 2 of 2
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, ...
- 09-26-2011 #1Just Joined!
- Join Date
- Sep 2011
- Posts
- 6
How does partimage distinguish between free vs. empty blocks?
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?
- 09-27-2011 #2
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.DISTRO=Arch
Registered Linux User #388732


Reply With Quote