atconsultancy logo
cowloop logo
atcomputing logo

spacerHome

spacerNews

spacerDownload

spacerFAQ

 

SourceForge.net Logo

Tux

Cowfile structure

A cowfile is used by the cowloop driver to store the modified blocks that are written to a cowdevice. Apart from these modified blocks, a copy-on-write file contains some additional administration:

cowloop logo

  • header
    A block of 1 Kbytes containing information like the magic number (a special bit-pattern), the flag indicating if the cowfile has been properly closed, the size of the corresponding read-only file and a checksum of the first blocks from the read-only file. Using the information in the header, the cowloop driver can roughly check whether an existing cowloop file is
    • consistent (closed properly),
    • used with the same read-only file as before, and
    • used with a read-only file that has not been modified since the cowdevice has been previously deactivated.
  • bitmap
    The bitmap contains one bit per 1 Kbytes block in the read-only file. This bit indicates if the corresponding block has been modified (i.e. the block should be retrieved from the cowfile) or not (i.e. the block should be retrieved from the read-only file).
    The bitmap itself also consists of a number of 1 Kbytes blocks. The size of the bitmap obviously depends on the size of the read-only file.
  • modified blocks
    Area containing the modified blocks.
    A modified block is written in this area at the same offset as the corresponding block in the read-only file. Therefore the cowfile contains many "holes" of unwritten space (it is a so-called sparse file). Only the written blocks really consume disk-space.

The maximum size of the cowfile is evident from the figure above: the size of the orginal file + the sizes of the header and the bitmap. The command "ls -l cowfile" shows the logical size of the file. In most cases the cowfile will be sparse, i.e. contain holes. The actual amount of diskspace consumed is given in kilobytes by "du -k cowfile".

Be careful when making copies of cowfiles. Not all programs are aware of sparse files. Commands like cpio and tar in particular store cowfiles using their maximum size.

spacerIntroduction

spacerOverview

spacerInstall

spacerLoad & unload

small @ logoCowfiles

spacerCommands

spacerStatus info

spacerExample 1

spacerExample 2

spacerExample 3

spacerCowloop vs.
   device mapper

spacerView as single page


© AT Consultancy bv, Nijmegen, The Netherlands  -  www.ATConsultancy.nl
© AT Computing bv, Nijmegen, The Netherlands  -  www.ATComputing.nl - www.ATComputing.net