Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Jul 2010 18:40:12 +0000
From:      Alexander Best <arundel@freebsd.org>
To:        "Sam Fourman Jr." <sfourman@gmail.com>
Cc:        freebsd-current@freebsd.org, Xin Li <d@delphij.net>, Michael Gusek <michael.gusek@web.de>
Subject:   Re: Problem with ZFS version 15
Message-ID:  <20100722184012.GA74306@freebsd.org>
In-Reply-To: <AANLkTimNfhl35L91iSGCMKtKL6wqMM5MI17y-GgqHUOV@mail.gmail.com>
References:  <242312022.4636340.1279374040721.JavaMail.fmail@mwmweb017> <4C44C19C.4080302@delphij.net> <AANLkTilZGPtZ40yIsyPX68ZdODr1Cqk1Vgson731WEB5@mail.gmail.com> <4C44D0BA.5080705@delphij.net> <20100720003742.GA95384@freebsd.org> <AANLkTimNfhl35L91iSGCMKtKL6wqMM5MI17y-GgqHUOV@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--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 <arundel@freebsd.org> 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100722184012.GA74306>