LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 01-10-2024, 09:58 AM   #16
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465

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.
 
1 members found this post helpful.
Old 01-10-2024, 10:01 AM   #17
maybeJosiah
Member
 
Registered: Jan 2024
Location: USA
Distribution: Ubuntu, Android, Ubuntu Touch, Jolla Sailfish maybe
Posts: 195

Original Poster
Blog Entries: 2

Rep: Reputation: 5
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.
 
Old 01-10-2024, 10:07 AM   #18
maybeJosiah
Member
 
Registered: Jan 2024
Location: USA
Distribution: Ubuntu, Android, Ubuntu Touch, Jolla Sailfish maybe
Posts: 195

Original Poster
Blog Entries: 2

Rep: Reputation: 5
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.
 
Old 01-10-2024, 10:14 AM   #19
maybeJosiah
Member
 
Registered: Jan 2024
Location: USA
Distribution: Ubuntu, Android, Ubuntu Touch, Jolla Sailfish maybe
Posts: 195

Original Poster
Blog Entries: 2

Rep: Reputation: 5
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.
 
Old 01-10-2024, 10:25 AM   #20
maybeJosiah
Member
 
Registered: Jan 2024
Location: USA
Distribution: Ubuntu, Android, Ubuntu Touch, Jolla Sailfish maybe
Posts: 195

Original Poster
Blog Entries: 2

Rep: Reputation: 5
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.
 
Old 01-10-2024, 10:30 AM   #21
maybeJosiah
Member
 
Registered: Jan 2024
Location: USA
Distribution: Ubuntu, Android, Ubuntu Touch, Jolla Sailfish maybe
Posts: 195

Original Poster
Blog Entries: 2

Rep: Reputation: 5
To explain that last post, that was for comparing and finding what I should record with "that means". Sorry I was confusing. X E.
 
Old 01-10-2024, 10:33 AM   #22
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,923

Rep: Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319
Quote:
Originally Posted by maybeJosiah View Post
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.
 
1 members found this post helpful.
Old 01-10-2024, 10:36 AM   #23
maybeJosiah
Member
 
Registered: Jan 2024
Location: USA
Distribution: Ubuntu, Android, Ubuntu Touch, Jolla Sailfish maybe
Posts: 195

Original Poster
Blog Entries: 2

Rep: Reputation: 5
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.
 
Old 01-10-2024, 10:43 AM   #24
maybeJosiah
Member
 
Registered: Jan 2024
Location: USA
Distribution: Ubuntu, Android, Ubuntu Touch, Jolla Sailfish maybe
Posts: 195

Original Poster
Blog Entries: 2

Rep: Reputation: 5
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.
 
Old 01-10-2024, 10:53 AM   #25
maybeJosiah
Member
 
Registered: Jan 2024
Location: USA
Distribution: Ubuntu, Android, Ubuntu Touch, Jolla Sailfish maybe
Posts: 195

Original Poster
Blog Entries: 2

Rep: Reputation: 5
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.
 
Old 01-10-2024, 11:00 AM   #26
maybeJosiah
Member
 
Registered: Jan 2024
Location: USA
Distribution: Ubuntu, Android, Ubuntu Touch, Jolla Sailfish maybe
Posts: 195

Original Poster
Blog Entries: 2

Rep: Reputation: 5
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.
 
Old 01-10-2024, 11:01 AM   #27
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Quote:
Originally Posted by maybeJosiah View Post
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.
 
Old 01-10-2024, 11:04 AM   #28
maybeJosiah
Member
 
Registered: Jan 2024
Location: USA
Distribution: Ubuntu, Android, Ubuntu Touch, Jolla Sailfish maybe
Posts: 195

Original Poster
Blog Entries: 2

Rep: Reputation: 5
Sorry I did not understand that "l" was in "a" before. X E.
 
Old 01-10-2024, 11:04 AM   #29
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Quote:
Originally Posted by maybeJosiah View Post
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 "/".)
 
1 members found this post helpful.
Old 01-10-2024, 11:06 AM   #30
maybeJosiah
Member
 
Registered: Jan 2024
Location: USA
Distribution: Ubuntu, Android, Ubuntu Touch, Jolla Sailfish maybe
Posts: 195

Original Poster
Blog Entries: 2

Rep: Reputation: 5
Oops, it was /mnt/... not as I said, sorry. X E.
 
  


Reply

Tags
backup, command line, restore, rsync, usb



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
media, ex: floppy disk, HDD short life span, forget how to use; preservation rico001 Linux - General 1 05-29-2021 03:17 PM
Making mirrow using mkraid with preservation information on one of the disks. Shakin_Aleksey Linux - Server 1 07-24-2011 10:21 PM
Searching for an appropriate Interprocess communication with data preservation Esika Programming 2 06-06-2011 05:07 AM
Debian / Ubuntu : Config File Preservation and Merging? tinyTux Debian 2 03-22-2011 11:19 AM
AIX 4.3.3 Preservation Install ajoshay9 Linux - Software 0 12-01-2003 11:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 01:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration