Hacker News new | ask | show | jobs
by j_not_j 11 days ago
Sorry, don't have any code to offer since I did this at $JOB about 20 years ago....pre-git.

The general idea was:

- support multiple tapes and duplicate tapes - all tape handling is manual (issue text message "mount tape TX003 please") - first file on tape is a tar file with a tape serial number as the file name. Check this at tape mount time. - to archive: add a file at the end of the tape (mt to position at EOT) - detect write-past EOT with an mt error; this wasn't too reliable tho, mtx might be better. If detected, request next tape. - the database ("directory") is up to you. A text file with tape name, file number and filename allows to use mt to FSF to the file number for retrieval. Or echo this to a distinct file in a directory. How you expect to retrieve should guide you here.

Good luck and happy coding.

This was done on IRIX with bash; probably a couple hundred lines or less.

1 comments

Just to clarify a bit:

1. to write a new file, forward space to end of written files (FSF) which by convention is two consecutive filemarks. Backspace one filemark, then write the file. Then write two filemarks.

2. I mistakenly wrote "write-past EOT" but it is end-of-media (EOM) that can happen writing a file. At that point your policy might be only complete files per tape so you backspace to previous filemark, write the second filemark ("logical end of media") and then ask for a new tape.

Files have to be written blockwise (use dd or tar or pax or cpio).

Thank you very much for your explanation and clarification! I can already foresee long nights of debugging all the quirks of the tape libraries and tapes though…