LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-15-2013, 02:38 PM   #1
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 508

Rep: Reputation: 29
Wink Some Rsync questions...


hi guys,

dont really know where this belongs

i have a windows server 2008 r2 that i want to backup using rsync
i have cygwin installed and am starting to do this...just have a few questions

i want to backup with rsync to 5 external hard drives...switching them every day...will Rsync write to the different drives as long as the drive letter is the same? does it only backup the changes by default...would it also only save the changes to say a mail PST file?

i would like to have it append to any one of the 2tb drives in at the time with no problem...also want to run a Rsync backup over the internet to another linux box in the office 20km away...i know there are numerous rysnc tutorials....just want to get these nagging questions out the way.

does this seem feasible???
 
Old 10-15-2013, 08:13 PM   #2
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,992

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
well most of your questions can be directly answered via the man page for rsync, but here is some other info.

as for writing to the external HDDs, that will depend on your script. yes when the drive letters in MS change if you have the script hard coded to a specific letter and that letter is not found, just like anything in the MS world it will fail.

if you use the -a flag you will "archive" data. this is an append by default. without the --delete flag it will never remove files on the backup that have been removed from the source.

before you run 2TB via WWW highly consider physically performing the data transfer LOCAL... think about your upload speed and do the math for how long it will take to write 2TB via the web.

typically when I am setting that up the first rsync I run is to either the system physically in the same LAN, or to an external drive that i can move physically to the "remote" server to transfer the initial data. as long as you are not storing multiple copies of the same data (that is a good idea btw) you will only need to move the data once and rsync will then just append the data via the WWW without issue or massive bandwidth consumption. i typically keep 7 days worth of backups on my backup server. just put them in day of the week folders ...

good luck.
 
Old 10-16-2013, 04:44 PM   #3
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 508

Original Poster
Rep: Reputation: 29
thanks for that...i will start reading the man pages!!!
so i could copy everything i need onto a hard drive than move that data to my other linux box in the other office
then rsync will only save changes...thats sweet!!!
and i could even have that save a copy everyday to other external drives on the linux box

thanks again....got a lot of reading to do,,,
 
Old 10-17-2013, 09:12 PM   #4
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,992

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
yeah rsync is really powerful. also dont be afraid to hit up google and look for rsync examples. i have my web site rsync to both my backup server here at the house and to 2 other servers across the country all via cron.

i have all of the laptops in my household rsync to my backup server manually.

i use basically the same rsync script in both cases.
 
Old 10-17-2013, 09:25 PM   #5
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726

Rep: Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706
Hi,

there are many existing solutions for making backups - many of which (can) use rsync as a backend. Instead of reinventing the wheel why not use something that is already known to work. Eg backuppc.

Evo2.
 
Old 10-21-2013, 03:34 PM   #6
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 508

Original Poster
Rep: Reputation: 29
Hi Evo,

dont you think it would be better for me (as a Linux noob) to learn to write rsync, as well as other scripts?
or would my time be better suited elsewhere...thanks for your reply

sn
 
Old 10-21-2013, 04:57 PM   #7
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,992

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
what ever floats your boat. for me many of the pre-packaged backup tools out there were not available for me when i first started learning to write basic scripts and how to use rsync. for me it is faster and easier just to write a simple backup rsync script.

a good idea might be to play with both options so you can choose what is better for you and your solution requirements.
 
Old 10-21-2013, 08:11 PM   #8
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726

Rep: Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706
Hi,

Quote:
Originally Posted by sigint-ninja View Post
dont you think it would be better for me (as a Linux noob) to learn to write rsync, as well as other scripts?
No, not better. Yes, it is good to learn to write scripts and to use rsync, but backups are very important, and I would not trust my backups to a script hacked together by a noob and nor would I suggest should you.

Quote:
or would my time be better suited elsewhere...thanks for your reply
You're likely to learn plenty just by configuring whatever backup system you choose.

