I have some tape drives and decided to back my data to tape (one of the reasons is that most of my data is not changing, so once I do a full backup, the tapes will have better chance of working after sitting on a shelf for a while than hard drives).
I would like to use simple Linux tools to do those backups, not some more complicated software like bacula that have its own database. My use case is a bit different and I would rather write my own scripts to do this.
tar and cpio are useful for this, but, because of the format, it needs to read the entire tape (possibly taking hours) to list the files and if I want to restore a single file at the end of the tape, it needs to read the whole tape again.
Due to the way LTO tapes are written (multiple passes to fill the tape), it is possible to seek to a file at the end of the archive relatively quickly without reading all the data from the beginning of the tape.
For example, using mt to get to the next filemark takes much less time than tar to scan the archive to produce the file list or to restore a 1KB file from the end of the archive.
It also should be possible to put a "table of contents" at the beginning of the tape so that you know what files are on the tape and where they are.
Software like BackupExec can do this - it only takes a short time to "catalog" a tape and also takes a short time to restore a file that is at the end of the tape.
I could run ls (or find) on the directory, write the output to tape and then tar the directory to tape. This would solve the listing problem, but tar would still take forever to restore the last file.
Is there a simple tool that is similar to tar, but can create the file list at the beginning of the archive and be able to seek to restore a file?