Cloop

From Wikipedia, the free encyclopedia

The compressed loopback device or cloop is a module for the Linux kernel. It adds support for transparently decompressed, read-only block devices. It is not a compressed file system in itself.

It was originally written for the Linuxcare Bootable Business Card by Rusty Russell, but is now maintained by Klaus Knopper, the author of Knoppix. cloop is mostly used as a convenient way to compress conventional file systems onto LiveCDs.

A compression ratio of about 2.5:1 is common for software. The Knoppix cloop image, for example, is 700MB compressed and around 1.8GB uncompressed.

Contents

[edit] Design

cloop images contain:

  • A shell script (with mount commands for the image)
  • A header with the number of blocks and the uncompressed block size
  • A seek index with compressed and uncompressed block sizes in pairs
  • zlib-compressed data blocks, packed end-to-end

The data blocks are compressed separately; this makes it possible to seek to individual blocks without having to decompress the entire image from the start, but at the cost of slightly reducing the compression ratio. LiveCD images typically use a block size of 256k as a compromise between decompression speed and space-efficiency.

Apple uses a similar file format in the compressed variant of its DMG disk images.

[edit] Limitations

  • create_compressed_fs, the utility which creates cloop images, requires that the entire compressed image must fit in memory.
  • The design of the cloop driver requires that compressed blocks be read whole from disk. This makes cloop access very slow when there are many small scattered reads, which can happen if the system is low on memory or when a large program with many shared libraries is starting up.

[edit] See also

[edit] External links

In other languages