1833124 Members
3272 Online
110051 Solutions
New Discussion

tar command question

 
SOLVED
Go to solution
dictum9
Super Advisor

tar command question


OK, I am getting confused with it, here is the situation.

I have 2 directories:

/oracle and /oracle_temp

I need to move the contents of /oracle to /oracle_temp, it's about 12GB. I just created the oracle_temp LV and mounted it.

How do I run the tar command to copy all the files? Or do I use find and cpio?
11 REPLIES 11
Rodney Hills
Honored Contributor
Solution

Re: tar command question

cd /oracle
tar cf - . | ( cd /oracle_temp ; tar xf - )

HTH

-- Rod Hills
There be dragons...
Tiziano Contorno _
Valued Contributor

Re: tar command question

I suggest you to use the cpio pipe, no restrictions on file size and the right mamagement of links and permissions.

find source_dir -depth -print | cpio -pcdumv newdir

Regards.
Steven E. Protter
Exalted Contributor

Re: tar command question

Shalom etc,

I'd use the mv or cp command

mv /oracle/* /oracle_temp

cp -R /oracle/* /oracle_temp

The database must be down if this includes database data files.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Robert-Jan Goossens
Honored Contributor

Re: tar command question

Hi,

# find /oracle | cpio -pcmudv /oracle_temp

Regards,
Robert-Jan
Steven E. Protter
Exalted Contributor

Re: tar command question

Shalom etc,

I'd use the mv or cp command

mv /oracle/* /oracle_temp

cp -R /oracle/* /oracle_temp

The database must be down if this includes database data files.

If the lvs are on two systems scp -rp will work well.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
MarkSyder
Honored Contributor

Re: tar command question

cpio is much faster.

cd /oracle
find . â xdev â depth â print|cpio â pmd /oracle_temp

Unless you've got it backed up with Data Protector, in which case I'd use that.

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
dictum9
Super Advisor

Re: tar command question

OK, this one is working great, thanks to all.

# find /oracle | cpio -pcmudv /oracle_temp
MarkSyder
Honored Contributor

Re: tar command question

Apologies for the formatting in my earlier response - that's what I get for copying from Mickeysoft T*rd! And mine was the first response when I typed it - honest! When I say that cpio is faster, I mean compared with tar rather than compared with someone else's solution. My solution again (typed rather than copied):

cd /oracle
find . -xdev -depth -print|cpio -pmd /oracle_temp

Mark
The triumph of evil requires only that good men do nothing
dictum9
Super Advisor

Re: tar command question

The following did not copy all the files, why is that? It left out
the 9ias director. And the space is fine.

# find /oracle | cpio -pcmudv /oracle_temp

# ll /oracle
total 6
drwxr-xr-x 7 oracle dba 1024 Jul 14 2005 9ias
drwxr-xr-x 2 root root 96 Jun 1 2005 lost+found
drwxr-xr-x 2 oracle dba 2048 Apr 18 13:12 v10

ll /oracle_temp
total 0
drwxr-xr-x 2 root root 96 Apr 20 09:52 lost+found
drwxr-xr-x 5 oracle dba 96 Apr 20 10:24 oracle
#
MarkSyder
Honored Contributor

Re: tar command question

It appears to have copied everything across in a single directory called oracle. Have you looked inside this directory?

Mark
The triumph of evil requires only that good men do nothing
dictum9
Super Advisor

Re: tar command question

I had to remove everything and start over. This one copied all the files correctly.

find . -xdev -depth -print|cpio -pmd /oracle_temp