Incremental Backup using tar for more than one path


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Incremental Backup using tar for more than one path
# 1  
Old 02-18-2017
RedHat Incremental Backup using tar for more than one path

Hi everyone;

I need to create a shell script for full and incremental backup purposes. for incremental backup only for one folder (test1) located in /home/test1 syntax below works fine and have no problem:
Code:
 tar -cvf /home/backup/backup-0.tar.gz -g /home/test1/test.snar /home/test

Problem is here when I want to create a backup of two different folder at the same time using on line command. for example if I want to create incremental backup for two folder (test1,test2) located in /home/test1 and /etc/test2 what would be syntax??? should I have test.snar file in both folders or what???

Thanks for your kindly helps in advanced.

Last edited by rbatte1; 02-20-2017 at 09:03 AM.. Reason: Changed ICODE tags to be CODE tags, emboldened file names and changed to upper case where required.
# 2  
Old 02-19-2017
Typically you would use one snapshot file for the whole backup instead of trying to keep a separate one for each folder within a backup. Think of the snapshot file as a record of what versions of files are within the backup, not information about the directories. Name you snapshot like your backup file and keep them together, eg:

Code:
tar -cvf /home/backup/backup-0.tar.gz -g /home/backup/backup-0.ss /home/test1 /etc/test2

Later when you come to do a level-1 backup of the same directories you would then do:

Code:
cp /home/backup/backup-0.ss /home/backup/backup-1.ss
tar -cvf /home/backup/backup-1.tar.gz -g /home/backup/backup-1.ss /home/test1 /etc/test2


Last edited by Chubler_XL; 02-19-2017 at 04:03 PM..
# 3  
Old 02-20-2017
Worked perfectly .

thanks

---------- Post updated at 02:27 AM ---------- Previous update was at 02:21 AM ----------

on more question please:

when i try restore backup using tar -xvf all will be restored in current path. you know how it works if i want to restore and overwrite each extracted file(s) and folder(s) to their own original path (where they were when we created the backup)?

thanks in advanced for your pation
# 4  
Old 02-20-2017
That behaviour is on purpose so you have the chance to do a last check before overwriting the original files.
If you cd to the top of the relative path from where you took the backup, it should overwrite on restore.
# 5  
Old 02-20-2017
Using the -P or --absolute-names when creating the archive will disable this feature.

But, as RudiC points out, it is quite painful if archives have full pathnames as it is difficult to restore files to a different location for comparison/verification purposes before overwriting the existing file(s).
This User Gave Thanks to Chubler_XL For This Post:
# 6  
Old 02-22-2017
So , if our archive contain backup from different paths better choice would be extract archive in current folder, make sure all are good and then overwrite all extracted folders manually to where they were backed up from.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Create an incremental tar

Hello, I need to create a tar file with a list of files from a directory. The directory has about 1000+ files of which I only need to create a tar ball of 150 files. The 150 files I need in the tar ball do not have common names or a common start letter. No two file names match, example: 1st... (3 Replies)
Discussion started by: babyPen1985
3 Replies

2. Homework & Coursework Questions

incremental or full backup ???

Hi. Can someone tell me if the following script that i have made is a script for INCREMENTAL BACKUP or FULL BACKUP. My teacher told me that is doing an FULL BACKUP. • find /etc /var /home -newer /backups/.backup_reference > /backups/.files_to_archive • touch /backups/.backup_reference • tar... (1 Reply)
Discussion started by: bender-alex
1 Replies

3. UNIX for Dummies Questions & Answers

incremental and full backup.. please help me

Hi, i'm new here(and a newbie) and i need some help with a project. I need to write a script for an incremental backup (this must be executed every day at 24:00) and a full backup (executed once a month) for etc/var/home directories. Can someone please help me with this? And a small explanation of... (9 Replies)
Discussion started by: bender-alex
9 Replies

4. UNIX for Advanced & Expert Users

Do incremental backup without tar files up

I'm trying to do a incremental backup for a big NFS. Since space is not an issue, I don't want to compress them or end up with a big tarball for full backup( and a series of small tarballs for incremental backup). Basically I want the TAR backup/restore functionality but not TAR files up.... (3 Replies)
Discussion started by: overmindxp
3 Replies

5. Windows & DOS: Issues & Discussions

Incremental Backup

I have a folder /root/test in a centos 5.3 system. I want to take an incremental backup of the contents of the folder in the C:\Downloads folder of a windows system present in the same lan as the linux system. What are the ways of executing this plan? Kindly help (0 Replies)
Discussion started by: proactiveaditya
0 Replies

6. Shell Programming and Scripting

Incremental backup

Hi, I would like to create a daily incremental backup of a directory with all of the files within and add a timestamp (year-month-day) to the tar.gz file. I have the following, but it doesn't backup the inside files of the directory. #!/bin/bash tar -czf... (1 Reply)
Discussion started by: agasamapetilon
1 Replies

7. UNIX for Dummies Questions & Answers

Best unix incremental backup utility?

Hello everyone. Could you please advise of what would be the best Unix (Debian 4) program for regular (daily or weekly) incremental backups? I'm not sure whether the backups will be stored on a "backup" drive on the same system or on an external "backup" system, but we would like to have a... (2 Replies)
Discussion started by: nottrobin
2 Replies

8. UNIX for Dummies Questions & Answers

incremental backup

Hi All.. i am trying to write a script which will give the incremental tar backup of all files with latest timestam. i tried with find -mmin -2 but if it takes half on hour or something to creat the tar itself, then no meaning in using the above command. so please help me to find the... (2 Replies)
Discussion started by: Usha Shastri
2 Replies

9. SCO

Incremental Backup using TAR in sco Openserver 5.0

Incremental Backup using TAR in sco Openserver 5.0 Dear all I am using sco openserver 5.0. I wanted to take backup of two folder (each 600 MB size) with lot of files. I used to take backup using tar command daily using a script. But the same takes more time. Is there any way to take backup... (0 Replies)
Discussion started by: jamcalicut
0 Replies

10. Shell Programming and Scripting

tar - incremental backup

Hello everyone! I'm trying to make incremental tar archives of a folder for an example. On the box I use is UNIX AIX installed. I tried some sample codes I found on several web pages but with no success. Don't know what I'm doing wrong. Please write some sample code to make incremental tar... (0 Replies)
Discussion started by: Funky_ass
0 Replies
Login or Register to Ask a Question