Operating System - HP-UX
1837985 Members
3048 Online
110124 Solutions
New Discussion

Re: users' home directory migration

 
M.Thomas
Frequent Advisor

users' home directory migration

I am migrating the users' home directories from one(1)machine to (2) another. the machine 2 already has the home directories but i need to copy some user data which may be there.. will this work.

I share the /home on 1 and mount it on 2 in /mnt
1. mount machine1:/home /mnt
2. cd /mnt
3. cp -rp * /home

will this copy all contents under /home of machine1 to machine2's /home.

Thanks

Thomas
3.
9 REPLIES 9
James R. Ferguson
Acclaimed Contributor

Re: users' home directory migration

Hi Thomas:

Assuming that you don't have any largefiles to accomodate, I'd do this:

...on server-1:

# tar -cvf /somepath/archive /home

# rcp /somepath/archive server2:/somepath/archive

...on server-2:

# tar -xvf /somepath/archive /home

Regards!

...JRF...
D Block 2
Respected Contributor

Re: users' home directory migration

M.Thomas,

one minor concern or point..

verify each acct name on "machine2".. by:

cd /home
ls -l

if you happen to see ### numbers as the "owner" of the directory, then you will have to Re-Set the Acct Owner names.

ex:
cd /home/thomas
chown thomas .
find . -exec chown thomas {} \;

# verify
find . -exec ls -l {} \;

Golf is a Good Walk Spoiled, Mark Twain.
Raj D.
Honored Contributor

Re: users' home directory migration

Thomas,

If you have tape drive on both the system , you can simply do , tar -cvf and in the other tar -xvf for the home directory.


Also you can NFS mount the /home of the source into the target and use cp -rp ,


Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Tor-Arne Nostdal
Trusted Contributor

Re: users' home directory migration

Hi
yes it would normally work.
Nevertheless by using James proposal with tar, you got an extra check...
tar would complain if any files changes during the operation.

here's another proposal for your evaluation:

server2# cd /home
server2# ssh root@server1 "cd /home;tar -cf - ./ | /usr/contrib/bin/gzip -c " | gunzip -c | tar -xf -

Use tvf instead of xf in case you want to check what you're pulling over.

In this example I used ssh, but if you have remsh setup, you surely could use this instead. If you don't have gzip/gunzip you could use compress/zcat or simply don't try to perform any compression.

If you transfer over a wan I would consider to store to file, perform a checksum of the file, transfer it, checksum again, unpack.

/Tor-Arne
I'm trying to become President of the state I'm in...
Jannik
Honored Contributor

Re: users' home directory migration

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.
If you think that you may have most of the data on the destination, and only what to overright it if it is newer than the destination, you could use the tool rsync.
http://hpux.cs.utah.edu/hppd/hpux/Networking/Admin/rsync-2.6.8/
jaton
Fabian Briseño
Esteemed Contributor

Re: users' home directory migration

Hi thomas.
Why dont you do a fbackup of server 1
home directory, and download that backup on to server 2.
Knowledge is power.
M.Thomas
Frequent Advisor

Re: users' home directory migration

thanks. so many options.

Thanks


Thomas
Geetha_1
Regular Advisor

Re: users' home directory migration

Set up .rhosts on both machines so that you can remote shell.

On ServerA
# cd /home/userhome/dirA
# (find . -xdev|cpio -coax)|remsh serverB "cd /home/userhome/newdir;cpio -icdmuxla"

Test it out on some test files before you try it on the user home.
Geetha.
M.Thomas
Frequent Advisor

Re: users' home directory migration

actually it is not a very big size so i decided to follow the suggextion from JRF. i have the home.tar under /tmp on the destination machine now. should i cd /home and run the command..i am confused as i just do not want to create a /home/home/ i just need to append the current /home/userid with the files and directories from the tar file, please help

Thanks

Thomas