LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   What rsync command should I use for maximum preservation? (https://www.linuxquestions.org/questions/ubuntu-63/what-rsync-command-should-i-use-for-maximum-preservation-4175732619/)

maybeJosiah 01-11-2024 12:57 PM

Thanks, read. X E.

maybeJosiah 01-11-2024 12:59 PM

I think I prefer on main drive, newer stuff should have bug fixes and like and yes, I know how to find it. Thanks. X E.

maybeJosiah 01-11-2024 01:02 PM

Like my main concern about using rsync is if I overwrite rsync, what happens to that running program with restore. With that reply I assume it would keep running fine. X E.

IsaacKuo 01-11-2024 01:28 PM

If you type in the command "rsync", the bash shell will search for a command named "rsync" within the current $PATH. You can see the $PATH with this:

Code:

echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

It searches these paths.

This is similar to how things work on, say, MS-DOS, but in Linux this $PATH will basically never include the current directory.

The bottom line is that it will only execute the copy of rsync that's from the currently running OS, and never any other copy of rsync unless you for some (stupid) reason specify otherwise with a full path or relative path to some other copy of rsync.

pan64 01-11-2024 02:10 PM

Quote:

Originally Posted by maybeJosiah (Post 6476069)
Like my main concern about using rsync is if I overwrite rsync, what happens to that running program with restore. With that reply I assume it would keep running fine. X E.

In general overwriting a file which is currently in use is not a good idea, that may have strange side effects.
In such cases, the operating system may continue to run the copy in RAM, as long as the system does not attempt to access the original file on disk. This can cause an instant crash (of that app).

Petri Kaukasoina 01-11-2024 02:25 PM

There is no danger with rsync. For example, if you have /usr/bin/rsync on disk and want to restore a different version from backup: rsync copies to file name /usr/bin/rsync.NKnduM (last six characters are random). Only when done copying, it renames it to /usr/bin/rsync. So, it doesn't use the old file's inode but creates a separate one. The running rsync process continues to use the old binary on disk and the old inode is removed from the disk only after the last user stops using it.

Petri Kaukasoina 01-12-2024 05:54 AM

Quote:

Originally Posted by Petri Kaukasoina (Post 6475859)
The only real difference between -vrlDAXHxog and -vaxHAX is that the latter preserves mtime. But for some reason you want to set it yourself.

By the way. If you use 'rsync -av' (mtime preserved) and you interrupt copying, another 'rsync -av' continues from that. Or if you change some files and run 'rsync -av' again, it will only transfer the new changed files.

But your command 'rsync -vrlDAXHxog' (mtime not preserved) will always start from the beginning and copy everything again after an interrupt.

Quote:

Rsync finds files that need to be transferred using a "quick check" algorithm (by default) that looks for files that have changed in size or in last-modified time.

rclark 01-12-2024 03:49 PM

Quote:

... if you change some files and run 'rsync -av' again, it will only transfer the new changed files.
That is why I like 'rsync -av --delete' as it only transfers/deletes files that have changed. Subsequent backups are a lot quicker than the first one to keep everything in sync.


All times are GMT -5. The time now is 06:48 PM.