BAR(5)

NAME
bar - tape archive file format

DESCRIPTION

bar(1), (the tape archive command) dumps several files into one, in a medium suitable for transportation. This format is not compatible with the format generated by tar(1).

A bar tape or file is a series of blocks. Each block is of size TBLOCK. A file on the tape is represented by a header block that describes the file, followed by zero or more blocks that give the contents of the file. At the end of the tape are two blocks filled with binary zeros, as an EOF indicator.

The blocks are grouped for physical I/O operations. Each group of n blocks (where n is set by the b keyletter on the bar(1) command line — default is 20 blocks) is written with a single system call; on nine-track tapes, the result of this write is a single tape record. The last group is always written at the full size, so blocks after the two zero blocks contain random data. On reading, the specified or default group size is used for the first read, but if that read returns less than a full tape block, the reduced block size is used for further reads, unless the B keyletter is used.

The header block looks like:
    #define TBLOCK	512

    union hblock {
    	char dummy[TBLOCK];
    	struct header {
    		char mode[8];
    		char uid[8];
    		char gid[8];
    		char size[12];
    		char mtime[12];
    		char chksum[8];
    		char rdev[8];
    		char linkflag;
    		char bar_magic[2];
    		char volume_num[4];
    		char compressed;
    		char date[12];
    		char start_of_name;
    	} dbuf;
    };

start_of_name is a null-terminated string. date is the date of the archive. bar_magic is a special number indicating that this is a bar archive. rdev is the device type, for files that are devices. The other fields are zero-filled octal numbers in ASCII. Each field (of width w) contains w-2 digits, a space, and a null, except size, rdev, and mtime, which do not contain the trailing null. start_of_name is the name of the file, as specified on the bar command line. Files dumped because they were in a directory that was named in the command line have the directory name as prefix and /filename as suffix. mode is the file mode, with the top bit masked off. uid and gid are the user and group numbers that own the file. size is the size of the file in bytes. Links and symbolic links, and special files, are dumped with this field specified as zero. mtime is the modification time of the file at the time it was dumped. chksum is a decimal ASCII value that represents the sum of all the bytes in the header block. When calculating the checksum, the chksum field is treated as if it were all blanks. linkflag is ASCII 0 if the file is “normal” or a special file, 1 if it is an hard link, 2 if it is a symbolic link, and 3 if it is a special file (device or FIFO). The name linked-to, if any, is in a null-terminated string, following start_of_name. Unused fields of the header are binary zeros (and are included in the checksum).

The first time a given i-node number is dumped, it is dumped as a regular file. The second and subsequent times, it is dumped as a link instead. Upon retrieval, if a link entry is retrieved, but not the file it was linked to, an error message is printed and the tape must be manually re-scanned to retrieve the linked-to file.

When the H modifier is used with bar , an additional header block (one that does not pertain to a particular file) is written to the first block of each volume of the archive. The header ID, as specified on the command line, is copied to start_of_name. The size reflects the number of bytes to skip to the start of the first full file (always zero on the first volume).

The encoding of the header is designed to be portable across machines.

SEE ALSO
bar(1)