Link to home
Start Free TrialLog in
Avatar of frankf
frankf

asked on

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

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,
Avatar of frankf
frankf

ASKER

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.
Avatar of yuzh
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)
   
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


     
ASKER CERTIFIED SOLUTION
Avatar of msnr
msnr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Frankf,

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

F.
Avatar of frankf

ASKER

thanks very much for all the comments/auswer provided.

Frankf