We help IT Professionals succeed at work.

what is the best command to use to copy all files contained in a file system to another one

frankf
frankf asked
on
I have created/mounted a new file system

I need to copy all the data from an old file system.  Which command is the most efficient one?  dd, cp or tar?

I know I can use cp as follows to copy everything from the source to the destination:

cp -r /source /destination

This seems taking very long time.

Should I use dd or tar?

I don't know much of dd.

I only used tar to tar files to/from tapes.  don't know how to tar files from one file system to another.  Can someone help?

Many thanks in advance,
Comment
Watch Question

Author

Commented:
I tried the following tar command:

#cd /cource; tar cf - .| cd /destination; tar xfBp -

it does not work.

It stuck on the second tar forever.

my Solaris is 8.
CERTIFIED EXPERT

Commented:
Hi frankf,

    If you use tar, you command should look like the following:

    cd /source
    tar cfh - . | (cd /destination ; tar xvfp -)

    your can also use cpio to do the job. "dd" is usefull for making disk image (you have to have 2 identicat disks)
   
CERTIFIED EXPERT

Commented:
Hi rankf,

     use usfdump & ufsrestore may be faster than tar, you can give it a try:
      ufsdump 0cf - /source | (cd /destination ; ufsrestore rf  -)
      When the above command completed.
     
     cd /destination
     rm restoresymtable


     
Commented:
hi frank

use this

find /source -depth|cpio -pdmluv /destination


Commented:
Frankf,

I rather use the next commands:
cd /<source>
find . |cpio -pdmv <destenation>

F.

Author

Commented:
thanks very much for all the comments/auswer provided.

Frankf

Explore More ContentExplore courses, solutions, and other research materials related to this topic.