Anyway as lleb says, choose what you think is best for you, but in doing so, be sure to make an informed choice.

Cheers,

Evo2.
 
Old 10-22-2013, 01:43 PM   #9
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 508

Original Poster
Rep: Reputation: 29
was looking at a few tools...from other posts too.....not many support windows server 2008 r2
i have cygwin installed on my windows server and have a shell running...so i think i will run a script/s

are rsync scripts just bash scripts? i could use vim to write the script and save it with a script extension?
im practicing writing scripts on my centos box...not the production server.

thanks

Last edited by sigint-ninja; 10-22-2013 at 02:08 PM.
 
Old 10-22-2013, 08:40 PM   #10
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,992

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
Quote:
Originally Posted by sigint-ninja View Post
was looking at a few tools...from other posts too.....not many support windows server 2008 r2
i have cygwin installed on my windows server and have a shell running...so i think i will run a script/s

are rsync scripts just bash scripts? i could use vim to write the script and save it with a script extension?
im practicing writing scripts on my centos box...not the production server.

thanks
yes a script is just a simple BASH script.

here is an example of a backup script that I use on all of my laptops with some personal data redacted.

Code:
$ cat /usr/bin/Backup 
#!/bin/bash

### Jan 12, 2013
### adding excludes.txt to ignore directories like
### .wine, .cache, etc...

### Jan 5, 2013
### Setting up for daugher to backup to sparky daily, or
### manually.  

### Jan 5, 2013 added ~/.ssh/config to the system for pre-
### defined ports and protocols as follows:

#	Host	foo.nu
#		Port		22222
#
#	Host	*
#		Protocol		2
#		ForwardAgent		yes
#		ForwardX11		yes
#		ServeraliveInterval	30
#		ServerAliveCountMax	5
#		TCPKeepAlive		yes

### Then set the permissions to 644 on that file.  This tells
### ssh to use the above port when contacting foo.nu.
### As a results modified the variables and rsycn command below.

### Dec. 7, 2012 modified to add 2nd location for backup
### The second computer is my Intel iMAC

### RSYNC backup between web server and sparky

### Dec. 4, 2012 edited script to run to old sparky
### located at my home.  This will change soon as we
### will be relocating to friend's home.

###########################################################
### Created by Ray Brunkow with help from Bryan Smith
#
# Copyright (C) 2012 Raymond L. Brunkow.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 or version 3 of the
# license, at your option.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##########################################################

### Setting Variables
#####################################
dtstamp="`date +%F-%A-%H.%M.%S `"
dow=`date +%A`
HOMEDIR="$HOME"
PWD=`pwd`
log=${PWD}/logs/`date +%Y-%m-%d-%A`-rsync.log
RUSER=user
RHOST=server
RDIR=/path/to/save/data/

### Checking for logs directory, if not there then create it
#####################################

[ ! -d "${PWD}/logs" ] && mkdir -p ${PWD}/logs >> /dev/null 2>&1

rsync -aviS --exclude-from=${HOMEDIR}/excludes.txt ${PWD}/ ${RUSER}@${RHOST}:${RDIR}/${dow}/ >> ${log} 2>&1

### Clean up log directory to only keep 16 days worth of logs

find ${PWD}/logs/*.log -mtime +15 -exec rm '{}' \;

exit
feel free to modify that script as you require and ask as you need. its a nice simple little backup script for home directories.
 
Old 10-24-2013, 01:33 AM   #11
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 508

Original Poster
Rep: Reputation: 29
thanks for that!!! will do
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync questions jsteel Linux - General 2 07-05-2010 09:52 AM
rsync questions crazy8 Linux - Newbie 11 04-05-2008 12:59 PM
Rsync Questions progrock Linux - Networking 2 11-14-2007 11:41 AM
rsync questions slack66 Linux - General 4 11-05-2005 12:31 AM
rsync questions csross Linux - General 3 06-25-2004 10:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration