View previous topic :: View next topic |
Author |
Message |
zecora l33t
Joined: 17 Aug 2004 Posts: 627 Location: Minneapolis, MN
|
Posted: Tue Apr 05, 2005 4:12 pm Post subject: Howto Do a Backup. |
|
|
I am wondering how i should go about doing this. I have a fileserver, and other gentoo boxes in my house. How can i run a script or have my computers backup the information i want? What i want is a dedicated backup server, that houses all my docs or files i want to back up. how do i have my boxes backup what i want, what do i need to do?
Does this make sense? |
|
Back to top |
|
|
BlackEdder Advocate
Joined: 26 Apr 2004 Posts: 2588 Location: Dutch enclave in Egham, UK
|
|
Back to top |
|
|
zecora l33t
Joined: 17 Aug 2004 Posts: 627 Location: Minneapolis, MN
|
Posted: Tue Apr 05, 2005 4:48 pm Post subject: |
|
|
how does it work for you?
Is it hard to set up for a beginner? |
|
Back to top |
|
|
BlackEdder Advocate
Joined: 26 Apr 2004 Posts: 2588 Location: Dutch enclave in Egham, UK
|
Posted: Tue Apr 05, 2005 4:57 pm Post subject: |
|
|
I found rsnapshot fairly easy to setup. Never tried it over a network though, but it should be easy enough. BTW I'm assuming all your clients are linux machines.
One the server make sure ssh is working, then setup an account backups (or something similar). On every client install rsnapshot (emerge rsnapshot) and configure /etc/rsnapshot.conf. You can use rsnapshot.conf.default as an example and the site has more information how to configure it.
This thread: https://forums.gentoo.org/viewtopic-t-299869-highlight-rsnapshot.html also has some info. |
|
Back to top |
|
|
zecora l33t
Joined: 17 Aug 2004 Posts: 627 Location: Minneapolis, MN
|
Posted: Tue Apr 05, 2005 5:29 pm Post subject: |
|
|
It makes sense what i want to do right?
What i want is my fileserver to get backed up of all the files or dirs i have selected. I want them to be transfered over to a
backup server. This process i at least want to happen once a week. What else i want is for my other gentoo boxes to get a backup once a week of selected config files. So i do not erase them or i reinstall the box. |
|
Back to top |
|
|
Naan Yaar Bodhisattva
Joined: 27 Jun 2002 Posts: 1549
|
Posted: Wed Apr 06, 2005 1:59 am Post subject: rdiff-backup |
|
|
I use rdiff-backup to back up my machine to a USB drive. However, it can backup to a remote machine too. One big advantage using rdiff-backup is that it stores the current state as is and also lets you keep older versions as diffs. This makes it very efficient and allows you to go back to older versions of files. This feature has saved my butt a couple of times when a misbehaving ebuild blew away a config file and the latest version on the backup was itself a bad version; I was able to get to an older version that worked. |
|
Back to top |
|
|
zecora l33t
Joined: 17 Aug 2004 Posts: 627 Location: Minneapolis, MN
|
Posted: Wed Apr 06, 2005 3:38 pm Post subject: |
|
|
is it in portage? can i get a howto? |
|
Back to top |
|
|
racoontje Veteran
Joined: 19 Jul 2004 Posts: 1290
|
Posted: Wed Apr 06, 2005 9:15 pm Post subject: |
|
|
rsync for files, I guess.
dd if=/dev/partition and pipe it to tar? |
|
Back to top |
|
|
jdgill0 Veteran
Joined: 25 Mar 2003 Posts: 1366 Location: Lexington, Ky -- USA
|
Posted: Wed Apr 06, 2005 10:06 pm Post subject: |
|
|
This does look interesting for backups. Some time ago I was looking for a means to do rotating backups, for local backups as well as across the network. I had looked at rdiff-backup back then as well, but with Gentoo you really don't want/need backup information too far in the past given Gentoo is ever-evolving at a rapid pace. |
|
Back to top |
|
|
asiobob Veteran
Joined: 29 Oct 2003 Posts: 1375 Location: Bamboo Creek
|
Posted: Thu Apr 07, 2005 12:47 am Post subject: |
|
|
I use Sarab (http://sarab.sf.net) which is a script that controls DAR. SaraB does rotations and full, differential, and incremental backups. DAR is the actual back up program. There are some nice GUI front ends as well but I've never used em |
|
Back to top |
|
|
jdgill0 Veteran
Joined: 25 Mar 2003 Posts: 1366 Location: Lexington, Ky -- USA
|
Posted: Thu Apr 07, 2005 1:12 am Post subject: |
|
|
ASIO_BOB wrote: | I use Sarab (http://sarab.sf.net) which is a script that controls DAR. SaraB does rotations and full, differential, and incremental backups. DAR is the actual back up program. There are some nice GUI front ends as well but I've never used em |
Sounds like it could be a bit complicated to setup and use. Furthermore, it's not only a matter of making backups, but also the ease of restoration from your backups. How complicated is it to restore from Sarab backups? |
|
Back to top |
|
|
asiobob Veteran
Joined: 29 Oct 2003 Posts: 1375 Location: Bamboo Creek
|
Posted: Thu Apr 07, 2005 1:27 am Post subject: |
|
|
trivial.
With the front ends its easy.
DAR = Disk Archive. It aims to back up to Disks like CDs, DVD, FLASH, hard drives. Anything really thats not tape.
Running dar by itself is possible, but the comand becomes really long. It can do stuff like main backup and differentials againts that main one (for smaller size). You can even extract the catelog out of the main backup so you odn't have to have the main one to create the next one. You can basically recover files easily by reading the man page or using the GUI tools which makes life 10x easier.
SaraB is a rotation script. Using this as your back up wrapper you don't have to know lines of DAR command line options. Just set your rotation policy in a file like
week1
monday
tuesday
wednesday
thursday
friday
saturday
Week2
..
...
(I have up to week 4). So weekX is a main back up, the days mon-sat backup against that week. It's now also trival to set up exclusions, for a system back up I exclude /dev for an example and /proc. Sarab makes all this easy because it then runs dar for you.
I've recovered a file before and it was very easy. |
|
Back to top |
|
|
jdgill0 Veteran
Joined: 25 Mar 2003 Posts: 1366 Location: Lexington, Ky -- USA
|
Posted: Thu Apr 07, 2005 1:42 am Post subject: |
|
|
Thanks ASIO_BOB for the description/info. I will check it out. There seem to be several good backup options available in portage now adays. |
|
Back to top |
|
|
asiobob Veteran
Joined: 29 Oct 2003 Posts: 1375 Location: Bamboo Creek
|
Posted: Thu Apr 07, 2005 2:24 am Post subject: |
|
|
dar is on portage, sarab from sourceforge is a tiny script.
Also in the example I provided it is assumed you actually run sarab, it won't run it self.
So in my example you want a cronjob to run it daily. if you run it more than once a day sarab will rotate the days and weeks as it thinks you are doing it once a day.
The content of hte rotation file can be anything , I like Week1 etc.. but you can do it
"dsfdsf"
"blah dsfdsf"
in which case the first back up is a full one, the next backup "blah" is based of "dsfdsf" |
|
Back to top |
|
|
Naan Yaar Bodhisattva
Joined: 27 Jun 2002 Posts: 1549
|
Posted: Thu Apr 07, 2005 4:09 am Post subject: rdiff-backup |
|
|
It is in portage:
Code: |
dual src # emerge -s rdiff-backup
Searching...
[ Results for search key : rdiff-backup ]
[ Applications found : 1 ]
* net-misc/rdiff-backup
Latest version available: 0.13.4
Latest version installed: 0.13.4
Size of downloaded files: 140 kB
Homepage: http://rdiff-backup.stanford.edu/
Description: Remote incremental file backup utility, similar to rsync butmore reliable
License: GPL-2
|
I use a simple script that looks like as follows:
Code: |
#
#!/bin/sh
#
echo "Backup script started at: $(date)"
if [[ "$(df | grep /backup)" = "" ]]; then
mount /backup
backup_mounted="y"
echo "Mounted backup directory"
df | grep /backup
else
echo "Backup directory already mounted"
fi
# do the backups
/usr/bin/rdiff-backup --exclude-other-filesystems / /backup/root
/usr/bin/rdiff-backup --exclude-other-filesystems /home /backup/home
echo "Backup done"
# sync the disks for safety sake
sync
echo "Synced disks"
# unmount /backup if we mounted it
if [[ "$backup_mounted" = "y" ]]; then
umount /backup
echo "Unmounted backup directory"
fi
# status
echo "Backup script finished successfully at: $(date)"
|
In the above script, /backup is the mountpoint for the backup partition which, in my case, is a usb hard drive (external). This script is called from a cron entry like this:
Code: |
12 12 * * mon,wed,fri /usr/local/sbin/rdiff-backup.sh
|
Since rdiff-backup stores the older versions of the backup as diffs, it is efficient. For example, on my machine, the /home backup looks like this:
Code: |
dual src # rdiff-backup --list-increment-sizes /backup/home
-----------------------------------------------------------------
Detected abilities for archive (read/write) file system:
Characters needing quoting ''
Ownership changing On
Hard linking On
fsync() directories On
Directory inc permissions On
Access control lists Off
Extended attributes Off
Mac OS X style resource forks Off
Mac OS X Finder information Off
-----------------------------------------------------------------
Time Size Cumulative size
-----------------------------------------------------------------------------
Wed Apr 6 12:33:33 2005 2.70 GB 2.70 GB (current mirror)
Mon Apr 4 12:43:01 2005 35.7 MB 2.73 GB
Fri Apr 1 13:58:55 2005 130 MB 2.86 GB
Wed Mar 30 13:57:59 2005 2.93 MB 2.86 GB
Mon Mar 28 13:38:10 2005 2.68 MB 2.87 GB
Fri Mar 25 13:57:28 2005 3.45 MB 2.87 GB
Wed Mar 23 14:28:55 2005 2.71 MB 2.87 GB
Mon Mar 21 14:13:26 2005 5.29 MB 2.88 GB
Fri Mar 18 13:30:51 2005 4.64 MB 2.88 GB
Wed Mar 16 13:31:34 2005 2.91 MB 2.89 GB
Mon Mar 14 13:35:00 2005 2.63 MB 2.89 GB
Fri Mar 11 13:41:00 2005 2.72 MB 2.89 GB
Mon Mar 7 13:57:20 2005 4.58 MB 2.89 GB
Fri Mar 4 13:38:08 2005 3.72 MB 2.90 GB
|
As you can see from the above, there are 14 backups with the current one being 2.7GB and the older ones (stored in differential format) are 0.2GB in all. I periodically clean up older backups by doing:
Code: |
rdiff-backup --remove-older-than 30D --force /backup/root
|
to remove backups older than 30 days. You can use the "-r" option to restore older versions. More examples here: http://www.nongnu.org/rdiff-backup/examples.html
zecora wrote: | is it in portage? can i get a howto? |
|
|
Back to top |
|
|
zecora l33t
Joined: 17 Aug 2004 Posts: 627 Location: Minneapolis, MN
|
Posted: Fri Apr 08, 2005 7:16 pm Post subject: |
|
|
thx for all the good programs i can try. I will give it a shot and keep ya updated. |
|
Back to top |
|
|
|