Using the CLI to backup or copy a Linux system

This has been a Great project that you and @kovacslt has worked on. Once the rewrite has been complete, @abhishek might want to include it on one of “It’s Foss” documentation pages.

5 Likes

[quote=“Rosika Schreck, post:18, topic:15299, username:Rosika”]
thrilled to see that backup from a running Linux system can be done after all.
[/quote]r

@Rosika you have grasped the main point of this topic.
It had to be doable because timeshift does backups of live systems… I never understood how timeshift could do it … now I can.

That is the trick… only backup routines that work at filesystem level can reliably backup a running system. So timeshift, Borg, systemback, rsync, tar can do it, but dd, clonezilla, ddrescue, dump need the disk or partition to be unmounted.

2 Likes

We need to put it somewhere where it will be accessible as a reference.
If it stays in the forum , it should be a new topic.

This could be interesting

I lets multiple members edit the first post of a topic
Do you think the forum members could make a wiki?

The ideas are still being clarified… we have to wait.

3 Likes

Hello Neville

We need to put it somewhere where it will be accessible as a reference.
If it stays in the forum , it should be a new topic.

The original documentation should be in GitHub as you already shared the in this thread.
Any discussions would be done in two ways

  • Here (I prefer this one)
  • Discussions tab (same as the “Issue” tab) in GitHub

For the latter see the following project

it has both tabs mentioned (it to make clear the difference)

Anyway any improvement, bug fix, can be discussed here and send the pull request to your account to be merge it

My 2 cents :nerd_face:

4 Likes

I do that in case anyone wants to copy the post and maybe edit it and resubmit.

I want the discussion here… github frightens people, me included

I am looking at a wiki facility in discourse

That would enable us to write community docs.

6 Likes

+1 for that.

5 Likes

Me too, I suggested the same from the beginning. But just in case I mentioned the other option.

Now if Discourse offers an option to let contribution then would be possible replace GitHub in peace

2 Likes

There is this list of links

Or you can search the Tutorials and Resources category.
So we can at least keep track of tutorial posts

But you are right, we need to store them somewhere other than as posts.

3 Likes

This is all very interesting! I currently boot into my live rescuezilla USB stick each Sunday to create a full system image of my Garuda system. With rsync, I might be able to figure out how to create daily differential backups, so I can have access to the state my data was in on any given date, going back, probably 28 days, so I could recover a file in the state it was in on any of the past 28 days, but that would involve syncing both my running system, perhaps on a weekly basis, and my data, but on a daily basis.

Wow! Now you guys really have me thinking! If I come up with anything I think is useful to others.

I’ll update this reply, if that’s OK with you two,

Ernie

5 Likes

Hi Ernie, :waving_hand:

Just out of interest, and perhaps I didn´t get it right:

What do you mean by “system image”?
Is it your root partition only which you backup this way?

I´m asking because my routine currently consists of running clonezilla from a live usb stick once in two months.
I do it this way because I do a “disk backup” of my Linux Lite system. This covers everything from bootloader to the three partitions (root, home and a big data partition).
I wouldn´t be able to perform that procedure once a week. It would take too long. :wink:

Thanks and cheers from Rosika :slightly_smiling_face:

3 Likes

I actually do a full system image of my EFI, Root (/), and /home partitions, but I only keep one image, I delete the previous week’s image before I create the new one each Sunday. My point of doing these backups is to protect me from when/if I do something stupid, or that otherwise makes my system unbootable.

Since I also dual-boot Garuda with Windows on the same PC, I also use Macrium Reflect Free from Windows to create weekly full system images of all partitions (other than the one I store my backups on), and daily differential images the other six days of the week, to create a weekly backup set, that I store on an NTFS partition, because Macrium Reflect is a Windows app.

Ultimately, what I want to accomplish is to be able to duplicate the functionality I get with Macrium Reflect (at least as I use it now) with GNU/Linux tools, so when/if I dump Windows once and for all, I’ll still have that excellent backup regimen I’m using now with Macrium.

Ernie

3 Likes

Hi Ernie, :waving_hand:

Ah, I see. Thank you for the detailed explanation.

Yes, your setup is different from mine.
I don´t dual boot and I don´t have an EFI partition. I do it the legacy way.

Your strategy seems very well thought out. Splendid.

That seems to be a super-secure method. :+1:

Thanks for the information, Ernie.

Many greetings from Rosika :slightly_smiling_face:

3 Likes

I looked at the web site and this does sound interesting.
Do you know if this software can backup only selected partition?

4 Likes

That is not a good idea Ernie. You should keep at least the last 2 images. Are you short of disk space?

For daily backups, I only backup my data directories, not the system. I just run an rsync before I shutdown at night, always onto the same filesystem, so it increments it, and I end up with 2 identical copies of my data on 2 separate internal disks… a bit like raid but done manually.

4 Likes

We omitted --link-dest of rsync, because Nevill found it too complex at the moment.
If you want incremental backups, that is the option you are looking for.

2 Likes

Worse than that, I could not understand it at all.
I will have another try now that you have told me it helps with incremental backups? …thought rsync was always incremental, in the sense that it only copies files not in the destination or modified.

From the man pages

" –link-dest=DIR
This option behaves like –copy-dest, but unchanged files are hard linked from DIR to the destination directory.

–copy-dest=DIR
This option behaves like –compare-dest, but rsync will also copy unchanged files found in DIR to the destination directory using a local copy.

–compare-dest=DIR
This option instructs rsync to use DIR on the destination machine as an additional hierarchy to compare destination files against doing transfers (if the files are missing in the destination directory). If a file is found in DIR that is identical to the sender’s file, the file will NOT be transferred to the destination directory. This is useful for creating a sparse backup of just files that have changed from an earlier backup."

So you end up with an old full backup, plus another separate filesystem that is things changed only? That is like old fashioned tape backups.
Why is that better than rsyncing the changed files into the original full backup?
It would make recovery more complicated, but it would allow recovery to a specific date. That might be an advantage.

and
the link-dest bit uses hard links… I dont like that… maybe compare-dest or copy-dest.

3 Likes

Absolutely! You select the partitions to be backed up as you proceed through the onscreen prompts. This way you only back up what you want, for example, it you only want your /home partition, or only your / (root) partition. This is one reason I use it. I usually choose to back up everything on my Garuda installation except the partition where I’ll save the backup file.

Ernie

4 Likes

A bit, at present. When I can save up enough money, I’m going to upgrade to a 1 or 2 TB M.2 NVME drive, but my laptop only came with about .5TB. After I increase storage space, I’ll probably set up a more robust paradigm.

Ernie

2 Likes

Thank you, @kovacslt! I appreciate your response!

Ernie

2 Likes

I have a desktop with .5Tb ssd. It is my spare. I have 2 Linuxes in it. I use a usb drive for its backup.

You need a large (eg 4Tb or greater) external powered usb backup drive. Two reasons

  • it is independent of your computer… ie safe if computer dies
  • enough space to keep versions (eg daily, weekly) of your backups.

You can move it around between computers, and turn it off when not in use.
By all means get that internal drive, but that is not really an ideal backup solution.

Example
https://www.scorptec.com.au/product/hard-drives-&-ssds/external-drives/78434-wdbbkg0100hbk-aesn

That is a large model. You can get smaller.

2 Likes