View previous topic :: View next topic |
Author |
Message |
m_gustafsson Apprentice
Joined: 18 Mar 2007 Posts: 243 Location: Sweden
|
Posted: Thu Sep 03, 2009 7:14 am Post subject: Best practise backing up a server? |
|
|
I have a server which I am becoming more an more dependant on, and I just don't like to think of the amount of time I would have to spend getting a new server up an running in case the one I have today breaks in some way
As it is now I backup all important data that I have put on the server on external disks, so that should be ok I hope. Is there anyway to also backup the system as such, so that it becomes pretty easy to install the same system with the same applications and settings on a new machine?
Many thanks for any ideas.
/Mats |
|
Back to top |
|
|
judepereira Apprentice
Joined: 19 Jan 2008 Posts: 179 Location: Portage, yes, somewhere out there
|
Posted: Thu Sep 03, 2009 7:48 am Post subject: |
|
|
Yes, you can backup the following files/folders on the server so all configs, etc are saved. This includes the apps installed too...
Code: |
/home
/var/www
/var/lib/mysql
/etc
/var/lib/portage/world
|
At a stage3 install, all you have to do is to restore these files/folders and then just do a simple "emerge -avuDNe world". It will actually be like a clone of the crashed server. Make sure you modify make.conf, make.globals and make.profile in the /etc after the restore.
Additionally, add the folder where you have your server scripts like to update it, send mails etc. You can even add /var/log too.
Note: This is my recommendation, it depends person to person as his/her views are different. This is basically what I backup, weekly. _________________ Jude Pereira
(http://judepereira.com) |
|
Back to top |
|
|
Letharion Veteran
Joined: 13 Jun 2005 Posts: 1344 Location: Sweden
|
Posted: Thu Sep 03, 2009 8:17 am Post subject: |
|
|
Sounds like a good recommendation, directories might ofc need adjustment from server to server.
First, I wanted to say, "You can probably write a bash-script for that"
Then, I figured, "Some has already done that." and was gonna tell you too google.
Then I got curious, and googled.
https://forums.gentoo.org/viewtopic.php?p=401456
Good luck. Please report back, time permitting |
|
Back to top |
|
|
judepereira Apprentice
Joined: 19 Jan 2008 Posts: 179 Location: Portage, yes, somewhere out there
|
Posted: Thu Sep 03, 2009 8:52 am Post subject: |
|
|
OK, first of all, I don't run any server. But yes, I still take backups as I have configured my Gentoo so well to do it all over again from scratch. For just a user machine(not a server one), you can use app-backup/simplebackup. But then, as you run servers, you will find that Bacula is probably the best solution. It has lots of configurations, etc. app-backup/simplebackup is basically just a perl file put in /usr/bin; it supports full/incremental/differential backups. It can also send mails too using perl modules. I would recommend Bacula as it is a high-grade, enterprise backup solution. I know a person who runs Bacula for about ten clients, and he states that "Bacula is the best thing that ever happened to me!" _________________ Jude Pereira
(http://judepereira.com) |
|
Back to top |
|
|
m_gustafsson Apprentice
Joined: 18 Mar 2007 Posts: 243 Location: Sweden
|
Posted: Thu Sep 03, 2009 12:00 pm Post subject: |
|
|
Many thanks for your advices
I will take a close look at them and report back. |
|
Back to top |
|
|
pdr l33t
Joined: 20 Mar 2004 Posts: 618
|
Posted: Thu Sep 03, 2009 3:27 pm Post subject: |
|
|
I use rsnapshot to backup my home server to an external hard drive (and my workstation and firewall for that matter). Have already tested that after copying the files back to a new disk (have to partition it manually) all I have to do is fire up a live cd, chroot, do grub-install, reboot and it is good to go. I had to tweak the rsnapshot.conf file a little for a complete backup, and had to write a pre-backup bash script that would mount /boot if it was not already mounted, and a post-backup bash script to umount anything the pre-backup script mounted. |
|
Back to top |
|
|
m_gustafsson Apprentice
Joined: 18 Mar 2007 Posts: 243 Location: Sweden
|
Posted: Thu Sep 03, 2009 5:08 pm Post subject: |
|
|
Do you see any drawback with just using rsync? |
|
Back to top |
|
|
m_gustafsson Apprentice
Joined: 18 Mar 2007 Posts: 243 Location: Sweden
|
Posted: Thu Sep 03, 2009 8:24 pm Post subject: |
|
|
rsnapshot seems to give the functionality I need in an easy way, so I will try to use it for backing up the files proposed by judepereira. |
|
Back to top |
|
|
Tin Guru
Joined: 22 Dec 2005 Posts: 305 Location: Namur, Belgium
|
Posted: Thu Sep 03, 2009 8:50 pm Post subject: |
|
|
m_gustafsson wrote: | Do you see any drawback with just using rsync? |
I am using rsync and it is damn fast and can be easely be interrupted and relaunched when you want.
The first time, it copies the entire stuff, but after, the speed is impressive (I need less than 10 minutes to sync my 50Gb gentoo disk to my backup partition)
It should be coupled with a snapshot mechanism if possible but I did not have time yet to investigate about it. (and it is actually not needed for a 10 minutes full backup during which I do not touch files...) _________________ Tin, the gentoobie |
|
Back to top |
|
|
pdr l33t
Joined: 20 Mar 2004 Posts: 618
|
Posted: Fri Sep 04, 2009 12:15 pm Post subject: |
|
|
rsnapshot is cool for that. It uses rsync, but keeps multiple snapshots and hard-links between them for unchanged files, which means there is only one physical copy of the file contents but (unlike sym(bolic) link) you can delete any one of the snapshots and the others hard-linked are still fine. Using rsync it doesn't compress, but you also get easy access to the backup contents.
To restore I just fire up a live cd, partition the drive and mount to (eg) /mnt/gentoo, cp everything from the last snapshot, chroot into it and run grub-install (copying mtab etc - just like the chroot part of the install docs). |
|
Back to top |
|
|
judepereira Apprentice
Joined: 19 Jan 2008 Posts: 179 Location: Portage, yes, somewhere out there
|
Posted: Sat Sep 05, 2009 1:50 am Post subject: |
|
|
I think you'll find simplebackup a combination of both rsync and rsnapshot. It even compresses my full 1GB backup to like 400MB. It's also has the features of full, differential and incremental backups... It has support for even not taking any specific file types for a backup. I find this an easier tool because its a one-time config and then it works like you've never imagined. Oh, and it supports various types of compression too! _________________ Jude Pereira
(http://judepereira.com) |
|
Back to top |
|
|
|