NavigationUser loginSpam?See spam posts on this site? If so, please don't reply to the spam! Instead, just report the URL to the webmaster. |
Newbie dares to ask: how do I backup my dedicated server?Dear all, Don't ask me why I have a dedidacted Debian server running DirectAdmin without knowing much about Debian. Some friends did this for me, but they all got married and have children now . My dedicated server resides in Germany. The company who runs it, has send me an IP for a backup server, xx.xx.xxx.xxx. 1. What do I type after the prompt to backup the whole server? Don't expect me to understand anything more then a step by step instruction ;) Henk (1 vote) |
best to ask your friends -
If you can still contact them by email it is better if you ask the people who set this up. I'm not sure what you mean by a backup server - some people call a 'failover machine' a 'backup server'. Otherwise the ISP must have some web pages which tell you about their particular backup system and how to use it. They need to supply you instructions because there are so many types backup software available out there. Is it IBM's "tivoli", Veritas' software, or any of about 5 or so freeware software? Then again the 'backup server' might just make use of 'rsync' to mirror the original. Even on WinDos we can't give you a definite answer unless you can tell us much more about the backup system being used.
Specs
Here is my config:
http://hetzner.de/rootserver.html
It's the DS3000, running on Debian.
Re: how do I backup my dedicated server?
You don't give many details on what type of backup you need. Does it have to be bootable (e.g. a bootable image)? Can you get by with a series of tarballs that you have to upload and extract in case of a disaster? How frequently will this backup need to be done?
For a non-bootable one-time copy, a simple "scp -prC :/ LocalTargetDir" will work -- but that's something that you won't want to do daily or weekly. :-)
The HowTo Forge has a section on various backup techniques that you may find useful. Also, this link contains some reviews on backup programs/techniques.
My last server crashed
My last server crashed and I had no backup.
I want to make an image of the server, how do i do that? And how do I restore it?
Re: My last server crashed
Do you have physical access to your server? If you don't have easy access, a bootable CD will be more trouble than it's worth.
I tend to use two strategies of backing up remote servers that I don't have easy access to:
1) I do a full system backup using rdiff-backup. (You'll see that documented in the HowToForge link above.)
2) If you think of your server in 2 parts -- the Debian portion and the other stuff that you tweak/install (everything from web sites to MySQL databases, to customizing Debian files, to third party apps you install).
By thinking of it in these two ways, you can do a "restore" (actually a rebuild) pretty quickly and easily.
Part #1 -- the Debian OS -- can be easily managed. The "dpkg" has a command line switch "--get-selections" which you can redirect into a file (I put mine in /etc). During a rebuild, you can just do a "dpkg --set-selections < /etc/dpkg_selections.txt" and a big update to reinstall all the Debian software you had on the system before the crash.
Of course, you probably edited some of Debian's config files. Thus, backing up all of /etc (e.g. "tar cjvvf /backups/servername_etc.tar.bz2 /etc") is essential.
For all of the rest of the server -- part #2, I make a tar command similar to the above for everything I install, each web site that is created, etc. The only tricky thing is to do MySQL dumps and/or hotcopies for all of the databases.
What I do is to create all of these tarballs -- either with a cron job or via ssh -- in a subdir (e.g. /backups) and then use scp to copy them off the machine and delete them.
Why 2 separate methods? It's overkill, but I'm paranoid. The tarball method also makes it easy to restore a particular subdir or web site since the tarballs get timestamped when they're created.
Let me know if you need any shell script snippets to see what I mean...
Re: My last server crashed
I swear by this method. This method provides a full snapshot of your file system at different times. For example, during the past week, you can have 7 daily shapshots. During the past month, you can have four or five weekly snaphsots. During the past year, you can have snaphots of each month. The shapshots are not compressed, but through clever use of hardlinks, you may end up using only slightly more disk space than your installation. That is, even though you have all of these shapshots, the sum total of the backup disk space is only a little greater than your disk usage on your server. The exception to that is if your files change quite often-- then alot of extra disk space is required.
On my home computer, my files use about 95 GB, and my backup (with daily, weekly, and several monthly snapshots) uses 120 GB.
Below are the scripts I use to perform this backup. To restore, you just copy the files back into place. I backup to a second hard disk, but rsync can do remote backups over ssh.
/etc/cron.daily/daily-backup:
#!/bin/bash
rm -rf /backup/daily.7
mv /backup/daily.6 /backup/daily.7
mv /backup/daily.5 /backup/daily.6
mv /backup/daily.4 /backup/daily.5
mv /backup/daily.3 /backup/daily.4
mv /backup/daily.2 /backup/daily.3
mv /backup/daily.1 /backup/daily.2
mv /backup/daily.0 /backup/daily.1
echo 'Doing rsync'
/usr/bin/rsync -a --delete --exclude=/backup --exclude /proc --exclude /sys \
--exclude=/backupWin \
--exclude /home/mdfulk/hdtv --exclude /home/mdfulk/TivoRecordings \
--exclude *.mpg --exclude *.nuv --exclude *.iso --exclude /var/chroot \
--link-dest=/backup/daily.1 / /backup/daily.0/
mkdir /backup/daily.0/proc
mkdir /backup/daily.0/sys
/etc/cron.weekly/weekly-backup:
#!/bin/bash
rm -rf /backup/weekly.5
mv /backup/weekly.4 /backup/weekly.5
mv /backup/weekly.3 /backup/weekly.4
mv /backup/weekly.2 /backup/weekly.3
mv /backup/weekly.1 /backup/weekly.2
mv /backup/weekly.0 /backup/weekly.1
cp -al /backup/daily.7 /backup/weekly.0
/etc/cron.monthly/montly-backup:
#!/bin/bash
rm -rf /backup/monthly.5
mv /backup/monthly.4 /backup/monthly.5
mv /backup/monthly.3 /backup/monthly.4
mv /backup/monthly.2 /backup/monthly.3
mv /backup/monthly.1 /backup/monthly.2
mv /backup/monthly.0 /backup/monthly.1
cp -al /backup/weekly.5 /backup/monthly.0
copy and paste
http://www.howtoforge.com/dedicated_server_backup_restore_systemimager
Matt's modification
If You want to backup specified folder as I wanted to backup whole /mnt, You need just change this code to:
/usr/bin/rsync -a --delete --exclude=/backup --exclude /proc
--exclude /sys \
--exclude=/backupWin \
--exclude /home/mdfulk/hdtv --exclude /home/mdfulk/TivoRecordings \
--exclude *.mpg --exclude *.nuv --exclude *.iso --exclude /var/chroot \
--link-dest=/backup/daily.1 / /backup/daily.0/
to:
/usr/bin/rsync -a --delete --exclude=/backup --exclude /proc --exclude
/sys \
--exclude=/backupWin \
--exclude /home/mdfulk/hdtv --exclude /home/mdfulk/TivoRecordings \
--exclude *.mpg --exclude *.nuv --exclude *.iso --exclude /var/chroot \
--link-dest=/backup/daily.1 /mnt /backup/daily.0/
Thanx Matt!