Avatar of futureman0
futureman0
 asked on

Using rysync to backup linux machine to windows network file share

I need to come up with a method of backing up an linux (Centos 5.11) machine to a windows network file share. I'm very much not a linux admin, so I wanted to see what some of the experts out there would suggest doing.

For one of the linux machines that I need to backup the data is located at /data and the network share is already mounted to /mnt/filesharename. I want a cron job to run daily that will automatically create a folder on /mnt/fileshare using the date as the folder name (creating a log file in the same location), and copy everything for the first run, and then only files that changed (incremental) going forward. The files for back up don't necessarily need to be compressed. The folder created using the date name would be kept for 5 years.

The closet article about doing this I've found is here, http://www.marksanborn.net/howto/use-rsync-for-daily-weekly-and-full-monthly-backups/, but there are some difference in what is done in the link and what I want to do.

Any suggestions of ways to use rsync to accomplish this?
LinuxStorage Software

Avatar of undefined
Last Comment
gheist

8/22/2022 - Mon
gheist

RSYNC transfers file differences, you need to run something like cwrsync on windows site to make it save network bandwidth. Copying over to share saves nothing over simple file copy.
serialband

You can follow the instructions in the article and name your folders with the date command in your cron calls.

If you're making full backs, rsync isn't going to help you.  It will actually slow you down when you make each first copy.

If you're doing a lot of data, and saving it long term, I suggest using rsnapshot to save some space.  It would also be a bit easier to backup to a linux file server than a windows one, because you can then write a script to easily create hard links to each folder with the correct dates that you want for the backup folder instances.  So you would create a snapshot each day and you'd just use the ln command to create a link, with the date to each snap shot folder.

rsnapshot makes use of rsnyc and basically deduplicates the data each day.  It makes use of the previous day's saved snapshot and copies only the differences.  It should be more space efficient than rsync as described by the post.  As gheist mentions, you'll also need to run cwrsync server on Windows to benefit from the rsync.  http://www.rsnapshot.org/faq.html

http://www.rsnapshot.org/
gheist

If you use rsync to sync files to share it will actually read back all the destination files and write only the changes, i.e transfer more data over share than blind copy.
Your help has saved me hundreds of hours of internet surfing.
fblack61
futureman0

ASKER
Thanks all! I appreciate all of the suggestions. I've been playing around with using rsnapshot as serialbond suggested.  I found this article (http://how-to.linuxcareer.com/guide-to-rsnapshot-and-incremental-backups-on-linux) and have tried out a couple of different scenarios.

Using that article as a base, what type of configuration would you suggest would accomplish the following:

* Using rsnapshot to backup from linux host /data to windows file share at /mnt/fileshare. Then the windows file share is backed up by Symantec Backup Exec to disk.
* Each snapshot would be kept for up to 5 years (taken once per day), the purpose being that any data generated on this computer from a scientific instrument needs to saved per retention rules for 5 years even if it's deleted off the machine.
* Minimizing the size of each snapshot, only copying what has changed from the previous day

I've tried setting the daily interval to day to 1825 and hourly, weekly, monthly to 1. Then run manually rsnapshot daily and daily.0, daily.1, daily.2 .... and so on are generated. What I've found is that in each snapshot folder has all the files, not just the ones that have changed. I'm a bit unclear what hard links are, so that may have something to do with it.  

As rsnapshot renames the different snapshot folders when the next one is made, what could I put in rsnapshot.conf that would put the snapshot in a folder (within daily.1 .2 .3 ...) using the date when it was made?
ASKER CERTIFIED SOLUTION
serialband

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.