cancel
Showing results for 
Search instead for 
Did you mean: 

hp-ux rsync copy help .

rveri
Super Advisor

hp-ux rsync copy help .

Hi Experts,

I have few filesystem like this:

/oracle/app/STW
/oracle/app/DTW
/oracle/arch
/oracle

I want to copy using rsync command to another archive directory:

Example:
# rsync -avz /oracle/app/STW/ /arch_dir/oracle_app_STW/
# rsync -avz /oracle/app/DTW/ /arch_dir/oracle_app_STW/
# rsync -avz /oracle /arch_dir/oracle/

Now /arch_dir/oracle/ may be get copied everything under /oracle from source including app and so on...,
So the question is how to tell rsync to copy only mount point data and not to cross mount points. Like we use -xdev with find command.

HP-UX version:
* hpux 11.00
* rsync version 2.5.5 protocol version 26

Please advise ,
Thanks in advance.
5 REPLIES
OldSchool
Honored Contributor

Re: hp-ux rsync copy help .

I take it you're worried about this one:

# rsync -avz /oracle /arch_dir/oracle/

where everthing under "/oracle" gets sent?

as far as I know, there isn't anything like find's xdev, however, it appears you have to provide the "-r" option to have rsync recurse into the directories under oracle. In other words, the command, as illustrated above, will *not* sync anything other than the files immediately under "oracle"
rveri
Super Advisor

Re: hp-ux rsync copy help .

Oldschool,

Thanks, However: you mentioned it will not copy any subdirectory, and need to use -r. is incorrect.

-a option in rsync does everything. (It does recursive as well, and preserves permissions ). So no worry on that part.



> # rsync -avz /oracle /arch_dir/oracle/
where everthing under "/oracle" gets sent?
Yes this is the worry , only I want the Filesystem data to be copied, not other FS on top of /oracle .
Looking for something some switch that does similar to xdev with find.


Thanks again.
OldSchool
Honored Contributor

Re: hp-ux rsync copy help .

"However: you mentioned it will not copy any subdirectory, and need to use -r. is incorrect.
-a option in rsync does everything. (It does recursive as well, and preserves permissions ). So no worry on that part."

You missed the point. You can't stop it from crossing mount points, so you probably can't use "-a" as you've illustrated.

=========
from the man page:

-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
=========

Thus, your example of:

rsync -avz /oracle /arch_dir/oracle/

would become:

rsync -ptgoDvz /oracle /arch_dir/oracle/

Which stops the recursion, copying only the files directly under /oracle to /arch_dir/oracle

you would then need to specify any sudirectories that you do want copied as separate items, much as you do with

# rsync -avz /oracle/app/STW/ /arch_dir/oracle_app_STW/
# rsync -avz /oracle/app/DTW/ /arch_dir/oracle_app_STW/

Either that, or you'll have to look into "excludes" (which may or may not exclude entire trees)

"Yes this is the worry , only I want the Filesystem data to be copied, not other FS on top of /oracle . Looking for something some switch that does similar to xdev with find."

Again, rsync doesn't care about filesystems / mount points and thus does not have anything analogous to "find"s "-xdev" option. Its all based on file and directory names. You can't have "-a" and be assured that it *won't* follow a mount point......
rveri
Super Advisor

Re: hp-ux rsync copy help .

Oldschool,
Thanks,

As you mentioned ,

rsync -ptgoDvz /oracle /arch_dir/oracle/

Which stops the recursion, copying only the files directly under /oracle to /arch_dir/oracle

copying only the files directly under /oracle


Suppose If I have 100's of directory under /oracle (Filesystem) with subdir, then wouldn't it be difficult to copy them one by one.
The requirement is here I dont want to cross mount point and to copy everying withing the filesystem to another place.

jaganadhan
Occasional Advisor

Re: hp-ux rsync copy help .

Hi all,

 

i want files when any new files is generated in source system, i don't want old files should be in sync,

 

i used command like same,

rsync -a -z <source> <destination>.

 

Now the issue is ,

 

For ex,..

Source system,                  Destination sys

Log_1 to Log_50               Log_1 to Log_50

 

If i deleted Log_1 to Log_30 in destination side, because of less space,

It should not copy again from the source system from Log_1 to Log_30,

 

i need file if any new file generated in source system ex, Log_51 is generated means only that should come in Destination system,

 

For ex,..

Source system,                  Destination sys

Log_1 to Log_51               Log_31 to Log_51

 

But what i am receiving in destination system, 

First this old files is coming Log_1 to Log30 after that only Log_51 is coming.

 

Kindly suggest..

 

Regards,
Jagan