Subject: Re: copying entire directory to another filesystem
To: Jeremy C. Reed <>
From: Brett Lymn <>
List: current-users
Date: 05/23/2000 19:59:53
According to Jeremy C. Reed:
>You may be able to do something like this:
>  cd /directory-of-original-filesystem
>  tar cpf - * | (cd /path/to/new/filesystem ; tar xpf -)

This tar command is incorrect - it may not copy _all_ the files in the
directory.  The * will only get all the files not starting with a `.'.  
You are better off using:

 cd /directory
 tar cf - . | (cd /path/to/new && tar xBpf -)

Doing a tar of . will pick up all the files in the directory.  Also
note the `&&' which will only run the extraction tar if the cd worked,
this is important in this case because if the cd fails then you risk
the extraction overwriting the source files making a real mess.  Note
the B flag which ensures the read from the pipe is done in block sizes.

>I don't know if this is faster than cp -Rp but I'd like to know.

Cannot say but lots of little files can take a long time to copy, much
longer than a few big files that add up to the same size.

>> 2. how do i move an entire filesystem to another and keep owner and 
>> permission the same? (maybe same as #1? or maybe do some kind of image 
>> copy?) filesystem aren't necessarily the same size (probably moving to a 
>> bigger filesystem).
>man dd

You cannot use dd unless the filesystems are _exactly_ the same size
on _exactly_ the same model disk in _exactly_ the same place.
Personally, I would only use dd if I were copying an entire disk to
another one that was the same.  My preference for moving filesystems
around is to use dump and restore.

>Mocha, I am not sure, but I think your questions should be posted to a
>different mailing list.

I think so too - would have been a more
appropriate forum for these questions.  Note for next time ;-)

Brett Lymn, Computer Systems Administrator, BAE SYSTEMS