From owner-freebsd-questions@FreeBSD.ORG Mon Aug 24 00:15:16 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC8E4106568C for ; Mon, 24 Aug 2009 00:15:16 +0000 (UTC) (envelope-from vogelke@hcst.com) Received: from beta.hcst.com (beta.hcst.com [192.52.183.241]) by mx1.freebsd.org (Postfix) with ESMTP id 9BFA78FC14 for ; Mon, 24 Aug 2009 00:15:16 +0000 (UTC) Received: from beta.hcst.com (localhost [127.0.0.1]) by beta.hcst.com (8.13.8/8.13.8/Debian-3) with ESMTP id n7O0FFrr005023 for ; Sun, 23 Aug 2009 20:15:15 -0400 Received: (from vogelke@localhost) by beta.hcst.com (8.13.8/8.13.8/Submit) id n7O0FFpA005022; Sun, 23 Aug 2009 20:15:15 -0400 Received: by kev.msw.wpafb.af.mil (Postfix, from userid 32768) id 93892B7C4; Sun, 23 Aug 2009 20:14:41 -0400 (EDT) To: freebsd-questions@freebsd.org In-reply-to: <4A8FF981.7020707@locolomo.org> (message from Erik Norgaard on Sat, 22 Aug 2009 15:58:25 +0200) Organization: Oasis Systems Inc. X-Disclaimer: I don't speak for the USAF or Oasis. X-GPG-ID: 1024D/711752A0 2006-06-27 Karl Vogel X-GPG-Fingerprint: 56EB 6DBF 4224 C953 F417 CC99 4C7C 7D46 7117 52A0 Message-Id: <20090824001441.93892B7C4@kev.msw.wpafb.af.mil> Date: Sun, 23 Aug 2009 20:14:41 -0400 (EDT) From: vogelke+unix@pobox.com (Karl Vogel) Subject: Re: What should be backed up? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: vogelke+unix@pobox.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 00:15:16 -0000 >> On Sat, 22 Aug 2009 15:58:25 +0200, >> Erik Norgaard said: E> Yes, it's easy to miss something that should have been backed up. There E> is no point in backup of files other than those you modify yourself, E> unless you plan to create an exact image and recover using dd. Touching a timestamp file and backing up stuff newer than that works fine for things you modify, but I frequently copy over source tarballs and the timestamp method won't work for those. I use MD5 to find what I've added, changed, or deleted: root# mkdir /root/toc root# cd /root/toc root# date; find / -type f -print | xargs /sbin/md5 -r > orig.md5; date Tue Mar 24 20:55:20 EDT 2009 Tue Mar 24 20:58:50 EDT 2009 root# wc -l orig.md5 198760 orig.md5 root# df -m / Filesystem 1M-blocks Used Avail Capacity Mounted on /dev/aacd0s1a 7931 1882 5414 26% / root# grep -v /root/toc orig.md5 > x root# mv x orig.md5 This was from a 7.1 installation. The box hashed 199,000 files (1.8 Gb) in just over 3 minutes, which was fine with me. Next, I back up /etc in case I mangle something: root# mkdir /etc.orig root# cd /etc root# find . -print | pax -rwd -pe /etc.orig After all my tweaks are in place, user accounts installed, etc., I run the script below to get a new table-of-contents. Then I can compare the two MD5 files to see exactly what I've added, removed, or modified. -- Karl Vogel I don't speak for the USAF or my company Burned so much oil, it was single handedly responsible for the formation of OPEC. --a Chevy Vega owner, on "Car Talk's 10 worst cars of the millennium" =========================================================================== #!/bin/ksh # Get a table of contents for a configured system. PATH=/bin:/sbin:/usr/sbin:/usr/bin export PATH out=new.md5 top=/root/toc # First time this is run, {/usr /home /var} are all under /. # We want to check the same things when we do the comparison run. fsys=/ root="`df $fsys`" for dir in /usr /home /var do x="`df $dir`" test "$x" != "$root" && fsys="$fsys $dir" done # Get the TOC. cd $top || exit 1 date; find $fsys -xdev -type f -print0 | xargs -0 md5 -r > $out; date # How much space are we checking? echo; df -m $fsys; echo grep -v $top $out > x.$$ mv x.$$ $out wc -l $out exit 0