From owner-freebsd-current@FreeBSD.ORG Thu Jul 22 18:40:12 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id A45591065674; Thu, 22 Jul 2010 18:40:12 +0000 (UTC) Date: Thu, 22 Jul 2010 18:40:12 +0000 From: Alexander Best To: "Sam Fourman Jr." Message-ID: <20100722184012.GA74306@freebsd.org> References: <242312022.4636340.1279374040721.JavaMail.fmail@mwmweb017> <4C44C19C.4080302@delphij.net> <4C44D0BA.5080705@delphij.net> <20100720003742.GA95384@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="liOOAslEiF7prFVr" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i Cc: freebsd-current@freebsd.org, Xin Li , Michael Gusek Subject: Re: Problem with ZFS version 15 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jul 2010 18:40:12 -0000 --liOOAslEiF7prFVr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jul 19, 2010 at 08:31:11PM -0500, Sam Fourman Jr. wrote: > On Mon, Jul 19, 2010 at 7:37 PM, Alexander Best wrote: > > how about adding a periodic script to /etc/periodic/daily to backup the information? > > > > the idea was raised a long time ago already, but was abandoned [1]. > > > > cheers. > > alex > > > > I think that is a good idea, if you have a script to do that I would test it ok here's a dirty dirty patch. what i did was take the etc/periodic/daily/210.backup-aliases script and do some hacking. this is the work of 2 minutes or so. that's why the script is pretty crappy and probably plain wrong in a few cases. however somebody else who has more time might be able to improve it. :) changes to etc/defaults/periodic.conf and etc/periodic/daily/Makefile (or where you want the script to go) need to be hacked in by hand. cheers. alex > > > -- > > Sam Fourman Jr. > Fourman Networks > http://www.fourmannetworks.com --liOOAslEiF7prFVr Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="backup.gpart.diff" --- /dev/null 2010-07-22 20:33:01.000000000 +0200 +++ etc/periodic/daily/220.backup-geom 2010-07-22 20:09:13.000000000 +0200 @@ -0,0 +1,49 @@ +#!/bin/sh +# +# $FreeBSD:$ +# + +# If there is a global system configuration file, suck it in. +# +if [ -r /etc/defaults/periodic.conf ] +then + . /etc/defaults/periodic.conf + source_periodic_confs +fi + +case "$daily_backup_gpart_enable" in + [Yy][Ee][Ss]) + temp=/tmp/gpart_temp.bak + gpart show > $temp + if [ ! -s $temp ] + then + echo "nothing to backup" + rm $temp || rc=2 + else + bak=/var/backups + rc=0 + + echo "" + echo "Backing up geom partition information:" + + if [ ! -f $bak/gpart.bak ] + then + echo "no $bak/gpart.bak" + mv $temp $bak/gpart.bak || rc=3 + + elif ! cmp -s $bak/gpart.bak $temp + then + [ $rc -lt 1 ] && rc=1 + echo "geom partition layout has been altered:" + diff -u $bak/gpart.bak $temp + mv $bak/gpart.bak $bak/gpart.bak2 + mv $temp $bak/gpart.bak || rc=3 + else + echo "geom partition layout hasn't been altered. skipping backup." + fi + fi;; + + *) rc=0;; +esac + +exit $rc --liOOAslEiF7prFVr--