Hi
Using tar i normally create an archive etc and then unpack that archive, job done.
But i am copying from one filesystem to another on the same host, they are 2 seperate nfs filesystems, and i wonder is it possible to use tar to do this as opposed to say rsync etc.
tar -cvf /some/input/dir to/here etc ?
thanks
On Thu, Jun 07, 2007 at 02:11:23PM +0100, Tom Brown enlightened us:
Using tar i normally create an archive etc and then unpack that archive, job done.
But i am copying from one filesystem to another on the same host, they are 2 seperate nfs filesystems, and i wonder is it possible to use tar to do this as opposed to say rsync etc.
tar -cvf /some/input/dir to/here etc ?
I believe it goes something like:
cd /some/input/dir tar cvf - . | (cd /to/here; tar xvf -)
Matt
On Thu, 7 Jun 2007 at 9:18am, Matt Hyclak wrote
On Thu, Jun 07, 2007 at 02:11:23PM +0100, Tom Brown enlightened us:
Using tar i normally create an archive etc and then unpack that archive, job done.
But i am copying from one filesystem to another on the same host, they are 2 seperate nfs filesystems, and i wonder is it possible to use tar to do this as opposed to say rsync etc.
tar -cvf /some/input/dir to/here etc ?
I believe it goes something like:
cd /some/input/dir tar cvf - . | (cd /to/here; tar xvf -)
Alternately
cd /some/input/dir tar cO . | tar xC /to/here -f -
On Thursday 07 June 2007, Tom Brown wrote:
I believe it goes something like:
cd /some/input/dir tar cvf - . | (cd /to/here; tar xvf -)
that is spot on thanks! does it buffer anything in memory do you know or any other temp space? Just wonder as there are a few gigs of data.
add a dd command to the pipe if you want buffers.
That said, my personal opinion is that non-trivial data move operations should not be done with tools like tar, tools that does not allow restart/resume. You mentioned rsync, why not use it.
/Peter
thanks
Tom Brown wrote:
I believe it goes something like:
cd /some/input/dir tar cvf - . | (cd /to/here; tar xvf -)
that is spot on thanks! does it buffer anything in memory do you know or any other temp space? Just wonder as there are a few gigs of data.
My personal preference is to do something like:
cd /some/input/dir find . -print | cpio -pvm /to/here
or
cd /some/input/dir rsync -av . /to/here
(need to check the cpio options there -- I don't use that form very often).
James
Matt Hyclak wrote:
On Thu, Jun 07, 2007 at 02:11:23PM +0100, Tom Brown enlightened us:
Using tar i normally create an archive etc and then unpack that archive, job done.
But i am copying from one filesystem to another on the same host, they are 2 seperate nfs filesystems, and i wonder is it possible to use tar to do this as opposed to say rsync etc.
tar -cvf /some/input/dir to/here etc ?
I believe it goes something like:
cd /some/input/dir tar cvf - . | (cd /to/here; tar xvf -)
Matt
Or you could think "outside the tar box" and use cpio:
cd /some/input/dir find . | cpio -pmvd /some/destination/dir
"-p" invokes the "passthru" mode, which is great for doing filesystem-to-filesystem copies. cpio seems to have been installed on just about every CentOS, Fedora, and RH system I've used in the last several years. See the manpage for more info!
--On Thursday, June 07, 2007 9:18 AM -0400 Matt Hyclak hyclak@math.ohiou.edu wrote:
I believe it goes something like:
cd /some/input/dir tar cvf - . | (cd /to/here; tar xvf -)
If sparse files (with unallocated "holes" in them) are involved, dump might be a better choice. I don't think tar can preserve holes. It might, however, replace long runs of zeroes with holes, which might be sufficient.