Backing Up a journaled FS
Roland Smith
rsmith at xs4all.nl
Mon Dec 29 13:37:10 UTC 2014
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 all
> 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 but
> 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 “noauto” 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="-axq -H --delete"
LOG="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 only
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.g.
boot from a CD or memstick to restore those.
Hope this helps,
Roland
--
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)
More information about the freebsd-questions
mailing list