- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: copying files from one system to another
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2002 08:55 AM
10-29-2002 08:55 AM
copying files from one system to another
I want to copy some special users directory and links in the directoty from one hp server to another. I created users on the destination server but I had to use diffrent uid and gid the same as source server's uid and gid were not available.
Now if I use "rcp -pr" it puts it as root,sys for uid and gid and also it did not copy links
What is the best way to achieve this?
I need help ASAP
Thanks for your help
Raji
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2002 08:57 AM
10-29-2002 08:57 AM
Re: copying files from one system to another
Instead of rcp, use tar... you can do this across the network.
On the target machine, position yourself in the directory where you want the files copied to... then use remsh to execute tar - tar copy
remsh host_with_files "cd /directory_with_files; tar cBf - *" | tar xvBf -
you will need to update the ownerships on the server after the copy
You could take the command above and put it in a simple script that would end with a command to update the ownership
Ted
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2002 08:58 AM
10-29-2002 08:58 AM
Re: copying files from one system to another
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2002 09:00 AM
10-29-2002 09:00 AM
Re: copying files from one system to another
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2002 09:00 AM
10-29-2002 09:00 AM
Re: copying files from one system to another
save tape swapping.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2002 09:06 AM
10-29-2002 09:06 AM
Re: copying files from one system to another
Use TAR. This preserves file permissions also.
The command to move a directory via tar is as follows:
locally
cd /the/original/directory
tar -cf - * | (cd /the/new/directory; tar -xf -)
remotely
cd /the/original/directory
tar -cf - * | remsh the.new.machine "cd /the/new/directry; tar -xf -"
Regards,
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2002 09:10 AM
10-29-2002 09:10 AM
Re: copying files from one system to another
# cd /home/skchan/dirA
# (find . -xdev|cpio -coax)|remsh serverB "cd /home/skchan/newdir;cpio -icdmuxla"
That should do it. I suggest trying it out first with some dummy directory/files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2002 09:11 AM
10-29-2002 09:11 AM
Re: copying files from one system to another
On the target server run:
remsh
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2002 09:14 AM
10-29-2002 09:14 AM
Re: copying files from one system to another
Your solution seems to work for me but can you elaborate on that?
Does this puts the files in the target server??
How do I change the ownership after that?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2002 09:19 AM
10-29-2002 09:19 AM
Re: copying files from one system to another
The problem is the numeric uid and gid are not the same for the loginid on both systems. Thus ll will show the files owned by whoever has that uid on the target system. It no loginid (username) exists for that uid, it is shown as the numeric uid.
You can use find to change ownership. Determine the uid (numeric) as specified on the source and the desired owner on the target. Then:
find /starting_dir -user source_uid -exec chown desired_owner {} \;
alternate format:
find /starting_dir -user source_uid | xargs chown desired_owner
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2002 09:25 AM
10-29-2002 09:25 AM
Re: copying files from one system to another
1. log on as root...or a user that will have all permissions to perform the copy of files from the target... onto the target machine (the server getting the copied files)
2. change to the target directory on the server
3. now execute the command I sent.. just substitute in the directory where the files are located on the server being copied from. Since you are sitting in the right drectory on the target machine, the tar extract will "copy" the files there.
when the tar extract completes, list the files copied on the target server... just do a ll. You will most likely see uid and gid numbers, or different user and group owners than you want. This is because tar is referencing file ownership by the uid and gid numbers and not the names. It tries to match the copied files ownerships based on the uid and gid numbers on the target server.
use chown -R uid:gid * on the target server from where you are to adjust recursively the ownership.. assuming that all of them are the same. If you have multiple users/groups that own files in the ones copied... you may want to try and change the uid and gid assignments on the original host to match the target.... as long as the affected user is not logged in, you can do this with usermod and groupmod.... if you do this, verify that the files have ownership updated
Ted
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2002 09:25 AM
10-29-2002 09:25 AM
Re: copying files from one system to another
If the uid and gid differ on the source and destination server then the ownership of the files is not going to be what you want. The name of a user or group is derived by mapping the numeric uid (gid) against the password/group database.
'cpio' is quite useful for copying directories of files and preserving permissions, modification timestamps. The 'remsh' proposed by S.K.Chan would work well. An alternative would be to use 'fbackup' since it will preserve modification timestamps, permissions and symbolic links too.
In any event, once your files have been transferred, you are going to have to deal with changing the uid and gid to the value(s) that match their intended names.
The '-user', '-group' and '-nouser' options of 'find' can be very helpful in finding and changing (with '-exec' or a pipe to 'xargs') the uid and gid values on the destination server. The recursive 'chown -R' is also of value.
Regards!
...JRF...
Whether you use 'tar', 'cpio' or 'fbackup', it is the uid and the gid (numeric) value