fsdiff(1)

NAME
fsdiff - compare filesystem to transcripts

SYNOPSIS
fsdiff { -C | -A | -1 } [ -IVW ] [ -K command ] [ -c checksum ] [ -o file [ -% ] ] path

DESCRIPTION
fsdiff reads a command file (the default name is command.K) to get a list of transcripts. If the command file is empty, the transcript list is considered to be the null transcript. Included command files are read depth first. The first transcript listed has the lowest precedence, the next higher, and the last has the highest. If any special files are listed, the special.T transcript will have the absolute highest precedence.

fsdiff walks the filesystem starting at path and compares the filesystem to the transcripts. Trailing '/'s on path are clipped.

If a transcript is positive, fsdiff checks all attributes of each file system object ( i.e. file, directory, link, etc ). If the -c option is given, checksums are also compared. If a transcript is negative, fsdiff checks only some of the attributes of the file system objects ( see TRANSCRIPTS section below ). There is only one special transcript, special.T, and it contains references to files that are host specific, eg. /etc/hostname.hme0.

Any discrepancies are printed on the standard output or, with the -o option, to a file. The default is to print the differences as edits to the transcript to make it match the filesystem. If the edit direction chosen is -T or -A, the differences are printed as edits to the file system to make it match the transcript. A "+" at the beginning of a line indicates a file must be downloaded. A "-" indicates the given object ( file, directory, link etc ) must be removed.

TRANSCRIPTS
A transcript contains a list of filesystem objects, eg. directories, files, symbolic links etc. Transcripts have the following format:

    type path [type specific information]

Type is a single letter: h, l, d, c, b, p, s, D, f, a. Path is the encoded path, where space is "\b", tab is "\t", newline is "\n", carriage return is "\r", and \ is "\\". The type specific information varies.

    l path target
    h path target

Type 'l' is a symbolic link and 'h' is a hard link. Target is encoded like path. If a symbolic link is listed in a negative transcript, the target is not checked.

    d path mode uid gid [ finder-information ]
    D path mode uid gid
    s path mode uid gid
    p path mode uid gid

Type 'd' is a directory, 'D' is a door, 's' is a socket and 'p' is a named pipe. Mode is a 4 digit octal representation of the permissions. ( see chmod(1). ) uid and gid are the user and group ids in decimal format. finder-information is used only on Mac OS X machines running on an HFS+ formatted drive to store directory finder information. If a directory is listed in a negative transcript, mode, uid, gid and, if listed, finder-information will be checked, but the directory itself will not be read.

    b path mode uid gid major minor
    c path mode uid gid major minor

Type 'b' is a block special file, 'c' is a character special file. Major and minor are the major and minor device numbers in decimal. If a character special file is listed in a negative transcript, only major and minor device number will be checked.

    f path mode uid gid mtime size checksum
    a path mode uid gid mtime size checksum

Type 'f' is a reuglar file. Mtime is a decimal number of seconds since 1970 GMT. Size is the size of the file in bytes. Checksum is the base64 encoded checksum if enabled, otherwise it is "-". If a file is listed in a negative transcript, only mode, uid and gid will be checked.

Type 'a' is an applefile, relevant only on Mac OS X machines running on an HFS+ formatted drive. An applefile has Mac OS metadata, and is stored on the server as an AppleSingle file (see applefile(5)). Everything that applies to a regular file applies to an applefile, as well.

Transcripts are sorted alphabetically, depth first, and case sensitively. This means subdirectories have precedence over files in the same directory: lexically, "/" has highest precedence. So the file:

    /etc/passwd

comes before:

    /etc.old

even though "." normally comes before "/", and:

    /Library

would come before:

    /dev

as capitalized characters are higher in precedence than lowercase ones. Both of the previous two directories would come before:

    /etc.old

COMMAND FILES
Command files have the following format:

    type    path

Type is 'k' for command file, 'p' for positive, 'n' for negative, 's' for special and 'x' for an exclude pattern. The argument path is either a command file name, transcript name, or in the case of type special, a full pathname.

    # example command file
    k    linux-base.K
    p    test/denser-10.T
    p    simta-032.T
    n    simta-neg.T
    s    /etc/fstab
    x    /etc/tsm*.pid

Lines beginning with "#" are comments, and are skipped. A comment must be on a line by itself. Blank lines are also skipped. Exclude lines are wildcard patterns (see radmind(8) DESCRIPTION) of paths that will be ignored completely, that is, fsdiff will not care if an object matching an exclude line is present or absent, and will not print out anything relating to it. Exclude patterns apply to objects on the filesystem and paths in transcripts. Only special files are unaffected by excludes. For help determining which files you are excluding, use the -W flag.

If there is no command file, the transcript used is the null transcript. This means fsdiff will print out a difference line for every object in the filesystem, eg. a filesystem snapshot.

Positive and negative transcripts and special files can be removed from a command file by using minus lines. These lines effectively remove all previously referenced lines that match both the type and path of the minus line. Minus lines begin with a '-', followed by some amount of whitespace.

Minus lines only apply to transcripts and special files that have already been read from a command file. If a subsequent line or included command file lists the same transcript or special file, it will be once again included.

For example, if you wanted to remove the special file /etc/fstab from the previous example, you could use this command file:

    # example command file
    k    linux-base.K
    p    test/denser-10.T
    p    simta-032.T
    n    simta-neg.T
    s    /etc/fstab
    -  s    /etc/fstab

The minus line in this example would match the special file /etc/fstab, causing it to be effectively removed from the command file.

EXAMPLES
In this example, fsdiff is used to generate a line for the negative transcript for /tmp.

    example% fsdiff -1 /tmp
    d /tmp               1777     0     3
    example%

A more complete negative transcript might look like this:

    example% vi negative.T
    f /etc/passwd        0444     0     3 993477914     482 -
    d /proc              0555     0     0
    d /tmp               1777     0     3
    f /var/adm/lastlog   0444     0     1 993662219  976304 -
    f /var/adm/messages  0644     0     0 993661335   94910 -
    f /var/adm/sulog     0600     0     0 993662246     422 -
    f /var/adm/utmpx     0644     0     2 993662219    2604 -
    f /var/adm/wtmpx     0644     4     4 993662219  111600 -
    f /var/cron/log      0600     0     0 993627000    2694 -
    d /xfn               0555     0     0

OPTIONS

-%  percentage done progress output. Requires -o option.

no option
    fsdiff defaults to -A. Future releases will require an option explicitly.

-1  prints out a single transcript line for the given file. This option can be used to build negative transcripts.

-A  produces an applicable transcript.

-C  produces a creatable transcript.

-c checksum
    enables checksuming.

-I  be case insensitive when compairing paths.

-K command
    specifies a command file name, by default /var/radmind/client/command.K

-o file
    specifies an output file, default is the standard output.

-V  displays the version number of fsdiff, a list of supported checksumming algorithms in descending order of preference and then exits.

-W  prints a warning to the standard error when encountering an object matching an exclude pattern.

FILES

/var/radmind/client/command.K
    name of the default command file.

special.T
    name of the special transcript.

EXIT STATUS
The following exit values are returned:

0   No errors.

>1  An error occurred.

SEE ALSO
ktcheck(1), lapply(1), lcksum(1), lcreate(1), lfdiff(1), lmerge(1), lsort(1), twhich(1), applefile(5), radmind(8).