>> On Sat, 22 Aug 2009 15:58:25 +0200, 
>> Erik Norgaard <norga...@locolomo.org> 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"

# Get a table of contents for a configured system.

export PATH

# First time this is run, {/usr /home /var} are all under /.
# We want to check the same things when we do the comparison run.
root="`df $fsys`"

for dir in /usr /home /var
    x="`df $dir`"
    test "$x" != "$root" && fsys="$fsys $dir"

# 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
freebsd-questions@freebsd.org mailing list
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to