Re: tar+/dev/null weirdness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2005-05-05 at 07:58, T. Horsnell wrote:

> Oops, I spoke too soon...
> 
> On my system:
> 
> [root@ls1 ~]$ df -k /testnfs
> Filesystem           1K-blocks      Used Available Use% Mounted on
> /dev/sdd1             35280616  11836988  21651476  36% /testnfs
> [root@ls1 ~]$ time tar cf - -C /testnfs . > /dev/null
> 0.074u 0.000s 0:00.07 100.0%    0+0k 0+0io 0pf+0w
> [root@ls1 ~]$ time tar cf /dev/null -C /testnfs .
> 0.075u 0.000s 0:00.07 100.0%    0+0k 0+0io 0pf+0w
> 
> [root@ls1 ~]$ df -k /nfs/server1/www
> Filesystem           1K-blocks      Used Available Use% Mounted on
> server1:/www          35278544  11923576  21562920  36% /nfs/server1/www
> [root@ls1 ~]$ time tar cf - -C /nfs/server1/www . > /dev/null
> 0.303u 1.739s 0:08.73 23.2%     0+0k 0+0io 0pf+0w
> [root@ls1 ~]$ time tar cf /dev/null -C /nfs/server1/www .
> 0.294u 1.333s 0:16.00 10.1%     0+0k 0+0io 0pf+0w
> 
> [root@ls1 ~]$ tar --version
> tar (GNU tar) 1.14
> Copyright (C) 2004 Free Software Foundation, Inc.
> This program comes with NO WARRANTY, to the extent permitted by law.
> You may redistribute it under the terms of the GNU General Public License;
> see the file named COPYING for details.
> Written by John Gilmore and Jay Fenlason.
> 
> Les, is this *meant* to work as you say, or is it something
> which just happened to work (once upon a time)? If its meant
> to work, perhaps I should contact the Gnutar maintainers...

It's intended to let the --totals option work as quickly
as possible, but now I remember it is even smarter.  It
is comparing it's output fd inode to that of /dev/null
so even the redirection triggers the 'directory only'
mode.  If you look at your file access times you'll see
that they weren't really read.  You have to do something
like 'tar cf - . |cat >/dev/null' to make it actually
read the files and throw away the data.

-- 
  Les Mikesell
   les@xxxxxxxxxxxxxxxx



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux