18.8. Creating and Using Data Tapes

Tape technology has continued to evolve but is less likely to be used in a modern system. Modern backup systems tend to use off site combined with local removable disk drive technologies. Still, FreeBSD will support any tape drive that uses SCSI, such as LTO and older devices such as DAT. There is limited support for SATA and USB tape drives.

18.8.1. Serial Access with sa(4)

FreeBSD uses the sa(4) driver, providing /dev/sa0, /dev/nsa0, and /dev/esa0. In normal use, only /dev/sa0 is needed. /dev/nsa0 is the same physical drive as /dev/sa0 but does not rewind the tape after writing a file. This allows writing more than one file to a tape. Using /dev/esa0 ejects the tape after the device is closed, if applicable.

18.8.2. Controlling the Tape Drive with mt(1)

mt(1) is the FreeBSD utility for controlling other operations of the tape drive, such as seeking through files on a tape or writing tape control marks to the tape.

For example, the first three files on a tape can be preserved by skipping past them before writing a new file:

# mt -f /dev/nsa0 fsf 3

18.8.3. Using tar(1) to Read and Write Tape Backups

An example of writing a single file to tape using tar(1):

# tar cvf /dev/sa0 file

Recovering files from a tar(1) archive on tape into the current directory:

# tar xvf /dev/sa0

18.8.4. Using dump(8) and restore(8) to Create and Restore Backups

A simple backup of /usr with dump(8):

# dump -0aL -b64 -f /dev/nsa0 /usr

Interactively restoring files from a dump(8) file on tape into the current directory:

# restore -i -f /dev/nsa0

18.8.5. Other Tape Software

Higher-level programs are available to simplify tape backup. The most popular are Amanda and Bacula. These programs aim to make backups easier and more convenient, or to automate complex backups of multiple machines. The Ports Collection contains both these and other tape utility applications.

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.