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

Re: [PLUG] File copy method that is twice as fast as "cp -a".



>>>>> "Karl" == Karl M Hegbloom <karlheg@hegbloom.net> writes:

Karl> root@karl:~ # time (cd /usr/local/src/ && tar pcf -
Karl> cvs.gnome.org) | (cd /mnt/tmp/src/ && tar pxf -) 

Just for your reference, there is a tar option that makes your shell
construction much easier:

  tar -C /usr/local/src -pcf - cvs.gnome.org | tar -C /mnt/tmp/src -pxf -

Note: 

  a) the usually optional `-' preceding the option characters is
     needed since the -C option (to change cwd for the operation)
     means things aren't in the priveleged spot anymore.

  b) you don't need the p in the creating tar, it does what you want
     without it, I think.  I usually use an `l' there, to limit
     creation to one file-system, but that's just because that's
     usually what I want to do.

  c) if I am doing this between machines, I can pipe it through ssh
     thusly:

  tar -C /srcdir -clf - . | ssh targethost 'tar -C /targetdir -xpf -'

     or

  ssh targethost 'tar -C /srcdir -clf - .' | tar -C /targetdir -xpf -

  d) if you want to watch progress, put a `v' in the extracting tar,
     as in: `-xpvf' instead of `-xpf'.  Don't do that in the creating
     tar or you will muck up standard output you are using for tar.

  e) if you want to double check, repeat the tar-to-tar substituting a
     `d' for the `x' tar option.

If you are try to preserve permissions/ownership for anyone other than
yourself, then you are going to need to do this as root.

-- 
Russell Senior         ``The two chiefs turned to each other.        
seniorr@aracnet.com      Bellison uncorked a flood of horrible       
                         profanity, which, translated meant, `This is
                         extremely unusual.' ''                      



Reply to: