FreeBSD Full / Incremental Tape Backup Shell Script

in Categories Backup last updated July 15, 2009

How do I run this script?

Download this script and unzip in /root. Open script and customize tape device ($TAPE variable) and file systems ($FSL). Operator can run this script from a shell prompt:
# /root/
Or via a cron job:
@midnight /root/

Share this on:

13 comment

  1. No problem, just a little update I basically rewrote it again and think I finally have what I really want. I use ZFS here on my freebsd system and I wanted to make sure 1) my backups were sane and stable ….and 2) I didn’t want to always have to goto tape to grab a file unless there was just a total catastrophic failure. Hence I integrated ZFS snapshot creation into the process. Then just to make the archives pretty, I told tar to transform the snapshot paths to the actual system paths before writing it to tape. This uses the same code for tapeswap…here it is…

  2. Err…that’s not exactly what I wanted…guess [code] tags aren’t supported here. It looses all the formatting/tabs like that…but it should still work just doesn’t look very pretty.

  3. This gave me a the motivation to finally get around to writing a backup script for my server. It’s basic framework is a combination of this script and another one I found on this site. It’s optimized for a freebsd/zfs system with a local tapedrive…it’ll even automatically eject tapes and resume on a new tape load. Hope it helps someone.

    Main Part:

    Not sure if anyone else could use it…but I hope it helps someone get a start anyways.

  4. That’s very handy! Two questions: the die()' routine doesn't seem to be used by anything? And BAK’ seems to be undefined.

    I’ll use this as a base for a modified script (I save dumps onto a separate hard drive, and also want there to be separate dump files for each filesystem being dumped).

    1. Actually I’ve two scripts, BAK was used to dump to $BAK file system (e.g. BAK=/usr/backup) and another for tape. $BAK and die are from my dump to FS. Feel free to modify it as per your setup. I will update script to avoid confusion.

    Have a question? Post it on our forum!