Operating System - HP-UX
1833772 Members
2374 Online
110063 Solutions
New Discussion

Re: Copy /home to another Box

 
joe_91
Super Advisor

Copy /home to another Box

I have to set up a cron to copy the /home dir to another box which has the space. This command has to run daily(so that it updates the /home from machine A on machine B but..should update only the changes in /home). How would i accomplish this?

Thanks

Joe
14 REPLIES 14
Carlos Roberto Schimidt
Regular Advisor

Re: Copy /home to another Box

Hi,

Why not use rsync for acomplish this task?

See http://hpux.connect.org.uk/hppd/hpux/Networking/Admin/rsync-2.6.4/

Schimidt
A. Clay Stephenson
Acclaimed Contributor

Re: Copy /home to another Box

The standard utility rdist will handle this or you can use the rsync package. Rsync is more advanc3ed in that it has the ability to xfer only the parts of files that have changed although it sounds as though rdist will be completely adequate for your needs.

http://hpux.cs.utah.edu/hppd/hpux/Networking/Admin/rsync-2.6.4/
If it ain't broke, I can fix that.
Pete Randall
Outstanding Contributor

Re: Copy /home to another Box

Hi Joe,

Do you have NFS available? If so, I would proceed like this:

(from the target machine)
cd /nfs/source_machine/home
find . |cpio -pdumxl /home

The find command will chase down through the source machines home directory structure, piping everything it encounters to cpio, which, in turn, will reproduce same on the target machine.


Pete

Pete
Shahul
Esteemed Contributor

Re: Copy /home to another Box

Hi Joe,

The answer is already there above. I would prefer rsync, it's an OK tool, though you may have trouble getting the right version for right platform, etc from site. You need to get the right binary.

Yes, you need to copy /home from A to B, and it should be an incremental copy, am I right?

Rsync can do this. it can copy all the newly created files and also delete if anything deleted at source.


Best of luck
Shahul
TwoProc
Honored Contributor

Re: Copy /home to another Box

Like the others have suggested - use rdist or rsync for this. I've been rsync for sometime for this exact issue. Works fast and works fine with ssh, so it can be made secure.
We are the people our parents warned us about --Jimmy Buffett
Senthil Kumar .A_1
Honored Contributor

Re: Copy /home to another Box

Hi Joe,

If your main purpose is to make the same set of files available for a user in 2 different unix box, The elegant method is to export and share the home directories through NFS.

For configuring NFS server...

http://docs.hp.com/en/5991-1153/ch02s02.html

For configuring NFS Client...

http://docs.hp.com/en/5991-1153/ch02s03.html

Regards,
Senthil Kumar .A
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
joe_91
Super Advisor

Re: Copy /home to another Box

The reason why i want to do this is 'coz the /home is in a old K Box with Jamica disks and we have another box with lot of storage(va7100) and what i was planning was copy /home daily and put it in a dir(which is mirrored). Is there anything wrong with this plan?

Thanks

Joe
A. Clay Stephenson
Acclaimed Contributor

Re: Copy /home to another Box

No that is a perfectly valid use although NFS mounting this directory would keep you always in-sync and since the array is mirrored (or RAID'ed) you have redundancy and I assume the newer box is being backed up regularly as well.

You could automount your home directory and the fact that /home/xxx is actually on another box would be completely invisible to you.
If it ain't broke, I can fix that.
Senthil Kumar .A_1
Honored Contributor

Re: Copy /home to another Box

Hi Joe,

I did not realize that you were using the old system as well. Please go ahaed with the plan. It is just fine. Rather use rsync then.

Regards,
Senthil Kumar .A
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
joe_91
Super Advisor

Re: Copy /home to another Box

Clay:

Thanks. Sorry for the delayed response..
Clay..do you want me to NFS mount the /home on to the box with RAID? Can u explain pl?

Thanks

Joe
Alzhy
Honored Contributor

Re: Copy /home to another Box

RSYNC is your best solution.

Install rsync on machineA and machineB. Install/Config SecureShell (keys) on both machines so root@machineB can ssh to root@machineA without a password.

On machineB, set up to execute (say every 5 minutes)via CRON:

rsync -avz --delete --exclude="lost+found" roo@machineA:/home /

(Above makes /home of machineB exactly as /home of machineA - meaning whatever new or changed files on machineB that are not on machineA will be deleted). Remove the "--delete" if you want to maintain new files on machineB.

HTH.


Hakuna Matata.
Patrice Le Guyader
Respected Contributor

Re: Copy /home to another Box

Hey Joe,

What I'll do is to use cfengine.
It's a great toolbox I've been using for two years and it can do this. It can survey files or use scripts you wrote, edit files,...

You can do it accross many type of OS ,many releases. You can have the server in HPUX and clients in HPUX (10,11,11i),solaris(8,9), linux too. It's a great tool box. Look at it.

Regards
Pat
Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement.
John Collier
Esteemed Contributor

Re: Copy /home to another Box

I could be wrong, but I think what Clay is suggesting is to simply do an NFS mount of the copied /home directory on the new box.

Basically, you simply export the file system from the new, mirrored box and then mount it under the /home directory on the older system.

What you will get at that point is a file system on the older box that will work just like you are used to, but all the user's information will actually live on the new box, not the old one.

This would eliminate the need to do a copy from the old system to the new just to keep a current copy on the mirrored file system since all the important information would live there and be accessed there.

Does that make sense to you, or did I muck up the explanation too much?
"I expect to pass through this world but once. Any good, therefore, that I can do, or any kindness that I can show to any human being, let me do it now. Let me not defer or neglect it, for I shall not pass this way again." Stephen Krebbet, 1793-1855
Prashant Zanwar_4
Respected Contributor

Re: Copy /home to another Box

Again, I am repeating, so sorry. But rsync is very good tool for all this purpose.

rsync -avzS -e ssh / dest_server:/home/

Note the ending / (slashes), important for not to create a directory under directory.

Check for recent rsync version to have better support your copy.

I did tar too... fbackup and frecover also should work, only time taken by rsync is much less comparitively..

Good luck
Prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."