atconsultancy logo
cowloop logo
atcomputing logo




spacerFAQ Logo



The following commands can be used to interact with the cowloop driver. Note that the distribution package contains extensive manual pages for each of these.

  • Command cowdev
    The command cowdev can be used to activate a new cowdevice by offering a read-only file and a corresponding cowfile. This command can also be used to deactivate a cowdevice again and to list the active cowdevices.

          cowdev -l
          cowdev -a rdofile cowfile [cowdevice]
          cowdev -d cowdevice

    -l List cowdevices.
    Use the flag "-l" to generate a list with the cowdevices that are currently in use. For every cowdevice the assigned read-only file and cowfile is shown.
    -a Activate cowdevice.
    Use the flag "-a" to activate a new cowdevice, assigning the specified read-only file and corresponding cowfile.
    Optionally a specific cowdevice (/dev/cow/...) can be requested. When this device is already in use, the activation will fail. When no specific cowdevice is requested, the cowloop driver searches for the first free cowdevice.
    When the activation succeeds, the command cowdev returns the name of the activated cowdevice.
    -d Deactivate cowdevice.
    Use the flag "-d" to deactivate a cowdevice. This might fail when the cowdevice is still in use (e.g. the cowdevice is still mounted).


          # cowdev -a /dev/sda2 /tmp/myfs1.cow
          # cowdev -l
          cowdevice    read-only file   copy-on-write file              
          /dev/cow/5   /dev/sda2        /tmp/myfs1.cow                  
          # mount /dev/cow/5 /mnt/myfs
          # ......
          # umount /dev/cow/5
          # cowdev -d /dev/cow/5

  • Command cowsync
    The cowloop driver maintains an up-to-date copy of the header and bitmap in memory. When a cowdevice is deactivated (or when the driver is unloaded), these in-memory copies are flushed to the cowfile. As long as the cowdevice is active, the cowfile is in an inconsistent state (state 'dirty').
    The command cowsync can be used to request the cowloop driver to flush the in-memory header and bitmap for all active cowfiles. After that the cowfiles are temporarily consistent again (state 'clean') until the driver modifies the in-memory header or bitmap again.

    SYNOPSIS:      cowsync


The following commands can be used to manipulate cowfiles (no need for the cowloop driver):

  • Command cowlist
    The command cowlist can be used to show the information from the header of a cowfile.

    SYNOPSIS:      cowlist cowfile


          $ cowlist /tmp/myfs1.cow
          Info about cowfile /tmp/myfs1.cow:
               state cowfile:     clean
              header-version:         1
                 data offset:     36864
                     mapunit:      1024
               bitmap-blocks:        32 (of 1024 bytes)
            cowblocks in use:       762 (of 1024 bytes)
                size rdofile:    256000 (of 1024 bytes)

  • Command cowrepair
    When a cowdevice has not been properly deactivated (e.g. due to a system crash), the cowfile is in an inconsistent state (state 'dirty'). The cowloop driver refuses to activate such cowfile again, unless the inconsistencies are repaired. When the first cowdevice is already activated during loading of the cowloop driver (via parameters "rdofile=" and "cowfile=") the additional parameter "option=r" can be used. In that case the cowloop driver implicitly repairs the cowfile in kernel mode which is not preferable though in some cases inevitable.

    Preferably a cowfile should be repaired using the command cowrepair before it is offered to be activated for a new cowdevice.

    SYNOPSIS:      cowrepair [-fnv] cowfile

    -f Forced repair.
    The command cowrepair only repairs a cowfile which has the state 'dirty'. With the flag "-f" the cowfile will be made consistent even if the state is 'clean'.
    -n No modifications (fake mode).
    With the flag "-n" the consistency of the cowfile is verified and messages are shown about the state. However no corrections are issued.
    -v Verbose.
    With the flag "-v" additional messages are shown about the inconsistencies in the cowfile.


          $ cowrepair /tmp/myfs1.cow
          cowfile /tmp/myfs1.cow is not dirty
          $ cowrepair -f /tmp/myfs1.cow
          number of corrections in bitmap: 0

  • Command cowmerge
    The command cowmerge writes all modifications stored in the specified cowfile into the specified read-only file (that is used in a read-write fashion now).
    Beware that you lose the original contents of the read-only file which makes other cowfiles related to this read-only file useless!
    After the merge, the updated read-only file can be used in combination with new cowfiles to store modifications made from now on.

    SYNOPSIS:      cowmerge rdofile cowfile


          # cowdev -a /dev/sda2 /tmp/myfs.cow
          # mount /dev/cow/0 /mnt/myfs
          # ......                                 (work for a while...)
          # umount /dev/cow/0
          # cowdev -d /dev/cow/0
          # cowmerge /dev/sda2 /tmp/myfs.cow 
          # rm /tmp/myfs.cow                       (cowfile is useless now)
          # cowdev -a /dev/sda2 /tmp/myfs.cow      (new cowfile)




spacerLoad & unload


small @ logoCommands

spacerStatus info

spacerExample 1

spacerExample 2

spacerExample 3

spacerCowloop vs.
   device mapper

spacerView as single page

© AT Consultancy bv, Nijmegen, The Netherlands  -
© AT Computing bv, Nijmegen, The Netherlands  - -