Difference between revisions of "Unix dump/restore tape format"
(→TAPE HEADER: Update description.) |
(Inode data.) |
||
Line 60: | Line 60: | ||
| Inode | | Inode | ||
| Inode data | | Inode data | ||
− | | 64 or | + | | 64 or 128 bytes |
| colspan="2" | As stored on disk | | colspan="2" | As stored on disk | ||
|- | |- | ||
Line 71: | Line 71: | ||
| Array of bytes | | Array of bytes | ||
| colspan="2" | 0 or 1 | | colspan="2" | 0 or 1 | ||
+ | |} | ||
+ | |||
+ | The inode data looks like this: | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Name | ||
+ | ! Old Size | ||
+ | ! New Size | ||
+ | |- | ||
+ | | Mode | ||
+ | | 16 bits | ||
+ | | 16 bits | ||
+ | |- | ||
+ | | Nlink | ||
+ | | 16 bits | ||
+ | | 16 bits | ||
+ | |- | ||
+ | | Uid | ||
+ | | 16 bits | ||
+ | | 16 bits | ||
+ | |- | ||
+ | | Gid | ||
+ | | 16 bits | ||
+ | | 16 bits | ||
+ | |- | ||
+ | | Size | ||
+ | | 32 bits | ||
+ | | 64 bits | ||
+ | |- | ||
+ | | Addr | ||
+ | | 40 bytes | ||
+ | | Not present | ||
+ | |- | ||
+ | | Atime | ||
+ | | 32 bits | ||
+ | | 32 bits | ||
+ | |- | ||
+ | | ? | ||
+ | | Not present | ||
+ | | 32 bits | ||
+ | |- | ||
+ | | Mtime | ||
+ | | 32 bits | ||
+ | | 32 bits | ||
+ | |- | ||
+ | | ? | ||
+ | | Not present | ||
+ | | 32 bits | ||
+ | |- | ||
+ | | Ctime | ||
+ | | 32 bits | ||
+ | | 32 bits | ||
+ | |- | ||
+ | | ? | ||
+ | | Not present | ||
+ | | 92 bytes | ||
+ | |- | ||
|} | |} | ||
[[Category: Tape Formats]] | [[Category: Tape Formats]] | ||
[[Category: UNIX]] | [[Category: UNIX]] |
Revision as of 11:49, 8 September 2022
The Unix dump command makes a full or incremental backup of a single disk partition to magnetic tapes. The corresponding restore command recovers data from such tapes. The tape format is vaguely documented in various man pages, but not to a detail necessary to fully understand it.
A dump is logically a series of 1024-byte blocks, grouped ten at a time into tape records. A block can be a header, or data. Header blocks hold metadata and inode information.
Dumps will normally span several tapes. All tapes begin with a TS_TAPE block. The last tape ends with one or several TS_END blocks. The first tape will have TS_BITS and TS_CLRI blocks after TS_TAPE. The rest of the tape blocks are of type TS_INODE, storing raw inodes as stored on disk, followed by data blocks. In some cases a TS_INODE header can not store all information needed, in which case it can be extended with TS_ADDR blocks. Normally the first inodes written to tape is the entire directory structure of the whole file system, and file inodes make up the rest of the tapes.
The tape format comes in two versions. The first version is for the older UNIX file system, and the second version is for Berkeley's FFS file system. On top of that, data can be 16 or 32 bits wide, and big or little endian.
Details to follow. It's a bit of a mess.
TAPE HEADER
This data is common to all headers, but some of the fields may be valid or ignored depending on the header type.
An int is 16 or 32 bits depending on the host.
Name | Description | Size | Value (old, new format) | |
---|---|---|---|---|
Type | Header type | int | TS_TAPE, TS_BITS, TS_CLRI, TS_INODE, TS_ADDR, TS_END | |
Date | Date of dump | 32 bits | Timestamp | |
DDate | Dump from | 32 bits | Timestamp | |
Volume | Tape number | int | Tape in dump, from 1 | |
Tapea | Block number | 32 bits | Block in dump across tapes, from 1 | |
Inumber | Inode number | int | File system inode number | |
Magic | Format identifier | int | 60011 | 60012 |
Inode | Inode data | 64 or 128 bytes | As stored on disk | |
Count | Number of addr bytes | int | ||
Addr | Data present | Array of bytes | 0 or 1 |
The inode data looks like this:
Name | Old Size | New Size |
---|---|---|
Mode | 16 bits | 16 bits |
Nlink | 16 bits | 16 bits |
Uid | 16 bits | 16 bits |
Gid | 16 bits | 16 bits |
Size | 32 bits | 64 bits |
Addr | 40 bytes | Not present |
Atime | 32 bits | 32 bits |
? | Not present | 32 bits |
Mtime | 32 bits | 32 bits |
? | Not present | 32 bits |
Ctime | 32 bits | 32 bits |
? | Not present | 92 bytes |