Slackware linux automated backups

I will try to show how my server have and automated way to backup daily , weekly and each month , all the important files , in order to have and smooth an quick way to restore the server in and emergency crash .I use rsync throug ssh conection.

Firts at all , I have a slackware distribution powering my server firewall in a dsl site. and acting like a apache and ssh server called “x350” black in the photo

Inside my home LAN , i have and Pentium II IBM ,with name “help” , white in the photo, acting like as backup and samba server for my family windows Pc,s.It,s a 200Gib hard disk enough for all my Photos , music and personal files-

The photo is :

Ibm server , Slackware inside,of course !

I have to setup automated ssh login fronm the server “x350″(black one) to the backup server , in my case “help”(white one):

root@x350:~# scp root/.ssh/id_rsa.pub root@help:/root/.ssh/authorized_keys

you’ll need to enter the password here

“yourpassword”

now check that all is working as expected;

root@x350# ssh help

now You don,t need to enter de password,any more
appear the following:

root@help#

You can change the “help” for you IP address , but is faster to have define “help” Ip under /etc/hosts.

In the “help” server edit and remove # in the file
/etc/inetd.conf,in order to have rsync server “on”

rsync stream tcp nowait root /usr/bin/rsync rsyncd –daemon

Restart services witch

/etc/rc.d/rc.inetd restart

Be sure with nmap that rsync server is up

manolo@help:~$ nmap localhost

Starting nmap 3.93 ( http://www.insecure.org/nmap/ ) at 2007-10-09 20:29 CEST
Interesting ports on localhost (127.0.0.1):
(The 1659 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
25/tcp open smtp
37/tcp open time
113/tcp open auth
139/tcp open netbios-ssn
445/tcp open microsoft-ds
587/tcp open submission
873/tcp open rsync

You are sure that rsync is up and running, ok , lets go to the “x350” web and firewall server.we are going to use crond.

go to /etc/cron.daily

root@x350:/etc/cron.daily#
create a file backup_x350_daily an do chmod +x backup_x350_daily

The content that works great for backup_x350_daily is

#!/bin/sh
rsync -e ssh -a –delete /etc /root /var /home root@help:/home/backup/x350/daily

This verify daily the directories /etc/ root /var and /home , and are “mirroed” againts the contents
in the “help” backup server under /home/backup/x350/daily

I also have the following files (scrips)
backup_x350_weekly under /etc/cron.weekly
backup_server_monthly under /etc/cron.monthly
That enable to recover diferent backups date.

The contents for backup_x350_weekly is:
#!/bin/sh
rsync -e ssh -a –delete /etc /root /var /home root@help:/home/backup/x350/weekly

The contents for backup_x350_montly is:
#!/bin/sh
rsync -e ssh -a –delete /etc /root /var /home root@help:/home/backup/x350/monthly

Keep in mind that instead the “help” name you can change to your personal IP
example
rsync -e ssh -a –delete /etc /root /var /home root@192.168.1.34:/home/backup/x350/daily.

I hope that it helps , and confirm that is tested and working for Slackware linux.

Leave a Reply

Your email address will not be published. Required fields are marked *