Operating System - HP-UX
1834800 Members
2637 Online
110070 Solutions
New Discussion

Re: Best way to copy a lot of files

 
SOLVED
Go to solution
Mauro Gatti
Valued Contributor

Best way to copy a lot of files

Hi all, I have to copy from /dev/vg1/lv1 mounted on /dir1 all files to /dev/vg2/lv2 mounted on /dir2
Which is the best way to do this?
I can't use pvmove (and I don't want use it).
I think it remains :
1) cpio
2) tar
3) fbackup
...

Thank You

Mauro
Ubi maior, minor cessat!
18 REPLIES 18
Manish Srivastava
Trusted Contributor
Solution

Re: Best way to copy a lot of files

Hi,

I recommend cpio.....

manish
malay boy
Trusted Contributor

Re: Best way to copy a lot of files

well i go for fbackup but make sure it is not in full path .
Or the easist is create a soft link.


regards
mB
There are three person in my team-Me ,myself and I.
Robert-Jan Goossens
Honored Contributor

Re: Best way to copy a lot of files

Hi Mauro,

# find /source | cpio -pcmud /copy

Robert-Jan
Joseph Loo
Honored Contributor

Re: Best way to copy a lot of files

hi,

i go for cpio:

# cd /dir1
# find . -depth -print | cpio -pdum /dir2

regards.
what you do not see does not mean you should not believe
SIJU JOSE
Frequent Advisor

Re: Best way to copy a lot of files

Hi Mauro

I learned it from this forum which was one of the great findings for me

# cd /sourcedirectory

# find .|cpio -pudlmv /destinationdirectory

This moves the entire thing with permission to destination directory.

HTH
Siju Jose
Sanjay Kumar Suri
Honored Contributor

Re: Best way to copy a lot of files

1. Backup/restore large files (> 2 GB) not possible with cpio & tar.

2. Verifying the backup taken with cpio & tar is not possible.

3. Finding a particular file in cpio/tar not very easy.

fbackup does not have above limitations. How about using plain mv command?

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
Ravi_8
Honored Contributor

Re: Best way to copy a lot of files

Hi,

I prefer cpio always
never give up
harry d brown jr
Honored Contributor

Re: Best way to copy a lot of files


WHY not use "cp" ??

cp -rp /dev/vg1/lv1/* /dev/vg2/lv2

live free or die
harry
Live Free or Die
Trond Haugen
Honored Contributor

Re: Best way to copy a lot of files

Just to add another option you could use 'cp -r ' too.

Regards,
Trond
Regards,
Trond Haugen
LinkedIn
Mauro Gatti
Valued Contributor

Re: Best way to copy a lot of files

I'd like to know if there was any smart way to do it and I will do good use of your "brainstorming".


Thank You a lot.



Mauro
Ubi maior, minor cessat!
KapilRaj
Honored Contributor

Re: Best way to copy a lot of files

cd /source;tar cvf - . |ksh "(cd /destin;tar xvf -)"

or

cd /source;find . -name -depth -xdev -print|cpio -pxdm /destin

I would use any of the above, Infact i had lots of troubles using "cp"

Do u really want to move the data at physical layer ?. Or are you ok with the following

umount /dir1
umount /dir2
mount /dev/vg1/lv1 /dir2

:-)

Kaps
Nothing is impossible
harry d brown jr
Honored Contributor

Re: Best way to copy a lot of files

cp!

Why send it to an archiver (cpio,tar,...) then unarchive it at it's destination? Which is why I suggest using cp.

If you plan on REMOVING /dev/vg1/lv1 (or the contents therein), then use "mv"


live free or die
harry
Live Free or Die
Mauro Gatti
Valued Contributor

Re: Best way to copy a lot of files

Raj, obviusly I have to move data from one physical dist to another :-)
Ubi maior, minor cessat!
Geoff Wild
Honored Contributor

Re: Best way to copy a lot of files

Use vxdump - I used that in SAN migrations - was the fastest.

vxdump -0 -f - -s 1000000 -b 16 /dir1 | (cd /dir2 ; vxrestore rf -)

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Fabio Ettore
Honored Contributor

Re: Best way to copy a lot of files

Ciao Mauro,

in order to do it I used two times successfully the following command:

# cd /
# find . -xdev -print | cpio -pdmvux /

I suggest you to compare two directories at the end:

# diff / /

Anyway all suggestions seem good, by now you have a lot of possibilities.

Best regards,
Ettore

WISH? IMPROVEMENT!
Michael D'Aulerio
Regular Advisor

Re: Best way to copy a lot of files

Not sure if this is the best way, but if both LVs are the same size you could use dd. dd does a raw copy and can be used with device files.

umount /dir1
umount /dir2
dd if=/dev/vg1/rlv1 of=/dev/vg2/rlv2 bs=1024k
mount /dev/vg1/lv1 /dir1
mount /dev/vg2/lv2 /dir2

This should reproduce the entire filesystem.
Email: michael.n.daulerio@lmco.com
Jannik
Honored Contributor

Re: Best way to copy a lot of files

local copy:
vxdump 0f - / | (cd /; vxrestore rvf - )
find . -depth | cpio -dumpv /

remote copy though ssh:
tar cf - . | ssh user@host "(cd ; tar xf - )"

for local use i think the find way is the fastes.
jaton
Larry Luther
New Member

Re: Best way to copy a lot of files

To the advocate of "cp": Write a program that creates 30,000 files in a directory.
Now try "cp src/* dst/". Notice that it crashes. The command line buffer is too small to handle the expansion of "*" to 30,000 file names.