Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Feb 2002 11:58:20 -0600
From:      Tillman Hodgson <tillman@hodgsonhouse.com>
To:        Kris Kennaway <kris@obsecurity.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: /altroot?
Message-ID:  <20020219115820.B30854@hodgsonhouse.com>
In-Reply-To: <20020219084644.A97852@xor.obsecurity.org>; from kris@obsecurity.org on Tue, Feb 19, 2002 at 08:46:44AM -0800
References:  <20020218162141.A27310@hodgsonhouse.com> <20020219084644.A97852@xor.obsecurity.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Feb 19, 2002 at 08:46:44AM -0800, Kris Kennaway wrote:
> On Mon, Feb 18, 2002 at 04:21:42PM -0600, Tillman Hodgson wrote:
> > Howdy,
> > 
> > Does FreeBSD have built-in functionality similar to OpenBSDs /altroot?
> 
> It might help if you explained what this is.

Sure. From OpenBSD's /etc/daily:

# If ROOTBACKUP is set to 1 in the environment, and
# if filesystem named /altroot is type ffs, on /dev/* and mounted "xx",
# use it as a backup root filesystem to be updated daily.
[ "X$ROOTBACKUP" = X1 ] && {
        rootdev=`awk '$2 == "/" && $1 ~ /^\/dev\// && $3 == "ffs" && \
            $4 ~ /rw/ \
                 { print substr($1, 6) }' < /etc/fstab`
        rootbak=`awk '$2 == "/altroot" && $1 ~ /^\/dev\// && $3 == "ffs"
&& \
            $4 ~ /xx/ \
                { print substr($1, 6) }' < /etc/fstab`
        [ X$rootdev != X -a X$rootbak != X ] && {
                sync
                echo ""
                echo "Backing up root filesystem:"
                echo "copying /dev/r$rootdev to /dev/r$rootbak"
                dd if=/dev/r$rootdev of=/dev/r$rootbak bs=16b seek=1
skip=1 \
                        conv=noerror
                fsck -y /dev/r$rootbak
        }
}

I could add that as a script in /etc/periodic/daily, but I'd prefer to
use built-in functionality rather than duplicate it if it exists.

- Tillman

-- 
Write clearly - don't sacrifice clarity for "efficiency".
            - The Elements of Programming Style (Kernighan & Plaugher)

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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