Results 1 to 7 of 7
I am new to Linux. I am using tar to backup my emails to a server. I would like to automate this process to routinely backup my emails periodicly, however, ...
- 01-07-2010 #1Just Joined!
- Join Date
- Jan 2010
- Posts
- 3
tar backup file keeps growing.. please help
I am new to Linux. I am using tar to backup my emails to a server. I would like to automate this process to routinely backup my emails periodicly, however, i keep running into a problem:
I start in the dir I would like to create the tar file (dir size = 240MB). I enter the following command
tar cf bup.mail.llc.tar "/Users/d/Library/Mail/INBOX.mbox/Messages"
file size = 234MB
When I would like to backup my emails into the previously created tar file I use the following command:
tar uf bup.mail.llc.tar "/Users/d/Library/Mail/INBOX.mbox/Messages"
file size = 462MB
The backup command works, except the size of the original tar file grows, around twice the size. When I extract the updated tar file (file size = 462MB), the unarchived file is 240MB the same size as the original directory.
Why does the size of the tar keep growing each time i perform 'tar uf'?? I don't understand this
- 01-08-2010 #2
I'm not sure about your problem , this tip might be useful - since you are not unique filename-
while creating tar file ,try and use timestamp in the filename
like logs_07_01_2009.tar that might resolve this issue.
log.`date +%T`.tar- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 01-09-2010 #3Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,970
This is because the tar file is in the same directory you are backing up, and since it is found after the other files, it has already gotten to the size of the rest of the directory tree. Since it is also backing itself up, voila - twice the size!

So, make sure that the target file is placed somewhere else than in the tree you are backing up. I've had this same problem in the past, and had to give myself a big Homer Simpson forehead slap - Doh!Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 01-09-2010 #4Linux User
- Join Date
- Nov 2009
- Location
- France
- Posts
- 292
Not sure.because the tar file is in the same directory
The archive keeps growing.by n times the original size.Code:cd /tmp tar -cf t.tar /somewhere_else ls -l tar -uf t.tar /somewhere_else ls -l tar -uf t.tar /somewhere_else ls -l
The content of the archive is repeated n times.Code:tar -tf t.tar
Qué passa ?
- 01-09-2010 #5Linux User
- Join Date
- Nov 2009
- Location
- France
- Posts
- 292
It seems that the -u option would append anyway. It doesn't seem to care if a file is the same or newer.Code:man tar ... -u only append files newer than copy in archive ...
I haven't seen any option to refresh files.
Even with
newer files than the archive's last change date would still be appended and not refreshed in the archive.Code:tar -uf --newer-mtime=$(stat -c %z t.tar | awk '{print $1}') t.tar /somewhere_else
- 01-09-2010 #6Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,970
I was going to quote the man page(s) to you, but you beat me to it yourself!
Anyway, I would presume that you are sure that nothing has modified any of the files in the archive? Also, I don't know if tar uses the modification dates of the files in the archive, or the date on the archive for the 'u' option. Are you running tar on the same machine as the directory tree? Or is it a remotely mounted volumn?
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 01-09-2010 #7Linux User
- Join Date
- Nov 2009
- Location
- France
- Posts
- 292
It's on the same machine, no remote data.
I considered the archive last change date as a reference date because I presume newer files would be of interest as from that date, the last archival date, assuming the archive has not been altered by any other process. We could use a date saved elsewhere.
But my understanding of tar now is that it is not built with the idea of refreshening files in an archive, rather with that of doing continuous incremental archival, so that a file at any archival step can be retrieved. How to do such extraction within a script? Could not figure out. Opening the archive through GUI with fileroller or xarchiver does show the different versions of the same file. But this is not adequate for performance which a script usually gives.
However, because same files, modified or not, are packed in at every archival, compressing with bzip2 is very efficient to reduce file size.
I think we should not consider tar as an archival utility where files are supposed to be refreshed with newer ones.


Reply With Quote