[SOLVED] What rsync command should I use for maximum preservation?
UbuntuThis forum is for the discussion of Ubuntu Linux.
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.
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.
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.
/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).
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.
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.
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.
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.
"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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.