CSE 265: System and Network Administration

Lab #13

Today we will use tar as a backup tool. Note that this lab is intentionally short to permit demonstrations of missing labs.

  1. Backup and restore to a file

    Use tar to create a compressed backup file of the /etc directory on your sandbox OS drive.

    Use other options for tar to extract (restore) a copy of /etc/hosts (and nothing else) from the backup file you created above.

  2. Simple filesystem checkpointing with rsync

    Take a look at the simple make_snapshot.sh rsync script that can be used to create a rotating filesystem snapshot. This particular version has some features commented out (mounting and re-mounting filesystems) but it uses an interesting option to cp to copy using hard-links (which only copies the name, not the file contents) so that a duplicate of a directory (including contents and subdirectories) takes very little space. It then uses rsync to make the copy up-to-date with an existing directory (often NFS mounted).

    Finally, notice how it renames directories so that no more than 4 copies of the directory are retained.

    The script uses a set of files to determine what to backup and what to ignore. A sample include file set might be:

      #rsync script include file
      home/
      home/**
      - *
    and a sample exclude file might be:
      #rsync script exclude file
      **/.phoenix/default/*/Cache/
      **/.thumbnails/
      **/Desktop/Trash/
      **/.mozilla/*/*/Cache/
      **/.opera/cache4/
      **/.netscape/cache/
    Such files help prevent the needless copying of browser caches and other temporary files that don't need to be backed up.

    Create your own include and exclude files, modify the backup script appropriately, and make a couple of backups of some directory that has files (making some changes between).

  3. Wrapping Up

    In order to sign the lab completion sheet, you will need to:
    1. Show the command line you used and the size of the backup file you created.
    2. What was the command to extract (restore) a copy of /etc/hosts from the backup file?
    3. Show the backup directories created.


This page can be reached from http://www.cse.lehigh.edu/~brian/course/2016/sysadmin/labs/
Last revised: 2 May 2016.