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/)

Petri Kaukasoina 01-10-2024 11:14 AM

Quote:

Originally Posted by maybeJosiah (Post 6475848)
Just looked up again and yes, all I need to record extra is permissions and executability. I already have all timestamps. With that I think this is what to use.
Code:

sudo rsync -vrlDAXHxog --progress --delete --open-noatime --exclude='(USB at)' (like '/' but not) (copy to directory)

-A implies --perms. -E preserves the executability when --perms is not enabled. If --perms is enabled, this option is ignored.
Sorry, no use for your extra records of permissions/executability.

Quote:

Originally Posted by IsaacKuo (Post 6475835)
Code:

rsync -vaxHAX --delete --progress --exclude home/kuo/.cache /mnt/sda1/* /mnt/sdc1/

The only real difference between -vrlDAXHxog and -vaxHAX is that the latter preserves mtime. But for some reason you want to set it yourself.

IsaacKuo 01-10-2024 11:14 AM

Quote:

Originally Posted by maybeJosiah (Post 6475858)
Oops, it was /mnt/... not as I said, sorry. X E.

As far as the OS is concerned /mnt/ is just some random normal directory. There's nothing special about it, and you can stuff it with whatever you want.

But by convention, it's a popular place to stick mount points. No special reason or benefit to putting them there.

Once upon a time, /mnt was used for mount points for removable media like floppies and CDs. But the proliferation of USB thumb drives made this increasingly confusing so they decided to move this stuff to /media.

That just left /mnt as a boring directory, so the only stuff that ever showed up there was manually put there.

rclark 01-10-2024 11:34 AM

Quote:

/media... That just left /mnt as a boring directory,...
I always create a /mnt/usbdrive directory there. Then when I attach a USB backup drive, I always manually mount it to /mnt/usbdrive. That way none of my scripts have to change when I run external backups. I personally dislike the /media/ concept, but at least I can get around it when I need to.

FWIW, -av --delete options to rsync are the only ones I've ever needed to backup my data to a linux formatted drive (say ext4).

maybeJosiah 01-10-2024 12:33 PM

I just like to be safe with backups. No losing stuff. Thank you all, especially IsaacKuo. Also, I try to store as little as possible so that thing about -A and --perms is good. If I ever have like a credits thing for a backup program that uses this, would anyone like to specify any more than user name to acknowledge? Like my email is maybejosiah@aol.com if you want a private message. X E.

rclark 01-10-2024 02:34 PM

Actually -a (--archive) equals -rlptgoD. Notice -p (--perms). Therefore if you use -a you already have --perms. Never used -A as don't use ACLs. In fact I had to just look them up to see why even present in Linux as owner/group/public seemed quite adequate for access control.

maybeJosiah 01-10-2024 04:15 PM

Thanks rclark, I was going to say that after reading rsync --help again but anyway did not get around to it. X E.

maybeJosiah 01-11-2024 10:04 AM

I found that IsaacKuo command does almost what like mine does. All I would add is "E". I read rsync --help again and could not find E included in -aAxXHv. Also, unsure if I should try to use rsync on that drive to back up or like my 22.04.2 desktop bootable USB flash drive version of rsync. That especially upon restore. I know how to get where rsync is. I am unsure if by default I would be using rsync on that drive or which rsync I would be using if I am in terminal at that drive. Obviously end all from directories with /. X E.

Petri Kaukasoina 01-11-2024 10:46 AM

Quote:

Originally Posted by maybeJosiah (Post 6476034)
I read rsync --help again and could not find E included in -aAxXHv.

Quote:

Originally Posted by Petri Kaukasoina (Post 6475859)
-A implies --perms. -E preserves the executability when --perms is not enabled. If --perms is enabled, this option is ignored.

Let me shake your world: you can find all the info you need from the man page:
Code:

man rsync

maybeJosiah 01-11-2024 11:59 AM

Okay, I read that "man rsync", so "E" is disabled if "--perms" is but I am unsure if executability is still preserved. I guess I will just include it even if it is ignored because it never said --perms preserves executability. Is there any way you know of I could preserve executability or do I need to record a file to save it? Also, is that "man rsync" online or on device and if it is on device, can I remove stuff like that? No need to answer about "man rsync", just executability. Many of like my desktop things are executable so that is one thing I would prefer to preserve. That and timestamps. Timestamps I may need to store all of because setting some with debugfs may affect others. X E.

IsaacKuo 01-11-2024 12:22 PM

-A, --perms, and -E all preserve executability.

-A includes --perms, which includes -E.

Petri Kaukasoina 01-11-2024 12:37 PM

Quote:

Originally Posted by maybeJosiah (Post 6476053)
"E" is disabled if "--perms" is but I am unsure if executability is still preserved.

Yes, it is preserved: executability is only a subset of permissions. When permissions are copied, it includes read, write, exec for user, group, others.
Quote:

Also, is that "man rsync" online or on device and if it is on device, can I remove stuff like that?
Man pages are on your machine: file /usr/man/man1/rsync.1.gz or similar. 'locate rsync.1' should find it.
Quote:

Timestamps I may need to store all of because setting some with debugfs may affect others.
Only mtime is needed. And it is preserved with 'rsync -a' as everything else which matters.

maybeJosiah 01-11-2024 12:45 PM

Can you point me to some documentation that says executability is a subset of permissions? Also, call me sentimental but I prefer all timestamps, even if they do not normally matter. X E.

maybeJosiah 01-11-2024 12:52 PM

Okay, I take your word and like my research's word on that executability thing. Solved but I am still unsure whether I should specify where rsync is on like my main drive for backup or restore. X E.

Petri Kaukasoina 01-11-2024 12:53 PM

Quote:

Originally Posted by maybeJosiah (Post 6476061)
Can you point me to some documentation that says executability is a subset of permissions?

Everything is in the man pages (usually):
Code:

man chmod

Petri Kaukasoina 01-11-2024 12:57 PM

Quote:

Originally Posted by maybeJosiah (Post 6476063)
I am still unsure whether I should specify where rsync is on like my main drive for backup or restore.

It's up to you. Plain 'rsync' is enough but you can also specify the path. Maybe it's /usr/bin/rsync. 'whereis rsync' or 'which rsync' will tell.


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