LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 08-18-2004, 11:20 PM   #1
jonr
Senior Member
 
Registered: Jan 2003
Location: Kansas City, Missouri, USA
Distribution: Ubuntu
Posts: 1,040

Rep: Reputation: 47
Getting date format right in tar incremental backup


I'm trying to learn to do both full and incremental tar backups. Here is the full backup script I wrote, after studying some examples here and there:
----------------------------------------------------------
#!/bin/sh

LASTFULL=`date +%F% %T`
echo $LASTFULL > /store_1/tar_bkp/last_full_backup_date

tar -c -v -z -f /store_1/tar_bkp/full_backup.tgz /home/jon/Documents
----------------------------------------------------------

That works just fine. Then I tried an incremental-backup script, here:
----------------------------------------------------------
#!/bin/sh
LASTFULL="`cat /store_1/tar_bkp/last_full_backup_date`"
tar -c --newer $LASTFULL -v -z -f /store_1/tar_bkp/incremented_backup.tgz /home/jon/Documents
echo $LASTFULL
-----------------------------------------------------------
and no matter what date format I try (referring to the GNU tar webpage for acceptable formats, and also trying some that turned out no good), the result is always a full backup
just like the first script produces, within a few bytes. (I'm experimenting with just one large directory to save time, and later I will backup all my files.)

What date format do I need to specify the year, month, day, hour, minute, and second?
And why, when I experiment with a supposedly OK date format, does the result still equal
a full backup?

Many thanks in advance.
 
Old 08-19-2004, 01:12 AM   #2
320mb
Senior Member
 
Registered: Nov 2002
Location: pikes peak
Distribution: Slackware, LFS
Posts: 2,577

Rep: Reputation: 47
http://www.linuxquestions.org/questi...ckup+your+data
 
Old 08-19-2004, 10:02 AM   #3
jonr
Senior Member
 
Registered: Jan 2003
Location: Kansas City, Missouri, USA
Distribution: Ubuntu
Posts: 1,040

Original Poster
Rep: Reputation: 47
Thanks, 320mb. I saved that page for further study.

However, unless I'm missing something in reading it, it doesn't address the incremental backup property that's stumping me. My full backup works fine. But the ones with the incremental switch "N" (I also tried --newer and --after-date with same result) also produce, not incremental (smaller) tar files, but the same full-sized one as without the switch. Even when the date format seems to be OK for tar. I can only guess I'm doing something wrong when I specify the date. But I've re-read the manual and GNU website pages several times and can't see where I'm going wrong.
 
Old 08-19-2004, 10:53 AM   #4
jonr
Senior Member
 
Registered: Jan 2003
Location: Kansas City, Missouri, USA
Distribution: Ubuntu
Posts: 1,040

Original Poster
Rep: Reputation: 47
Quote:
Originally posted by jonr
But I've re-read the manual and GNU website pages several times and can't see where I'm going wrong.
OK, I got the date format to work, and the incremental backup to be just that.

What I needed was a backslash to put a literal space in the date. The manual probably assumes every reader knows that and doesn't mention it. (This kind of assumption is REALLY common...)

So it turns out the date-file creation that works, in the form I wanted it, goes:

LASTFULL=`date +%F\ %T`

Unfortunately (or not), in the process of getting to this point, I also read that it's not recommended to make incremental backups this way! Sometimes certain files are not detected etc.

Back to the drawing board. At least I know how to specify dates for tar now.
 
  


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
incremental backup using tar eaglegst Linux - Software 9 02-01-2009 06:00 PM
Incremental Backup (tar command) maginotjr Slackware 4 07-21-2005 02:04 AM
Incremental Backup Utilities Matir Linux - Software 2 03-16-2005 10:34 PM
Incremental backup script - Tar problem joshheald Linux - Software 1 09-28-2004 11:02 AM
incremental backup reaky Linux - Software 3 03-10-2004 04:02 PM


All times are GMT -5. The time now is 02:14 PM.

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