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

IsaacKuo 01-10-2024 09:58 AM

Oh I should not that my examples do NOT include -H, which preserves hard links. I perhaps should start including it. Something like this:

Code:

rsync -vaxHAX --delete --progress --exclude home/kuo/.cache /mnt/sda1/* /mnt/sdc1/
Adding in that H preserves hard links. What my command currently does is create multiple copies of a file instead of hard linking them to a single file. This can be a problem for something that modifies a file in place (thus, modifying all hard links to it as well).

Obviously, it can also be a disk space issue.

But for my usage, this is not really a problem. The only place where I use hard links is in multiple snapshot type backups.

maybeJosiah 01-10-2024 10:01 AM

I am not trying for efficiency or size reduction, I just try for a full copy. I am starting to think "tar" might be a good idea but I like raw form for efficiency. Yes I have read about sparse files with rsync. I do not know what it would be used for with this though. X E.

maybeJosiah 01-10-2024 10:07 AM

IsaacKuo, how can I preserve symbolic links or create them again. I seem to need them. Storage space is no object. I have a 2.1TB USB stick. X E.

maybeJosiah 01-10-2024 10:14 AM

Looks like I can use "ln -s" for this so I can write this to a file and restore symbolic links from that. X E.

maybeJosiah 01-10-2024 10:25 AM

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

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

Looks like missing "EUtp" so that is what I should store as a file. I just realized "l" is in "a" so symbolic links are preserved. That means executability, permissions, and I think rest are timestamps which I already record. Forgot what "t" was. Also, I like that --open-noatime so I preserve original access times. X E.

maybeJosiah 01-10-2024 10:30 AM

To explain that last post, that was for comparing and finding what I should record with "that means". Sorry I was confusing. X E.

pan64 01-10-2024 10:33 AM

Quote:

Originally Posted by maybeJosiah (Post 6475826)
By maximum preservation I mean that if it can be preserved it gets preserved. Problem I am trying to solve now is how to lose nothing if I lost like my computer or like purged python3 like I did last time. With that, in like my original post I had all rsync options I thought would preserve everything. I am now thinking since -axAXv with other options as posted by IsaacKuo seems to work on a root operating system I could try to write all not included properties of that to a file and restore from that. I see symbolic and hard links are not included. /bin is a symbolic link on like my system and to run Bash I need #! /bin/bash so I obviously need that. Do you think adding -H for hard links and another letter for symbolic links would work with a like root rsync command? Problem I am having is how to have a complete backup and like title says, if I want rsync to preserve all it can even if it is only for /home/norvel/ then what command options and stuff should I use? X E.

If you want to save every and each file with all the attributes you need to create a full filesystem backup. No tool will manage everything.

maybe I would try the tool rsnapshot.

maybeJosiah 01-10-2024 10:36 AM

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.
Quote:

sudo rsync -vrlDAXHxog --progress --delete --open-noatime --exclude='(USB at)' (like '/' but not) (copy to directory)
Am I missing anything? X E.

maybeJosiah 01-10-2024 10:43 AM

This seems solved now but to be sure, is that last command I posted safe? I understand no one tool does all currently but with rsync and some code I think I can do a full backup. Am I correct in that? Also, I seem to be prefering raw paths while IsaacKuo is using /dev/... so why would I use that? I am trying for full as system was restorable. This includes what I delete stays deleted. X E.

maybeJosiah 01-10-2024 10:53 AM

Permissions seems complex to get and set. First 10 characters of "ls -l" are permissions but I do not know how to re-encode it for "chmod" Can I include "p" or should I try to re-encode? X E.

maybeJosiah 01-10-2024 11:00 AM

https://zzzcode.ai/answer-question?i...8-d98fb17da0c3

I just realized there is an easy way with "stat" and "chmod". Problem of permissions solved. Now just if like my previous to use command is safe. X E.

IsaacKuo 01-10-2024 11:01 AM

Quote:

Originally Posted by maybeJosiah (Post 6475837)
IsaacKuo, how can I preserve symbolic links or create them again. I seem to need them. Storage space is no object. I have a 2.1TB USB stick. X E.

Symbolic links are replicated with the "l" option or anything that includes the "l" option. In particular, the "a" option includes the "l" option.

As to whether or not the replicated symlink works ... that depends on stuff later on, and may depend on whether the symlink is relative or absolute.

Either way, the "l" or "a" options will replicate all symlinks exactly as is - even broken ones.

maybeJosiah 01-10-2024 11:04 AM

Sorry I did not understand that "l" was in "a" before. X E.

IsaacKuo 01-10-2024 11:04 AM

Quote:

Originally Posted by maybeJosiah (Post 6475851)
Also, I seem to be prefering raw paths while IsaacKuo is using /dev/... so why would I use that?

Uh, no. I am not using /dev/, nor would it be advisable to ever try to use rsync with anything in /dev/. It only makes sense to use rsync with mounted normal file systems. (The currently running OS file system is indeed a normal file system, with mount point "/".)

maybeJosiah 01-10-2024 11:06 AM

Oops, it was /mnt/... not as I said, sorry. X E.


All times are GMT -5. The time now is 08:41 PM.