3.1.3

Amanda::Holding


NAME

Amanda::Holding -- interface to the holding disks


SYNOPSIS

    use Amanda::Holding;

Get some statistics:

    my %size_per_host;
    for my $hfile (Amanda::Holding::files()) {
        my $hdr = Amanda::Holding::get_header($hfile);
        next unless $hdr;
        $size_per_host{$hdr->{'name'}} += Amanda::Holding::file_size($hfile);
    }

Schematic for something like amflush:

    for my $ts (sort Amanda::Holding::get_all_timestamps()) {
        print $ts, "\n";
    }
    my @to_dump = <>;
    for my $hfile (Amanda::Holding::get_files_for_flush(@to_dump)) {
        # flush $hfile
    }


DESCRIPTION

TERMINOLOGY

Holding disk

A holding disk is a directory given in a holdingdisk definition in amanda.conf.

Holding directory

A holding directory is a subdirectory of a holding disk, generally named by timestamp. Note, however, that this package does not interpret holding directory names as timestamps, and does not provide direct access to holding directories.

Holding file

A holding file describes one or more os-level files (holding file chunks) in a holding directory, together representing a single dump file.

Holding chunk

A holding chunk is an individual os-level file representing part of a holding file. Chunks are kept small to avoid hitting filesystem size ilmits, and are linked together internally by filename.

By way of example:

  /data/holding                               <-- holding disk
  /data/holding/20070306123456                <-- holding directory
  /data/holding/20070306123456/raj._video_a   <-- holding file and chunk
  /data/holding/20070306123456/raj._video_a.1 <-- holding chunk

CONSTANTS

Holding-disk files do not have a block size, so the size of the header is fixed at 32k. Rather than hard-code that value, use the constant DISK_BLOCK_BYTES from this package.

FUNCTIONS

Note that this package assumes that a config has been loaded (see Amanda::Config).

These three functions provide basic access to holding disks, files, and chunks:

disks()

returns an list of active disks, each represented as a string. This does not return holding disks which are defined in amanda.conf but not used.

files()

returns a list of active holding files on all disks. Note that a dump may span multiple disks, so there is no use in selecting files only on certain holding disks.

file_chunks($file)

returns a list of chunks for the given file. Chunk filenames are always fully qualified pathnames.

Amanda::Holding provides a few utility functions on holding files. Note that these functions require fully qualified pathnames.

file_size($file, $ignore_headers)

returns the size of the holding file in kilobytes, ignoring the size of the headers if $ignore_headers is true.

file_unlink($file)

unlinks (deletes) all chunks comprising $file, returning true on success.

get_header($file)

reads and returns the header (see Amanda::Header) for $file.

The remaining two functions are utilities for amflush and related tools:

get_all_timestamps()

returns a sorted list of all timestamps with dumps in any active holding disk.

get_files_for_flush(@timestamps)

returns a sorted list of files matching any of the supplied timestamps. Files for which no DLE exists in the disklist are ignored. If no timestamps are provided, then all timestamps are considered.


ABOUT THIS PAGE

This page was automatically generated Tue Nov 19 20:05:35 2013 from the Amanda source tree, and documents the most recent development version of Amanda. For documentation specific to the version of Amanda on your system, use the 'perldoc' command.


3.1.3