Cloop
Encyclopedia
The compressed loopback device or cloop is a module
Loadable Kernel Module
In computing, a loadable kernel module is an object file that contains code to extend the running kernel, or so-called base kernel, of an operating system...

 for the Linux kernel
Linux kernel
The Linux kernel is an operating system kernel used by the Linux family of Unix-like operating systems. It is one of the most prominent examples of free and open source software....

. It adds support for transparently decompressed, read-only block devices. It is not a compressed file system
File system
A file system is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data, as well as manage the available space on the device which contain it. A file system organizes data in an efficient manner and is tuned to the...

 in itself.

It was originally written for the Levanta
Levanta
Levanta was a company based in San Mateo, California, United States, that created products for Linux management and data virtualization.-Company history:...

 Bootable Business Card by Rusty Russell
Rusty Russell
Paul "Rusty" Russell is an Australian free software programmer and advocate.- Software development :Russell wrote the packet filtering systems ipchains and netfilter/iptables in the Linux operating system kernel...

, but is now maintained by Klaus Knopper
Klaus Knopper
Klaus Knopper is a German electrical engineer and free software developer. "My nationality from my passport is austrian, not german, though I will absolutely not complain about being listed as "german engineer", because I was born and have lived in Germany all of my life", - says Klaus...

, the author of Knoppix
Knoppix
Knoppix, or KNOPPIX , is an operating system based on Debian designed to be run directly from a CD / DVD or a USB key , one of the first of its kind for any operating system. Knoppix was developed by Linux consultant Klaus Knopper. When starting a program, it is loaded from the removable medium...

. cloop is mostly used as a convenient way to compress conventional file systems onto Live CD
Live CD
A live CD, live DVD, or live disc is a CD or DVD containing a bootable computer operating system. Live CDs are unique in that they have the ability to run a complete, modern operating system on a computer lacking mutable secondary storage, such as a hard disk drive...

s.

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.

Design

cloop images contain:
  • A shell script
    Shell script
    A shell script is a script written for the shell, or command line interpreter, of an operating system. It is often considered a simple domain-specific programming language...

     (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
    Zlib
    zlib is a software library used for data compression. zlib was written by Jean-Loup Gailly and Mark Adler and is an abstraction of the DEFLATE compression algorithm used in their gzip file compression program. Zlib is also a crucial component of many software platforms including Linux, Mac OS X,...

    -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. Live CD 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.

Limitations

The design of the cloop driver requires that compressed blocks be read whole from disk. This naturally makes cloop access slower when there are many scattered reads, which can happen if the system is low on memory or when a large program with many shared libraries is starting up. A big issue is of course the seek time for CD-ROM drives (~80 ms), which exceeds that of hard disks (~10 ms) by a large factor. On the other hand, because files are packed together, reading a compressed block may thus bring in more than one file into the cache. The effects of tail packing are known to improve seek times (cf. reiserfs
ReiserFS
ReiserFS is a general-purpose, journaled computer file system designed and implemented by a team at Namesys led by Hans Reiser. ReiserFS is currently supported on Linux . Introduced in version 2.4.1 of the Linux kernel, it was the first journaling file system to be included in the standard kernel...

, btrfs
Btrfs
Btrfs is a GPL-licensed copy-on-write file system for Linux.Development began at Oracle Corporation in 2007....

), especially for small files. Some performance tests related to cloop have been conducted.

External links

  • cloop sources against the mainline Linux kernels. Note: versions 0.xx are for kernel 2.2; 1.xx are for kernel 2.4; 2.xx are for kernel 2.4 and 2.6.
  • cloop at Knoppix Linux Wiki (installation instructions are here)
  • Slides from a LinuxTag presentation by Klaus Knopper on the implementation of cloop (in German).
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK