Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Dec 2014 14:36:59 +0100
From:      Roland Smith <rsmith@xs4all.nl>
To:        Odhiambo Washington <odhiambo@gmail.com>
Cc:        User Questions <freebsd-questions@freebsd.org>
Subject:   Re: Backing Up a journaled FS
Message-ID:  <20141229133659.GA99537@slackbox.erewhon.home>
In-Reply-To: <CAAdA2WPkX0qNKofG-U9fzOBH-Zh_uiCGmYodfy8NuSSO1YTQdw@mail.gmail.com>
References:  <CAAdA2WPkX0qNKofG-U9fzOBH-Zh_uiCGmYodfy8NuSSO1YTQdw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Dec 29, 2014 at 11:29:13AM +0300, Odhiambo Washington wrote:
> I hope everyone enjoyed their foods & drinks during Christmas:)

Of course. :-)

> I have a server I installed with two identical disks. I used BSD labels
> instead of GPT and I had it a little rough creating my slices, because I =
am
> used to a situation where I only created / amd swap for such servers
> because it made life easy for me during backup. I would completely wipe a=
ll
> data on the second disk every Saturday, via a cron, and write it with data
> from the primary/running/active disk as a means of backup. Not so dandy b=
ut
> works quite fine anyway.

> Now I have gotten to a point where I am stopped in my tracks because I
> cannot do dump/restore on a journaled fs:

My solution to this problem was to manually create the similar partitions on
the second disk. These partitions are also listed in /etc/fstab as
/mnt/bk/<name> with the =E2=80=9Cnoauto=E2=80=9D option.

Every night a cron job running rsync mounts the partitions on
the spare disk and syncronizes them with the primary. This works something
like this;

    FLAGS=3D"-axq -H --delete"
    LOG=3D"logger -t 'backup-local'"

    # This script assumes that the backups are not mounted.

    mount /mnt/bk/root
    if df|grep /mnt/bk/root >/dev/null; then
        #echo "/ is good to go!"
        rsync $FLAGS / /mnt/bk/root && $LOG "/ successfully backed-up."
        umount /mnt/bk/root
    else
        echo "Backup for / not mounted! Not backed up."
    fi

(Similar for other partitions). You can find the complete script on my
website: http://rsmith.home.xs4all.nl/freebsd/automated-local-backups.html

Due to the use of logger(1) and the && operator which makes sure that it on=
ly
logs when rsync was succesful, I can check if the backup actually worked in
/var/log/messages;

    Dec 29 04:00:00 mybox 'backup-local': / successfully backed-up.
    Dec 29 04:03:03 mybox 'backup-local': /usr successfully backed-up.
    Dec 29 04:03:56 mybox 'backup-local': /home successfully backed-up.
    Dec 29 04:04:01 mybox 'backup-local': /var successfully backed-up.

Because it uses rsync, this backup is generally relatively fast. But it only
saves a single copy. So this is basically just a primary defense against e.=
g.
a disk dying. For saving data I generally rsync to a USB disk that is stored
off-site.

And just like dump/restore, this doesn't back up boot blocks. But you can e=
=2Eg.
boot from a CD or memstick to restore those.

Hope this helps,


Roland
--=20
R.F.Smith                                   http://rsmith.home.xs4all.nl/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 5753 3324 1661 B0FE 8D93  FCED 40F6 D5DC A38A 33E0 (keyID: A38A33E0)



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