Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am creating a new Virtual Linux system, or should say that it is done, but I need to move the information from the old system to the new system and I am looking for most expediant way to do this. These are both development machines that I am moving from/to. I need to be able to shut one down at the end of a days business and bring the new one up the next morning ready to go. Here are my systems.
Old system -> Physical Box RedHat Enterprise 3 (ES), /u is pointing to a separate hard device on the system which has been set up as a filesystem. I have this filesysem shared through Samba and is available to everybody.
New System -> Virtual Machine RedHat Enterprise 3 (ES), /u is pointing to a Virtual Disk on a RAID.
Options:
1. I can mount the Samba share on the new box and "cp -pr <old> <new>.
the problem with this is the mount command sets the permissions for all files/directories on the mount.
2. I can tar the files/directories on the old system. copy/ftp/whatever the file over to the new system and untar it into the new system. This would probably restore the files to their orignal owner/group and permissions. The problem with this is it is really slow. I started a tar last night at 10:00 pm and it is still running this morning.
Are there any other options that might one) be faster two) keep permissions/ownership the same?
I have STF for answers, but nothing that I have found stands out with an answer. Maybe I am asking the wrong search keywords. I have to believe that someone has run into this before.
Check out the '-e' switch. If you are going to use this frequently, it might be convenient to set up ssh keys for passwordless ssh logins. You, as the rsync user, must have an account on the peer host, which can be accessed via ssh or rsh.
If you want to transfer an entire filesystem or directory of files, you could try using tar this way to transfer the files:
tar -C sourcedir/ -cf - . | ( tar -C <mounted-target-dir> -xf - )
There may be more options you need to preserve permissions, and deal with links properly. Keep in mind that the smbfs has around a 2 GB filesize limit. You might consider using NFS instead. The permissions, ownerships should transfer properly then, although, you may need to use "star" if you have to deal with ACLs and Security contexts.
this brought over files that the first command could not because it was denied access. But then it created the files on the new system my name and group.
If you want to transfer an entire filesystem or directory of files, you could try using tar this way to transfer the files:
tar -C sourcedir/ -cf - . | ( tar -C <mounted-target-dir> -xf - )
There may be more options you need to preserve permissions, and deal with links properly. Keep in mind that the smbfs has around a 2 GB filesize limit. You might consider using NFS instead. The permissions, ownerships should transfer properly then, although, you may need to use "star" if you have to deal with ACLs and Security contexts.
I not sure how to set up the directory for nfs on the source system. You think that this will allow the transfer with owner/group and permissions?
I tried this...
mount -t nfs <host>:Programs /u3
and it came up with this.
mount: RPC: Program not registered
UPDATE: I guess I am getting better at reading forums and manuals. I have been able to create a NFS share and get it mounted on the new system.
using the command ...
cp -prv /u3/* .
... I have been able to start moving the files and they are maintain their original owner/group and permissions. And it seems rather quick!
Unless I have problems, thanks for all of the helpp
rsync may be a better choice if it also deletes files in the target that were deleted in the source. You might consider using tar with the --incremental --listed-incremental=SNAPSHOT-FILE to produce a backup of the source directory and then restore to the destination with the --listed-incremental=SNAPSHOT-FILE option. According to the info manual, this will delete files in the target that were deleted in source since the last incremental backup. This would also kill two birds with one stone. Replication and Backup. I don't know if you can use snapshot files when using tar to copy files from a source to a target machine. If you can, you could just copy updated files and delete obsolete files in the target machine.
I touched a file and then ran the above command to transfer it over. Testing with "find /media/lbigdisk/etap -cmin -2", the file I touched did replace the copy in the destination.
However moving a file out of the source directory, and rerunning the incremental backup, the file in the destination wasn't deleted. If you were to restore from a real incremental backup, it should be.
If you use NFS, you either want to map uid and gid numbers (such as using NIS), or keep them the same across all your hosts. This could have been the problem with rsync. It is the actual number that is copied. If the same user has a different UID number, that could be the user ownership problems you were seeing. As an example, Red Hat and Mandriva start normal UIDs at 500 while SuSE starts at 1000. To be honest, I used the SuSE NFS server and NFS client config modules in YaST2. They allowed me to search the network for NFS shares in the dialog and configured /etc/exports and /etc/fstab for me.
Last edited by jschiwal; 09-23-2007 at 05:38 AM.
Reason: Added UID info.
I didn't have that many files to get across and I just couldn't get rsync to work right, so I used the cp command and I am done, I will have to read up more on rsync and try it sometime when I don't have a lot of work to do.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.