Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 05-15-2009, 12:44 PM   #1
Registered: Jul 2007
Distribution: CentOS and Slackware and Gentoo
Posts: 313

Rep: Reputation: 29
Tar: Preserve file creation/modification date

I provide backups for users on my samba server.

1. I make a tarball of the users' directory with xz compression:
tar -cJf abc.tar.xz /abc

2. I split the tarball into 650 meg. volumes:
split -b 650m abc.tar.xz abc_vol

- - - - - - -

When I re-assemble the volumes and unpack tarball, I notice that all files and directories have lost their original creation or modification date. All dates refer to the date and time in which the archive was created.

My users often rely on searching by date to recover specific items accomplished in a chronological order.

How do I preserve the file/directory creation dates when using tar?
Does it require -atime or -mtime parameters?

All recommendations greatly appreciated.
Thank you for your time.
Old 05-15-2009, 01:23 PM   #2
Senior Member
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
UNIX and Linux do not preserve the creation date/time on files. They only preserve the last access and last modification times.

man tar
donít change access times on dumped files

Are you restoring from backup often enough for your users to notice or are you being proactive? Being proactive is very good. Frequently restoring from backup often indicates a problem, possibly with user behavior. Backups should be the kind of thing that end users wonder why they are created because they never see the backups being used to restore files.

Last edited by stress_junkie; 05-15-2009 at 01:26 PM.
Old 05-15-2009, 04:50 PM   #3
Registered: Jul 2007
Distribution: CentOS and Slackware and Gentoo
Posts: 313

Original Poster
Rep: Reputation: 29
Thanks for the quick reply, Mr. Junkie. :-)
It appears there's nothing I can do to preserve creation/modification times other than use the dd command to copy the partition.

The answer to your question is: trying to be proactive in case of the worst. Oh well, can't solve every user's problem.

Thanks again, your help is greatly appreciated.


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
Get file modification date/time in Bash script cmfarley19 Programming 16 04-15-2015 07:25 PM
file creation date prashantbhushan Linux - General 2 05-29-2007 09:32 AM
Heeelp! How to preserve file date modification attribute Slackovado Slackware 1 03-30-2005 10:36 AM
ls -al file creation date blackzone Linux - Newbie 2 08-23-2004 02:31 AM
File Modification Date Comparison MadTurki Programming 7 03-08-2004 05:02 PM > Forums > Linux Forums > Linux - Software

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration