Using tar --atime-preserve

  • Follow


I can=92t seem to preserve the atime of files when archiving and
extracting.  Can somebody show me what I=92m doing wrong?  Here are the
steps I=92m using:

$ tar =96version
tar (GNU tar) 1.20

$ uname =96a
Linux blahHostName 2.6.5-7.283-smp #1 SMP Wed Nov 29 16:55:53 UTC 2006
x86_64 x86_64 x86_64 GNU/Linux

$ pwd
blahDir/

$ touch -t 02010000 blah

$ ls =96lu blah
-rw-rw-r--  1 <user> <group> 0 2008-02-01 00:00 blah

$ tar -jcf blah.tz2 blah --atime-preserve

$ cd ..

$ tar -jxf blahDir/blah.tz2

$ ls =96lu blah
-rw-rw-r--  1 <user> <group> 0 2008-11-08 10:32 blah
0
Reply eychun (5) 11/8/2008 5:24:34 PM

In article <8caa084a-13d0-4428-913b-0e3330997c1e@40g2000prx.googlegroups.com>,
Eric Chun  <eychun@purdue.edu> wrote:
> I can�t seem to preserve the atime of files when archiving and
> extracting.  Can somebody show me what I�m doing wrong?  Here are the
> steps I�m using:
> 
> $ tar �version
> tar (GNU tar) 1.20
> 
> $ uname �a
> Linux blahHostName 2.6.5-7.283-smp #1 SMP Wed Nov 29 16:55:53 UTC 2006
> x86_64 x86_64 x86_64 GNU/Linux
> 
> $ pwd
> blahDir/
> 
> $ touch -t 02010000 blah
> 
> $ ls �lu blah
> -rw-rw-r--  1 <user> <group> 0 2008-02-01 00:00 blah
> 
> $ tar -jcf blah.tz2 blah --atime-preserve
> 
> $ cd ..
> 
> $ tar -jxf blahDir/blah.tz2
> 
> $ ls �lu blah
> -rw-rw-r--  1 <user> <group> 0 2008-11-08 10:32 blah

Maybe all "--atime-preserve" is meant to do is not change the atime of
the archived files?  It does do that:

eben@pc:~/tmp$ mkdir test

eben@pc:~/tmp$ touch -t 02010000 test/foo

eben@pc:~/tmp$ ls -lu test/foo
-rw-r--r-- 1 eben eben 0 2008-02-01 00:00 test/foo

eben@pc:~/tmp$ tar cf test.tar test --atime-preserve

eben@pc:~/tmp$ ls -lu test/foo
-rw-r--r-- 1 eben eben 0 2008-02-01 00:00 test/foo

TAR(1)                                                              TAR(1)

NAME
       tar - The GNU version of the tar archiving utility
....
       --atime-preserve
              don't change access times on dumped files

It seems so.  Doesn't imply it, upon extraction of the archive, restores
them to their (not-touched) state.  Maybe dump/restore or cpio can do what
you want?  Or, re-evaluate whether you really need atime preservation.

-- 
-eben    QebWenE01R@vTerYizUonI.nOetP    royalty.mine.nu:81

          Logic is a systematic method of coming to
            the wrong conclusion with confidence.
0
Reply ebenZEROONE (419) 11/8/2008 7:19:24 PM


On Nov 8, 1:19=A0pm, ebenZERO...@verizon.net (Hactar) wrote:
> In article <8caa084a-13d0-4428-913b-0e3330997...@40g2000prx.googlegroups.=
com>,
> Eric Chun =A0<eyc...@purdue.edu> wrote:
>
>
>
>
>
> > I can=92t seem to preserve the atime of files when archiving and
> > extracting. =A0Can somebody show me what I=92m doing wrong? =A0Here are=
 the
> > steps I=92m using:
>
> > $ tar =96version
> > tar (GNU tar) 1.20
>
> > $ uname =96a
> > Linux blahHostName 2.6.5-7.283-smp #1 SMP Wed Nov 29 16:55:53 UTC 2006
> > x86_64 x86_64 x86_64 GNU/Linux
>
> > $ pwd
> > blahDir/
>
> > $ touch -t 02010000 blah
>
> > $ ls =96lu blah
> > -rw-rw-r-- =A01 <user> <group> 0 2008-02-01 00:00 blah
>
> > $ tar -jcf blah.tz2 blah --atime-preserve
>
> > $ cd ..
>
> > $ tar -jxf blahDir/blah.tz2
>
> > $ ls =96lu blah
> > -rw-rw-r-- =A01 <user> <group> 0 2008-11-08 10:32 blah
>
> Maybe all "--atime-preserve" is meant to do is not change the atime of
> the archived files? =A0It does do that:
>
> eben@pc:~/tmp$ mkdir test
>
> eben@pc:~/tmp$ touch -t 02010000 test/foo
>
> eben@pc:~/tmp$ ls -lu test/foo
> -rw-r--r-- 1 eben eben 0 2008-02-01 00:00 test/foo
>
> eben@pc:~/tmp$ tar cf test.tar test --atime-preserve
>
> eben@pc:~/tmp$ ls -lu test/foo
> -rw-r--r-- 1 eben eben 0 2008-02-01 00:00 test/foo
>
> TAR(1) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0TAR(1)
>
> NAME
> =A0 =A0 =A0 =A0tar - The GNU version of the tar archiving utility
> ...
> =A0 =A0 =A0 =A0--atime-preserve
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 don't change access times on dumped files
>
> It seems so. =A0Doesn't imply it, upon extraction of the archive, restore=
s
> them to their (not-touched) state. =A0Maybe dump/restore or cpio can do w=
hat
> you want? =A0Or, re-evaluate whether you really need atime preservation.
>
> --
> -eben =A0 =A0QebWenE...@vTerYizUonI.nOetP =A0 =A0royalty.mine.nu:81
>
> =A0 =A0 =A0 =A0 =A0 Logic is a systematic method of coming to
> =A0 =A0 =A0 =A0 =A0 =A0 the wrong conclusion with confidence.- Hide quote=
d text -
>
> - Show quoted text -

Tar doesn't change the atime:

$ \tar -jcf blah.tz2 blah

$ ls -lu blah
-rw-rw-r--  1 <user> <group> 0 2008-02-01 00:00 blah

$ date
Wed Nov 12 08:31:11 CST 2008

0
Reply eychun (5) 11/12/2008 2:31:54 PM

2 Replies
36 Views

(page loaded in 0.066 seconds)


Reply: