'\" te
.\"  Copyright (c) 1980 Regents of the University of California.  All rights reserved.  The Berkeley software License Agreement  specifies the terms and conditions for redistribution. Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved.
.TH UFSDUMP 4 "Apr 9, 2003"
.SH NAME
ufsdump, dumpdates \- incremental dump format
.SH SYNOPSIS
.LP
.nf
\fB#include <sys/types.h>\fR
.fi

.LP
.nf
\fB#include <sys/inode.h>\fR
.fi

.LP
.nf
\fB#include <protocols/dumprestore.h>\fR
.fi

.LP
.nf
\fB/etc/dumpdates\fR
.fi

.SH DESCRIPTION
.sp
.LP
Tapes used by \fBufsdump\fR(1M) and \fBufsrestore\fR(1M) contain:
.RS +4
.TP
.ie t \(bu
.el o
a header record
.RE
.RS +4
.TP
.ie t \(bu
.el o
two groups of bit map records
.RE
.RS +4
.TP
.ie t \(bu
.el o
a group of records describing directories
.RE
.RS +4
.TP
.ie t \(bu
.el o
a group of records describing files
.RE
.sp
.LP
The format of the header record and the format of the first record of each
description in the \fB<protocols/dumprestore.h>\fR include file are:
.sp
.in +2
.nf
#define TP_BSIZE_MAX    65536
#define TP_BSIZE_MIN    1024
#define ESIZE_SHIFT_MAX 6

#ifdef SUPPORTS_MTB_TAPE_FORMAT
#define TP_BUFSIZE      TP_BSIZE_MAX
#else
#define TP_BSIZE        1024
#define TP_BUFSIZE      TP_BSIZE
#endif /* SUPPORTS_MTB_TAPE_FORMAT */

#define NTREC           10
#define HIGHDENSITYTREC 32
#define CARTRIDGETREC   63
#define TP_NINDIR       (TP_BSIZE_MIN/2)
#define TP_NINOS        (TP_NINDIR / sizeof (long))
#define LBLSIZE         16
#define NAMELEN         64

#define OFS_MAGIC       (int)60011
#define NFS_MAGIC       (int)60012
#define MTB_MAGIC       (int)60013
#define CHECKSUM        (int)84446
.fi
.in -2

.sp
.in +2
.nf
union u_data {
        char    s_addrs[TP_NINDIR];
        int32_t s_inos[TP_NINOS];
};

union u_shadow {
        struct s_nonsh {
                int32_t c_level;
                char    c_filesys[NAMELEN];
                char    c_dev[NAMELEN];
                char    c_host[NAMELEN];
        } c_nonsh;
        char    c_shadow[1];
};

union u_spcl {
        char dummy[TP_BUFSIZE];
        struct  s_spcl {
                int32_t c_type;
                time32_t c_date;
                time32_t c_ddate;
                int32_t c_volume;
                daddr32_t c_tapea;
                ino32_t c_inumber;
                int32_t c_magic;
                int32_t c_checksum;
                struct  dinode  c_dinode;
                int32_t c_count;
                union   u_data c_data;
                char    c_label[LBLSIZE];
                union   u_shadow c_shadow;
                int32_t c_flags;
                int32_t c_firstrec;
#ifdef SUPPORTS_MTB_TAPE_FORMAT
                int32_t c_tpbsize;
                int32_t c_spare[31];
#else
                int32_t c_spare[32];
#endif /* SUPPORTS_MTB_TAPE_FORMAT */
} s_spcl;
} u_spcl;
.fi
.in -2

.sp
.in +2
.nf
int32_t                    c_type;
time32_t                   c_date;
time32_t                   c_ddate;
int32_t                    c_volume;
daddr32_t                  c_tapea;
ino32_t                    c_inumber;
int32_t                    c_magic;
int32_t                    c_checksum;
struct dinode              c_dinode;
int32_t                    c_count;
union                      u_data c_data;
char                       c_label[LBLSIZE];
union                      u_shadow c_shadow;
int32_t                    c_flags;
int32_t                    c_firstrec;
#ifdef SUPPORTS_MTB_TAPE_FORMAT
int32_t                    c_tpbsize;
int32_t                    c_spare[31];
#else
int32_t                    c_spare[32];
#endif                       /*
     SUPPORTS_MTB_TAPE_FORMAT */
.fi
.in -2

.sp
.in +2
.nf
   } s_spcl;
} u_spcl;
#define spcl u_spcl.s_spcl
#define c_addr c_data.s_addrs
#define c_inos c_data.s_inos
#define c_level c_shadow.c_nonsh.c_level
#define c_filesys c_shadow.c_nonsh.c_filesys
#define c_dev c_shadow.c_nonsh.c_dev
#define c_host c_shadow.c_nonsh.c_host
.fi
.in -2

.sp
.in +2
.nf
#define TS_TAPE         1
#define TS_INODE        2
#define TS_ADDR         4
#define TS_BITS         3
#define TS_CLRI         6
#define TS_END          5
#define TS_EOM          7

#define DR_NEWHEADER    1
#define DR_INODEINFO    2
#define DR_REDUMP       4
#define DR_TRUEINC      8
#define DR_HASMETA      16
.fi
.in -2

.sp
.LP
This header describes three formats for the \fBufsdump\fR/\fBufsrestore\fR
interface:
.RS +4
.TP
.ie t \(bu
.el o
An old format, non-MTB, that supports dump sizes of less than 2 terabytes. This
format is represented by \fBNFS_MAGIC\fR.
.RE
.RS +4
.TP
.ie t \(bu
.el o
A new format, MTB, that supports dump sizes of greater than 2 terabytes using a
variable block size and 2 new constants: \fBTP_BSIZE_MIN\fR and
\fBTP_BSIZE_MAX\fR. This format is represented by \fBMTB_MAGIC\fR.
.RE
.RS +4
.TP
.ie t \(bu
.el o
A much older format that might be found on existing backup tapes. The
\fBufsrestore\fR command can restore tapes of this format, but no longer
generates tapes of this format. Backups in this format have the \fBOFS_MAGIC\fR
magic number in their tape headers.
.RE
.sp
.LP
The constants are described as follows:
.sp
.ne 2
.na
\fB\fBTP_BSIZE\fR\fR
.ad
.RS 20n
Size of file blocks on the dump tapes for the old format. Note that
\fBTP_BSIZE\fR must be a multiple of \fBDEV_BSIZE\fR This is applicable for
dumps of type \fBNFS_MAGIC\fR or \fBOFS_MAGIC\fR, but is not applicable for
dumps of type \fBMTB_MAGIC\fR.
.RE

.sp
.ne 2
.na
\fB\fBTP_BSIZE_MIN\fR\fR
.ad
.RS 20n
Minimum size of file blocks on the dump tapes for the new MTB format
(\fBMTB_MAGIC\fR) only.
.RE

.sp
.ne 2
.na
\fB\fBTP_BSIZE_MAX\fR\fR
.ad
.RS 20n
Maximum size of file blocks on the dump tapes for the new MTB format
(\fBMTB_MAGIC\fR) only.
.RE

.sp
.ne 2
.na
\fB\fBNTREC\fR\fR
.ad
.RS 20n
Number of \fBTP_BSIZE\fR blocks that are written in each tape record.
.RE

.sp
.ne 2
.na
\fB\fBHIGHDENSITYNTREC\fR\fR
.ad
.RS 20n
Number of \fBTP_BSIZE\fR blocks that are written in each tape record on  6250
BPI or higher density tapes.
.RE

.sp
.ne 2
.na
\fB\fBCARTRIDGETREC\fR\fR
.ad
.RS 20n
Number of \fBTP_BSIZE\fR blocks that are written in each tape record on
cartridge tapes.
.RE

.sp
.ne 2
.na
\fB\fBTP_NINDIR\fR\fR
.ad
.RS 20n
Number of indirect pointers in a \fBTS_INODE\fR or \fBTS_ADDR\fR record. It
must be a power of 2.
.RE

.sp
.ne 2
.na
\fB\fBTP_NINOS\fR\fR
.ad
.RS 20n
The maximum number of volumes on a tape.
.RE

.sp
.ne 2
.na
\fB\fBLBLSIZE\fR\fR
.ad
.RS 20n
The maximum size of a volume label.
.RE

.sp
.ne 2
.na
\fB\fBNAMELEN\fR\fR
.ad
.RS 20n
The maximum size of a host's name.
.RE

.sp
.ne 2
.na
\fB\fBOFS_MAGIC\fR\fR
.ad
.RS 20n
Magic number that is used for the very old format.
.RE

.sp
.ne 2
.na
\fB\fBNFS_MAGIC\fR\fR
.ad
.RS 20n
Magic number that is used for the non-MTB format.
.RE

.sp
.ne 2
.na
\fB\fBMTB_MAGIC\fR\fR
.ad
.RS 20n
Magic number that is used for the MTB format.
.RE

.sp
.ne 2
.na
\fB\fBCHECKSUM\fR\fR
.ad
.RS 20n
Header records checksum to this value.
.RE

.sp
.LP
The \fBTS_\fR entries are used in the \fBc_type\fR field to indicate what sort
of header this is. The types and their meanings are as follows:
.sp
.ne 2
.na
\fB\fBTS_TAPE\fR\fR
.ad
.RS 12n
Tape volume label.
.RE

.sp
.ne 2
.na
\fB\fBTS_INODE\fR\fR
.ad
.RS 12n
A file or directory follows. The \fBc_dinode\fR field is a copy of the disk
inode and contains bits telling what sort of file this is.
.RE

.sp
.ne 2
.na
\fB\fBTS_ADDR\fR\fR
.ad
.RS 12n
A subrecord of a file description. See \fBs_addrs\fR below.
.RE

.sp
.ne 2
.na
\fB\fBTS_BITS\fR\fR
.ad
.RS 12n
A bit map follows. This bit map has a one bit for each inode that was dumped.
.RE

.sp
.ne 2
.na
\fB\fBTS_CLRI\fR\fR
.ad
.RS 12n
A bit map follows. This bit map contains a zero bit for all inodes that were
empty on the file system when dumped.
.RE

.sp
.ne 2
.na
\fB\fBTS_END\fR\fR
.ad
.RS 12n
End of tape record.
.RE

.sp
.ne 2
.na
\fB\fBTS_EOM\fR\fR
.ad
.RS 12n
diskette  \fBEOM\fRindicates that the restore is compatible with old dump
.RE

.sp
.LP
The flags are described as follows:
.sp
.ne 2
.na
\fB\fBDR_NEWHEADER\fR\fR
.ad
.RS 17n
New format tape header.
.RE

.sp
.ne 2
.na
\fB\fBDR_INFODEINFO\fR\fR
.ad
.RS 17n
Header contains starting inode info.
.RE

.sp
.ne 2
.na
\fB\fBDR_REDUMP\fR\fR
.ad
.RS 17n
Dump contains recopies of active files.
.RE

.sp
.ne 2
.na
\fB\fBDR_TRUEINC\fR\fR
.ad
.RS 17n
Dump is a "true incremental".
.RE

.sp
.ne 2
.na
\fB\fBDR_HASMETA\fR\fR
.ad
.RS 17n
The metadata in this header.
.RE

.sp
.ne 2
.na
\fB\fBDUMPOUTFMT\fR\fR
.ad
.RS 17n
Name, incon, and ctime (date) for printf.
.RE

.sp
.ne 2
.na
\fB\fBDUMPINFMT\fR\fR
.ad
.RS 17n
Inverse for scanf.
.RE

.sp
.LP
The fields of the header structure are as follows:
.sp
.ne 2
.na
\fB\fBs_addrs\fR\fR
.ad
.RS 17n
An array of bytes describing the blocks of the dumped file.  A byte is  zero if
the block associated with that byte was not present on the file system;
otherwise, the byte is non-zero.  If the block was not present on the file
lsystem, no block was dumped; the block will be stored as a   hole in the file.
If there is not sufficient space in this record to  describe all the blocks in
a file,  \fBTS_ADDR\fR records will be scattered through the file, each one
picking up where the  last left off
.RE

.sp
.ne 2
.na
\fB\fBs_inos\fR\fR
.ad
.RS 17n
The starting inodes on tape.
.RE

.sp
.ne 2
.na
\fB\fBc_type\fR\fR
.ad
.RS 17n
The type of the record.
.RE

.sp
.ne 2
.na
\fB\fBc_date\fR\fR
.ad
.RS 17n
The date of the previous dump.
.RE

.sp
.ne 2
.na
\fB\fBc_ddate\fR\fR
.ad
.RS 17n
The date of this dump.
.RE

.sp
.ne 2
.na
\fB\fBc_volume\fR\fR
.ad
.RS 17n
The current volume number of the dump.
.RE

.sp
.ne 2
.na
\fB\fBc_tapea\fR\fR
.ad
.RS 17n
The logical block of this record.
.RE

.sp
.ne 2
.na
\fB\fBc_inumber\fR\fR
.ad
.RS 17n
The number of the inode being dumped if this is of type \fBTS_INODE\fR.
.RE

.sp
.ne 2
.na
\fB\fBc_magic\fR\fR
.ad
.RS 17n
This contains the value \fBMAGIC\fR above, truncated as needed.
.RE

.sp
.ne 2
.na
\fB\fBc_checksum\fR\fR
.ad
.RS 17n
This contains whatever value is needed to make the record sum to
\fBCHECKSUM\fR.
.RE

.sp
.ne 2
.na
\fB\fBc_dinode\fR\fR
.ad
.RS 17n
This is a copy of the inode as it appears on the file system.
.RE

.sp
.ne 2
.na
\fB\fBc_count\fR\fR
.ad
.RS 17n
The count of bytes in \fBs_addrs\fR.
.RE

.sp
.ne 2
.na
\fB\fBu_data c_data\fR\fR
.ad
.RS 17n
The union of either  \fBu_data c_data\fR The union of either  \fBs_addrs\fR or
\fBs_inos\fR.
.RE

.sp
.ne 2
.na
\fB\fBc_label\fR\fR
.ad
.RS 17n
Label for this dump.
.RE

.sp
.ne 2
.na
\fB\fBc_level\fR\fR
.ad
.RS 17n
Level of this dump.
.RE

.sp
.ne 2
.na
\fB\fBc_filesys\fR\fR
.ad
.RS 17n
Name of dumped file system.
.RE

.sp
.ne 2
.na
\fB\fBc_dev\fR\fR
.ad
.RS 17n
Name of dumped service.
.RE

.sp
.ne 2
.na
\fB\fBc_host\fR\fR
.ad
.RS 17n
Name of dumped host.
.RE

.sp
.ne 2
.na
\fB\fBc_flags\fR\fR
.ad
.RS 17n
Additional information.
.RE

.sp
.ne 2
.na
\fB\fBc_firstrec\fR\fR
.ad
.RS 17n
First record on volume.
.RE

.sp
.ne 2
.na
\fB\fBc_spare\fR\fR
.ad
.RS 17n
Reserved for future uses.
.RE

.sp
.ne 2
.na
\fB\fBc_tpbsize\fR\fR
.ad
.RS 17n
Tape block size for MTB format only.
.RE

.sp
.LP
Each volume except the last ends with a tapemark (read as an end of file). The
last volume ends with a \fBTS_END\fR record and then the tapemark.
.sp
.LP
The dump history is kept in the file \fB/etc/dumpdates\fR. It is an \fBASCII\fR
file with three fields separated by white space:
.RS +4
.TP
.ie t \(bu
.el o
The name of the device on which the dumped file system resides.
.RE
.RS +4
.TP
.ie t \(bu
.el o
The level number of the dump tape; see \fBufsdump\fR(1M).
.RE
.RS +4
.TP
.ie t \(bu
.el o
The date of the incremental dump in the format generated by \fBctime\fR(3C).
.RE
.sp
.LP
\fBDUMPOUTFMT\fR is the format to use when using \fBprintf\fR(3C) to write an
entry to \fB/etc/dumpdates\fR; \fBDUMPINFMT\fR is the format to use when using
\fBscanf\fR(3C) to read an entry from \fB/etc/dumpdates\fR.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for a description of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Stability Level	Unstable
.TE

.SH SEE ALSO
.sp
.LP
\fBufsdump\fR(1M), \fBufsrestore\fR(1M), \fBctime\fR(3C), \fBprintf\fR(3C),
\fBscanf\fR(3C), \fBtypes.h\fR(3HEAD), \fBattributes\fR(5),