LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 08-25-2015, 03:06 PM   #1
sibleytr
LQ Newbie
 
Registered: Jul 2015
Distribution: Ubuntu 16.04.2
Posts: 21

Rep: Reputation: Disabled
How do I create an incremental backup?


How do I create an incremental backup of my windows server?

Currently running the following script for a full back up of our Windows file server. Looking over available documentation I having a hard time wrapping my head around how to accomplish my desired task using linux and/or rsync specifically.

Current Script
Code:
    rsync -arv -h --progress $srcSrvPth $sanBkUpPth/$srcSrvPth
Next part of the script's evolutionary development is to create incremental backups using a Day of Week folder…and previous data is eliminated.

Code:
  #Day of Week
 incDate=”$(date +’%w’)”

    rsync -arv -h --progress <missingCodeHere> $srcSrvPth $sanBkUpPth/_Inc/$incDate/
Being more familiar with Windows ROBOCOPY we would us the "-m" switch to copy and clear the file's "archive" attribute. What would be the superior Linux resolution?
 
Old 08-25-2015, 03:54 PM   #2
Ihatewindows522
Member
 
Registered: Oct 2014
Location: Fort Wayne
Distribution: Ubuntu 16.04 LTS
Posts: 616
Blog Entries: 2

Rep: Reputation: 166Reputation: 166
As far as I can tell, it seems you're after duplicity.

This should be a good guide to get you started:
https://www.linux.com/learn/tutorial...with-duplicity
 
Old 08-25-2015, 06:42 PM   #3
joe_2000
Senior Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 1,016

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
I am not exactly sure what you mean by day of week folder, but there is a very neat tool called storeBackup.

It allows you to create incremental backups, the frequency of which can be freely configured. So if you ran the script daily, you could configure storebackup to keep one backup for each of the last seven days, then one that is no older than two weeks, another one that is no older than two months, then 6 months, one year etc... You get the picture.

The cool part is that it is using hard links to duplicate files that have not changed between different backups. That means, that if you did not change anything between today's and yesterday's backup, the two backups will not consume more hard disk space than just one. However, each of them are independent, so you can delete either one and the remaining one is still intact.

Have a look at the project homepage for more info, but store backup is also included in many distro's repos.
 
Old 08-26-2015, 10:51 AM   #4
Ihatewindows522
Member
 
Registered: Oct 2014
Location: Fort Wayne
Distribution: Ubuntu 16.04 LTS
Posts: 616
Blog Entries: 2

Rep: Reputation: 166Reputation: 166
Quote:
Originally Posted by joe_2000 View Post
I am not exactly sure what you mean by day of week folder, but there is a very neat tool called storeBackup.

It allows you to create incremental backups, the frequency of which can be freely configured. So if you ran the script daily, you could configure storebackup to keep one backup for each of the last seven days, then one that is no older than two weeks, another one that is no older than two months, then 6 months, one year etc... You get the picture.

The cool part is that it is using hard links to duplicate files that have not changed between different backups. That means, that if you did not change anything between today's and yesterday's backup, the two backups will not consume more hard disk space than just one. However, each of them are independent, so you can delete either one and the remaining one is still intact.

Have a look at the project homepage for more info, but store backup is also included in many distro's repos.
That's what duplicity with Deja Dup does. Welcome to the conversation.
 
Old 08-26-2015, 11:25 AM   #5
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138
You can also do it with standard old rsync using the --link-dest flag.

Something like the following will give you incremental backups at whatever frequency you run the script:
Code:
symbackup="/path/to/backup_latest"
prevbackup=$(readlink "$symbackup")
currbackup="/path/to/backup_$(date +Y%m%d_%H%M%S)"

rsync -aAXv --link-dest="$prevbackup" /* $currbackup/ --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/var/run/*,/var/lock/*,/lost+found,/path/to/*}
if [[ $? -eq 0 ]]; then
   rm -f "$symbackup"
   ln -s "$currbackup" "$symbackup"
fi
 
1 members found this post helpful.
Old 08-26-2015, 12:13 PM   #6
joe_2000
Senior Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 1,016

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
Quote:
Originally Posted by Ihatewindows522 View Post
That's what duplicity with Deja Dup does. Welcome to the conversation.
Does duplicity allow to recover data without having duplicity installed?
 
Old 08-26-2015, 12:54 PM   #7
Ihatewindows522
Member
 
Registered: Oct 2014
Location: Fort Wayne
Distribution: Ubuntu 16.04 LTS
Posts: 616
Blog Entries: 2

Rep: Reputation: 166Reputation: 166
No. Apparently (after some digging) neither does storeBackup.

http://manpages.ubuntu.com/manpages/...Recover.1.html
 
Old 08-26-2015, 03:23 PM   #8
joe_2000
Senior Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 1,016

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
Quote:
Originally Posted by Ihatewindows522 View Post
No. Apparently (after some digging) neither does storeBackup.

http://manpages.ubuntu.com/manpages/...Recover.1.html
Not trying to turn this into a "my tool is better" thread, at the end I think it's good to suggest several options to answer a question so the OP is aware of the options.

That said, the fact there is a "storeBackupRecover" does not mean that you actually need it.

I've been using storebackup for years now, and simplicity is my highest priority in the choice of backup tools. Storebackup creates normal directories, and optionally compresses the contents (using standard utilities). storeBackupRecover might provide additional features / convenience in some circumstances, but is not needed anymore than if you had created the backup with rsync. In fact I've never used it so I can't tell exactly what you'd need it for.

I have not used duplicity, so I cannot speak to it, but if it creates a non-standard format that would be a show-stopper for me. The day I loose a file and want to recover it, I just want to open the backup directory and grab it there.
 
Old 08-27-2015, 10:15 AM   #9
sibleytr
LQ Newbie
 
Registered: Jul 2015
Distribution: Ubuntu 16.04.2
Posts: 21

Original Poster
Rep: Reputation: Disabled
Thanks everyone for your post. Given that this is an exercise in developing a better understanding of Linux, suicidaleggroll your post is most appreciated. As time and needs develop will probably start looking into the more formal apps.
Thanks again.


Code:
symbackup="/path/to/backup_latest"
prevbackup=$(readlink "$symbackup")
currbackup="/path/to/backup_$(date +Ym%d_%H%M%S)"

rsync -aAXv --link-dest="$prevbackup" /* $currbackup/ --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/var/run/*,/var/lock/*,/lost+found,/path/to/*}
if [[ $? -eq 0 ]]; then
   rm -f "$symbackup"
   ln -s "$currbackup" "$symbackup"
fi
 
Old 08-27-2015, 10:24 AM   #10
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by sibleytr View Post
As time and needs develop will probably start looking into the more formal apps.
Have a look at http://www.funkytwig.com/blog/funkybackup
 
  


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
LXer: MySQL Incremental Backup - Point In Time Backup and Recovery of InnoDB and MyIsam Databases LXer Syndicated Linux News 0 05-27-2015 06:24 PM
LXer: How to create a secure incremental offsite backup in Linux with Duplicity LXer Syndicated Linux News 0 08-08-2013 03:20 PM
incremental backup mahmoud Linux - Newbie 3 11-28-2008 05:31 AM
incremental backup jdeeptir Linux - Newbie 5 05-24-2008 07:51 PM
create folder-hierarchy for "revolutionary" (?) incremental backup linusneumann Linux - Software 1 04-23-2007 05:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:22 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