Simple backup to tape workflow on FreBSD

Depending on how big your backups are, they may not fit on one tape.

The system tar(1) command is bsdtar, which does not support multi-tape archives.

The archivers/gtar port does support this functionality.

Tape devices

  • /dev/sa0 – this device is used to save or read tape content from beginning
  • /dev/nsa0 – this device is used to save or read tape content without rewind tape after applications task is finished, so next task can start just after first one
  • /dev/esa0 – this device is used when we want to eject tape after task is finished

Basic commands

See https://www.cyberciti.biz/faq/linux-tape-backup-with-mt-and-tar-command-howto/

mt – basic command for tape control

mt -f /dev/sa0 rewind rewind tape to beginning

mt -f /dev/sa0 status show information about tape device

tar – command to save files from server to tape and restore files from tape to server

Backup folder content:

mt -f /dev/sa0 rewind
cd /path_to_backup
tar cvf /dev/sa0 *

«cd to folder to backup to tape, run tar command, which save folder content to tape»

Restore folder content from tape:

mt -f /dev/sa0 rewind
cd /path_to_folder
tar xvf /dev/sa0