Recommended backup method

Having read about various backup options, I'm confused as to which to chose. I want to backup a filesystem [/dev/ada0s3] but would like to ignore the /tmp and /mnt directories. What would anyone recommend?
 
That’s a pretty broad question. What are you backing up to? (Cloud? USB? A different machine?)

The default archiver is tar(1). It can recurse through a directory, staying on one partition (--one-file-system) and excluding certain patterns (--exclude). Its output can be piped through a compressor of your choice and written to disk, streamed to a remote server, etc.

Another popular choice for keeping two filesystem copies in sync (rather than having a backup “tarball”) is rsync(1). It has lots of switches you can set, but at a high level it recurses through the trees at both ends and sends whatever is needed to the destination side to bring them in sync.

There are plenty of google-able guides to using these tools, and their man pages are good, too.

Otherwise, if you want to use ZFS on both sides, zfs send and recv are also an excellent choice, especially for large trees and incremental backups.
 
I recent had a similar question myself, but using compression. I wrote a script to only back up select areas of the system. My setup backs up the files to a semi-permanent USB thumb drive mounted at /usr/backup. It's semi-permanent because it's inside the case, plugged directly into the internal port on the card. It's something like this, but PCI and not PCIe and it has Firewire.

Code:
#!/bin/sh

# Parameters
PATH=/bin:/sbin:/usr/bin:/usr/sbin
DATE=`date -j "+%Y%m%d"`
OPTIONS=-cPvjf
BKPATH=/usr/backup/$DATE
EXFILE=.sujournal
SUFFIX=tbz



# Removes the existing file/directory
# if it exists
remove_exist()
  {
    if [ -e $BKPATH ] ; then
      rm -Rf $BKPATH
    fi
  }


# Creates a new directory, if needed
create_dir()
  {
    if [ ! -e $BKPATH ]; then
        mkdir $BKPATH
        chmod 0700 $BKPATH
      elif [ ! -d $BKPATH ] ; then
        rm -Rf $BKPATH
        mkdir $BKPATH
        chmod 0700 $BKPATH
    fi
  }


# Prints instructions
usage()
  {
    echo ''
    echo 'usage: backup [ all | home | etc | src |'
    echo '  obj | doc | ports | local ]'
    echo ''
    echo 'Any of the above combinations will'
    echo 'be recognized.'
    echo ''
    echo 'The options above will back up the'
    echo 'following components:'
    echo ''
    echo '  all:   Everything'
    echo '  home:  Home directories'
    echo '  etc:   System configuration'
    echo '  src:   System source code'
    echo '  obj:   System object code'
    echo '  doc:   System documentation'
    echo '  ports: The ports tree'
    echo '  local: Local software configuration'
    echo ''
    echo 'If no options are given, then'
    echo 'all is assumed.'
    echo ''
  }


# Performs the backup
exec_archive()
  {
    tar $OPTIONS $1 $2 $3 $4
  }


# Archives all the home directories
tar_home()
  {
    local exclude
    local target
    local archive
    target=/home
    archive=$BKPATH/home.$SUFFIX
    exclude="--exclude $target/$EXFILE"
    exec_archive $archive $exclude $target
  }

# Archives the kernel config
tar_i386conf ()
  {
    local exclude
    local target
    local archive
    target=/usr/src/sys/i386/conf
    archive=$BKPATH/usr.i386.$SUFFIX
    exclude="--exclude $target/$EXFILE"
    exec_archive $archive $exclude $target
  }

# Archives the system config
tar_etc()
  {
    local exclude
    local target
    local archive
    target=/etc
    archive=$BKPATH/etc.$SUFFIX
    exclude="--exclude $target/$EXFILE"
    exec_archive $archive $exclude $target
  }

# Archives the compiled base system
tar_usrobj()
  {
    local exclude
    local target
    local archive
    target=/usr/obj
    archive=$BKPATH/usr.obj.$SUFFIX
    exclude="--exclude $target/$EXFILE"
    exec_archive $archive $exclude $target
  }

# Archives the base system source code
tar_usrsrc()
  {
    local exclude
    local target
    local archive
    target=/usr/src
    archive=$BKPATH/usr.src.$SUFFIX
    exclude="--exclude $target/$EXFILE"
    exec_archive $archive $exclude $target
  }

# Archives the documentation
tar_usrdoc()
  {
    local exclude
    local target
    local archive
    target=/usr/doc
    archive=$BKPATH/usr.doc.$SUFFIX
    exclude="--exclude $target/$EXFILE"
    exec_archive $archive $exclude $target
  }

# Archives the ports tree
tar_usrports()
  {
    local exclude
    local target
    local archive
    target=/usr/ports
    archive=$BKPATH/usr.ports.$SUFFIX
    exclude="--exclude $target/$EXFILE"
    exec_archive $archive $exclude $target
  }

# Archives the installed software
tar_usrlocaletc()
  {
    local exclude
    local target
    local archive
    target=/usr/local/etc
    archive=$BKPATH/usr.local.etc.$SUFFIX
    exclude="--exclude $target/$EXFILE"
    exec_archive $archive $exclude $target
  }

# Saves a list of the current packages installed
# on the system
pkg_save()
  {
    pkg info > $BKPATH/pkginfo.txt
  }

# Archives everything
tar_everything()
  {
    remove_exist
    create_dir
    pkg_save
    tar_home
    tar_i386conf
    tar_etc
    tar_usrobj
    tar_usrsrc
    tar_usrdoc
    tar_usrports
    tar_usrlocaletc
  }

# Begins processing
process()
  {
    create_dir
    if [ $1 ]; then
        for loopvar in $*
          {
            case "$loopvar" in
              [Hh][Oo][Mm][Ee])
                create_dir
                pkg_save
                tar_home
              ;;
              [Ee][Tt][Cc])
                create_dir
                pkg_save
                tar_etc
              ;;
              [Ss][Rr][Cc])
                create_dir
                pkg_save
                tar_usrsrc
              ;;
              [Oo][Bb][Jj])
                create_dir
                pkg_save
                tar_usrobj
              ;;
              [Dd][Oo][Cc])
                create_dir
                pkg_save
                tar_usrdoc
              ;;
              [Pp][Oo][Rr][Tt][Ss])
                create_dir
                pkg_save
                tar_usrports
              ;;
              [Ll][Oo][Cc][Aa][Ll])
                create_dir
                pkg_save
                tar_usrlocaletc
              ;;
              [Aa][Ll][Ll])
                tar_everything
              ;;
              *)
                usage
              ;;
            esac
          }
      else
        tar_everything
    fi
  }


# Entry Point
process $*
 
The tar utility is as old as the mountains, but it's still the best for archiving stuff. Must be a really good design since it has survived all the fix it anyway mentality of modern software.

In my case I run a script that puts together an archive of selected directories then saves it off to an ntfs volume mounted with fuse (best thing since sliced bread). This is for a desktop machine that runs several operating systems with all backups on a common ntfs filesystem.
 
Sorry to fly off the hook. I don't use the pwd command and was thinking passwd.

I am happy to report I did not have a web bug but somehow drug the entire /.mozilla directory into /.ssh..
So no web-bug, I fat fingered a mouse drag in the file manager.
Still very nice to have backups..
 
Back
Top