Is there way to make tar execute a script when switching tape drives?
4
votes
1
answer
572
views
My company has a dual Dell LTO-7 drive. I've recently discovered that it's possible to automatically back up to two tapes, sequentially:
tar -cv --multi-volume --file=/dev/nst0 --file=/dev/nst1 gigantic10TBfile.bin
Excellent. Each tape is 6TB native capacity, we assume the
gigantic10TBfile.bin
doesn't compress, when the tape in /dev/nst0
is full, tar automatically moves on the the tape in /dev/nst1
, and I don't have to leave my chair.
Now, in reality, it's not a gigantic file, it's thousands of smaller files. I tee
the output of tar to a log file to see how things went. In the case of a transfer spanning multiple tapes, I'd like an entry in this log file saying "tape change" or something.
Enter --new-volume-script
(also known as --info-script
or -F
, docs [here](https://www.gnu.org/software/tar/manual/html_node/Multi_002dVolume-Archives.html#info_002dscript)) . Yay. Except it's not executed. Let's make a more manageable example:
tar -cvlp --multi-volume --new-volume-script="./new_volume_script.sh" --file=tarball1.tar --file=tarball2.tar --tape-length=4M 10MBrandom.bin
Running this example reveals that the --new-volume-script
is only executed once tarball1.tar
and tarball2.tar
have been created, and tar "runs out of" destination files.
So, my question is, is there an option to execute a script between the writing to tarball1.tar
and tarball2.tar
?
Asked by bolind
(201 rep)
Nov 14, 2023, 10:01 AM
Last activity: Nov 15, 2023, 06:10 PM
Last activity: Nov 15, 2023, 06:10 PM