Showing results for 
Search instead for 
Did you mean: 

Best way to copy files

Go to solution
Theodore Alexopulos
Occasional Advisor

Best way to copy files

Which is the best (accurate and includes everything) and fastest way to copy files?
Steven E. Protter
Exalted Contributor

Re: Best way to copy files

If the database is down the cp command will work just fine.

No matter what you do, you will have to know the layout of your database. For oracle the files are rarely just sitting in the same directory.

For copying between systems, avoid rcp it sometimes didn't work for me.

scp, part of Secure Shell works fine.

Steven E Protter
Owner of ISN Corporation
Darren Prior
Honored Contributor

Re: Best way to copy files


You'll need to include a little more information... What types of files are you copying, are you copying between disks on one server, or between servers?

Personally, I tend to use the following for copying stuff between dirs on a box:

find /sourcedir | cpio -pdmuxlv destdir


Calm down. It's only ones and zeros...
Cheryl Griffin
Honored Contributor

Re: Best way to copy files

I believe it was Bill Hassell who says the fastest way to copy is:

$ cd /source_dir
$ find . | cpio -pudlmv /destination_dir

omit v (verbose) option from cpio for more speed
"Downtime is a Crime."
James R. Ferguson
Acclaimed Contributor

Re: Best way to copy files


If you mean copy for backup purposes, I prefer 'fbackup'. There is automatic retry of files that cannot be backed up because they are changing at the moment of copy (although one hopes not!). There is an index of files built and written to the front of the tape which makes later examination and/or recovery ('frecover') very easy. You can do full and/r incremental backups and you can include and exclude files and/or directories with simple "graph" files. See the man pages for 'fbackup' and 'frestore' for more information.


Theodore Alexopulos
Occasional Advisor

Re: Best way to copy files

database files. Database will be offline. About 1 TB on same server, different storage systems.
I am worrying for
a)the integrity of data
b) all required data will be copied
Honored Contributor

Re: Best way to copy files

To store a particular directory:

# fbackup -f /dev/rmt/0m -i /tmp

# find /tmp -print | cpio -oBv > /dev/rmt/0m
# find /etc | cpio -ov > /dev/rmt/0m

# tar cv /tmp ( for default device )
# tar cvf /dev/rmt/1m /tmp (specify device)
Robert-Jan Goossens
Honored Contributor

Re: Best way to copy files


# cpio -pcmudv

Honored Contributor

Re: Best way to copy files


since it is on the same server, i would also consider doing the copy operations in parallel...

hope this helps too!

No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Tim D Fulford
Honored Contributor

Re: Best way to copy files

copy over network....

on target machine
remsh "cd ; tar cf - | gzip - " | cd ; gunzip - | tar xf -

This will effectively create a gzipped tar image of the source & simultanously transfer it acros the network & untar it..... nice efficient & simple only in concept.....(probaly be in the offing for the Obfucated perl/tar competition)


Esteemed Contributor

Re: Best way to copy files


Using tar is fast:
tar cf - | (cd ; tar xf -)

But if you will give more information about
the copy that you intresting it maybe change
the answer.

malay boy
Trusted Contributor

Re: Best way to copy files

fast?? this what we do here.I assume you trying to archive minimum down time for the database.For database cold backup,we copy the datafile to the disk.As the disk is big we used a gzip.

So the step are :

1) shutdown database.
2) copy to the disk.
3) startup database.
4) copy the disk to tape.

For a critical machine,we do :

1) shutdown database.
2) split the mirror.
3) start the database.
4) mount the split mirror.
5) backup the mirror to tape.
6) join back the mirror.

There are three person in my team-Me ,myself and I.
Honored Contributor

Re: Best way to copy files

I will exclude -v options in cpio for better speed.
There is no substitute to HARDWORK