LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Advanced backup over network rsync (https://www.linuxquestions.org/questions/linux-newbie-8/advanced-backup-over-network-rsync-4175554473/)

andrifurious 09-25-2015 02:52 AM

Advanced backup over network rsync
 
Hi all, I'm pretty new to Debian and the unix world.

I need your help to run backups using debian (8.2), rsync and crontab to do scheduling.

I have about a dozen of PC/server over a network, my goal would be to make backups of the following machines (some linux some windows) using a PC with debian 8.2 and the rsync package.
Wuold be great to set up some scriptsfor rsync and then using crontab to schedule them.
I would like to perform both "full" and "incremental" backups if possible.

Thank you all for the help!

translator1111 09-25-2015 06:49 AM

Dear Andrifurius,
first step
rsync /folder source /folder target
see http://linux.die.net/man/1/rsync
tell me if you do not understand anything

second step
call crontab
crontab -u -e file
one way to accomplish your task is to put in file a script where you include the rync

third step
edit crontab to shedule the time of the backup
crontab -e
see:
http://linux.die.net/man/5/crontab
http://linux.die.net/man/1/crontab

Please tell me if you need further help.

andrifurious 09-25-2015 07:38 AM

Thank you translator1111.

1.Lets make an example:
I have the debian machine and a windows server 2008R2, i need to backup the full W2008R2 Server(C:\) on the debian machine, how should i write the rsync command?

rsynch /ip-or-name-of-w2008r2-server /debianIP-or-name/backups

is that kinda right?

2. How can i put in file a script where i include the rync?

Thank you so much.

kilgoretrout 09-25-2015 09:15 AM

Quote:

i need to backup the full W2008R2 Server(C:\)
I assume you want to be able to do a bare metal reinstall if something happens to your windows server. Windows operating systems need specialized software to do backups capable of restoring the operating system. What you are proposing won't work for that, i.e. using rsync to backup the windows OS to a debian file server. In a mixed windows/linux environment, you are typically just backing up the data on the windows system to a linux file server via samba. Then if your windows OS goes down, you can restore by reinstalling your windows OS from installation media and then restore your data from your backup.

andrifurious 09-25-2015 09:23 AM

Quote:

Originally Posted by kilgoretrout (Post 5425530)
I assume you want to be able to do a bare metal reinstall if something happens to your windows server. Windows operating systems need specialized software to do backups capable of restoring the operating system. What you are proposing won't work for that, i.e. using rsync to backup the windows OS to a debian file server. In a mixed windows/linux environment, you are typically just backing up the data on the windows system to a linux file server via samba. Then if your windows OS goes down, you can restore by reinstalling your windows OS from installation media and then restore your data from your backup.

yes thats what i'd like to do, backup full images/pc and some incremental backup of selected directory

kilgoretrout 09-25-2015 09:32 AM

You probably would be better off with something like Acronis TrueImage:

http://www.acronis.com/en-us/persona...s-key-features

andrifurious 09-25-2015 09:36 AM

Quote:

Originally Posted by kilgoretrout (Post 5425540)
You probably would be better off with something like Acronis TrueImage:

http://www.acronis.com/en-us/persona...s-key-features

thanks, i'll checkthat out. But what about copying data using a samba share over network? how can i do that?
Sorry im so newbie on linux, i apologize for that.

kilgoretrout 09-25-2015 10:41 AM

The question is so open ended that it's hard to give any practical advice but the place to start is with setting up samba on your debian file server. Books have been written about that. Here's a free online one you can take a look at:

https://www.samba.org/samba/docs/man...TO-Collection/

Once you set that up, the rest is pretty easy. The rsync script for your backup will just be something like:
Code:

#!/bin/bash
rsync <samba mount point for your windows share> <path to backup location on debian>

Then you have to set up the script to run as a cron job. The easiest way to do that is to copy the script to one of the following directories: /etc/cron.daily; /etc/cron.hourly; /etc/cron.weekly; /etc/cron.monthly. You can get more fine tuned control over when the script runs using the crontab command if you need that.

So basically, you have to learn samba configuration, a little bash shell scripting, the rsync command and possibly some nuances of of the crontab command, depending upon what you want to do. Once you have some familiarity with these areas, you can ask some better directed questions and get more helpful responses.

suicidaleggroll 09-25-2015 12:35 PM

You can't do a full system image using rsync over samba, never going to happen. rsync does not do full system images, and samba will screw up permissions and ownership so much that you'd never be able to boot from the backup anyway. If you want a full system image, then you need to use another tool.

If you want incremental and navigable backups of your files, then rsync is a fine tool, but it's not really intended for use with Windows. How do you intend to grab the Windows files? Set up a Windows shared directory, mount it with CIFS on the Linux machine, and rsync over there? Or install an ssh server on the Windows machine using something like Cygwin and rsync the directories of interest over ssh?

The former is going to be a right PITA with multiple machines, user accounts, maintaining security, etc., not to mention it's going to screw up all of your permissions. The latter is more elegant, but ssh server functionality on Windows is kind of a loose cannon in my experience.

andrifurious 09-28-2015 01:59 AM

Thank you all, i never tried to restore a full backup image, but the previous IT tech in my organization used some scripts using cifs and mounting the data on the samba storage using a debian machine. For the incremental backups no problem, it was like you said a "navigable backups of our files" but for the full image i really don't know if he ever restored once.
By the way thank you all for the help, now i have such a better idea of the solution i'm going to use.


All times are GMT -5. The time now is 02:38 AM.