LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 04-11-2011, 03:47 PM   #1
trucutu
LQ Newbie
 
Registered: Apr 2011
Posts: 16

Rep: Reputation: 0
rsync, crontab and backing up files


This is a quick one, I don't have any problems yet, I just want to check that this is going to do what I think it is. I added the line
Code:
00 01 * * * rsync -avz --delete /local-storage /mnt/usbackup
to my crontab file, am I to understand that this will backup /local-storage to my external HD mounted on /mnt/usbackup every day at 0100?

Also, will rsync ignore files that haven't changed? Or will it copy everything every day regardless?

Thank you!
 
Old 04-11-2011, 04:13 PM   #2
sibe
Member
 
Registered: Apr 2011
Location: Jakarta, Indonesia
Distribution: Fedora, CentOS
Posts: 122

Rep: Reputation: 21
Hi,

well, yes your crontab will incrementally-backup /local-storage to /mnt/usbackup. Just make sure your external HD really mounted on /mnt/usbackup, 0100 oclock every day. Rsync will leave any unchanged dir/file untouched.

And if you didn't plan to actually watch you rsync in action, I suggest you to exclude the -v option, as it will verbosely spit out the process to the monitor when rsync got executed.


----
sibe
 
Old 04-11-2011, 04:18 PM   #3
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,053

Rep: Reputation: 484Reputation: 484Reputation: 484Reputation: 484Reputation: 484
Use -auz instead of -avz as rsync option.
Adding -u means just the updated files.
Removing -v means rsync output is not verbose, you probably don't want that.

You have to be sure that the USB device is mounted, otherwise you will be backing up you entire disk to the mount point which then IS your disk. Results are not pretty. Refer to this post of mine:
http://www.linuxquestions.org/questi...3/#post4232330
I call my script from cron instead of running rsync from cron.

jlinkels
 
Old 04-11-2011, 04:27 PM   #4
sibe
Member
 
Registered: Apr 2011
Location: Jakarta, Indonesia
Distribution: Fedora, CentOS
Posts: 122

Rep: Reputation: 21
One more thing, I don't see any particular advantages of doing a -z (compress) option in a locally mounted dir. With a huge file to backup, this option tends to be *really* slow.


----
sibe
 
Old 04-11-2011, 06:17 PM   #5
trucutu
LQ Newbie
 
Registered: Apr 2011
Posts: 16

Original Poster
Rep: Reputation: 0
Ok

I have properly mounted the external drive and added it to the fstab file so it gets mounted automatically.

So as you guys comment, compression doesn't really give me anything so how about this

Code:
00 01 * * * rsync -avu --delete /local-storage /mnt/usbackup > backup.log
and I'll ahver a log of the last run.

This is helpful thanks!
 
  


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync keeps backing up same folders over and over Red Squirrel Linux - Server 9 01-04-2009 11:37 PM
Rsync not backing up MySQL cabron Linux - Server 3 12-26-2007 07:56 AM
backing up to the net with ftp or rsync rblampain Linux - General 2 04-27-2006 12:40 AM
rsync and backing up danimalz Linux - Software 12 10-24-2005 12:01 PM
RSync or another way? Backing Up Off-site. kemplej Linux - Software 0 08-19-2004 04:55 PM


All times are GMT -5. The time now is 12:16 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration