LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   rsync doubt (https://www.linuxquestions.org/questions/linux-newbie-8/rsync-doubt-904221/)

loveulinux 09-21-2011 10:05 AM

rsync doubt
 
Hi....All,
Could anybody please tell, is there any problem while restoring. Because I have to do this because of some reasons.
1) "rsync -avz --progress source(UserPC)_dir desti(500GB_usbHDD)_dir"
2) "rsync -avz --progress source_(500GB_usbHDD)_dir desti(1TB_usbHDD)_dir"
3) rm -rf *(from 500GB)
Now does everything works fine if I restore directly from 1TB to user's PC ? Because 1TB HDD was backed up from 500GB HDD not directly from user's PC
4) "rsync -avz --progress source(1TB_usbHDD)_dir desti(UserPC)_dir"

I have one more doubt, how to find difference between two of the same main folders using diff command
I ran "diff source_dir desti_dir" it says common directories no changes. If I remove any one of the subdirectory then it will say only with that existing subdirectory. But if remove/modify any file inside the subdirectories it is not showing the difference.

MensaWater 09-21-2011 01:07 PM

rsync copies files from one directory to another. So long as your command can see the source and the target and the target is as large or larger than the source it doesn't matter where it was originally created.

However, the main use of rsync is transfer from one server to another - if you're just copying to a USB device then physically moving it to another machine you might have just as much luck using a recursive copy (cp -r) rather than rsync.

Similarly diff checks files beneath a directory if both the source and target are directories but is not recursive unless you give the recursive flag (-r or --recursive).

Recursive means the directory and all subdirectories and files below it. Many commands will do that but often require you to put in a flag for it to insure you mean to do it.

Most UNIX/Linux commands have manual pages (a/k/a man pages) that you can get more information from so it you want more detail on the cp (copy) command type:
Code:

man cp
Or the diff command:
Code:

man diff
Or the rsync command:
Code:

man rsync

loveulinux 09-21-2011 09:26 PM

rsync doubt
 
Thanks for your kind reply. I am using rsync because as per rsync info it copies only those if any modifications/changes are made since last backup and backing up is not for one time. Again after few weeks or months the employee may ask to backup because of bad condition of their laptop hard disk. So tell me which you would like to prefer now rsync or cp? If you tell for cp then does it not consume time as well as space?
And if you say for rsync, does everything works fine if I restore directly from 1TB HDD to user laptop during the restoration. Because the data which is stored in 1TB was not directly backed up from user's laptop, instead it was backed up from 500GB. I will be waiting for your kind reply.

Quote:

Originally Posted by MensaWater (Post 4478390)
rsync copies files from one directory to another. So long as your command can see the source and the target and the target is as large or larger than the source it doesn't matter where it was originally created.
However, the main use of rsync is transfer from one server to another - if you're just copying to a USB device then physically moving it to another machine you might have just as much luck using a recursive copy (cp -r) rather than rsync.

Similarly diff checks files beneath a directory if both the source and target are directories but is not recursive unless you give the recursive flag (-r or --recursive).

Recursive means the directory and all subdirectories and files below it. Many commands will do that but often require you to put in a flag for it to insure you mean to do it.

Most UNIX/Linux commands have manual pages (a/k/a man pages) that you can get more information from so it you want more detail on the cp (copy) command type:
Code:

man cp
Or the diff command:
Code:

man diff
Or the rsync command:
Code:

man rsync


MensaWater 09-22-2011 01:33 PM

As I noted in my original reply:

Code:

rsync copies files from one directory to another. So long as your command can see the source and the target and the target is as large or larger than the source it doesn't matter where it was originally created.
I wasn't saying you could NOT use rsync - I was just saying there were other ways to copy things from one server to another. You now say you're intent is to use it for backup and restore. You can do that but there are other ways of doing backups such as Bacula. I haven't used it myself but others on this forum have said good things about it:

http://www.bacula.org/en/

loveulinux 09-23-2011 10:56 PM

rsync doubt
 
Sir, Thank you very much. You cleared my doubt by saying "rsync copies files from one directory to another. So long as your command can see the source and the target and the target is as large or larger than the source it doesn't matter where it was originally created".
I am using this because it is very user friendly. Since I don't have much experience about bacula, I can't say that I can't use it. But before using bacula on realtime I should be perfect. Thanks for clearing my doubts.

Quote:

Originally Posted by MensaWater (Post 4479443)
As I noted in my original reply:

Code:

rsync copies files from one directory to another. So long as your command can see the source and the target and the target is as large or larger than the source it doesn't matter where it was originally created.
I wasn't saying you could NOT use rsync - I was just saying there were other ways to copy things from one server to another. You now say you're intent is to use it for backup and restore. You can do that but there are other ways of doing backups such as Bacula. I haven't used it myself but others on this forum have said good things about it:

http://www.bacula.org/en/



All times are GMT -5. The time now is 05:17 AM.