Ho dovuto ’soffrire’ un po con howto parziali o errati, alla fine ho prodotto un documento nella speranza sia di aiuto a tanti altri.

I read a lot of document that describe the fundamental operations to do the backup under Linux on a tape but always incomplete or partial.
The purpose of this document is do a concrete example of the really indispensable istructions.



VerifyCompression.sh
#!/bin/bash
# Example to veryfy compression active
export TAPE=/dev/nst0
echo "--------------------------------"
# enable / disable compression
mt -f /dev/nst0 densities
echo "--------------------------------"
mt status
mt -f /dev/nst0 compression 1
mt status
echo "--------------------------------------------------------------"
mt rewind

BackupExample.sh
#!/bin/bash
# Example of two backup queued, the first compressed the last no
export TAPE=/dev/nst0
mt rewind
echo "-------------------------------"
tar cv /media/sda3/sosta/ese1
echo "-------------------------------"
tar czv /media/sda3/sosta/ese2
echo "---------------------------------------------"
mt rewind

VerifyHowmanyBackupOnStream.sh
#!/bin/bash
# Verify howmany backup (2) are present on the stream
export TAPE=/dev/nst0
mt eod
mt status

ViewBackupExample.sh
#!/bin/bash
# View data on the tape, first data was compressed second no
mt rewind
echo "------------------------------------------"
mt status
tar tv
echo "------------------------------------------"
mt fsf 1
mt status
tar tzv
echo "------------------------------------------------------------"
mt rewind

RestoreExample.sh
#!/bin/bash
# In the first example the folder is restored under the actually default directory
# In the second exampe a single file is restored in original position
export TAPE=/dev/nst0
mt rewind
echo "-------"
tar -x --wildcards "*/ese1/"
echo "-------"
mt fsf 1
cd /
tar -xz --wildcards "*aaa.txt"