Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    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?

  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Seattle, WA, USA
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts