What is the correct way to not be using the home directory during a backup of it?

co flag

So I obviously shouldn't just run rsync backing up /home while I'm plainly logged in, as the state of settings files could be inconsistent or whatever else, since /home is being used.

One solution is to enable signing in as root on the login screen and going from there as root, but I've heard that is ill-advised.

What's the right way to not be using /home during a backup of it?

David avatar
cn flag
If you are only running rsysnc after a reboot and just logged in I do not see how you would have critical open files.
uz flag
What @David says, "critical" being the important word here. You'll see that if you do two `rsync` operations, one after the other, while logged in, the second one will only backup cache files and other transient data.
PonJar avatar
in flag
I use rsync to backup my home directory. It is run daily by cron and has never had an issue. I have never seen questions about an issue like the one you are concerned about. I guess if you are making changes to a file while rsync is running it may capture the change or it may not, depending on whether that file is processed. Alternatively it’s possible rsync re-syncs the file at the end of the job but I doubt it does that. Bottom line it’s probably irrelevant.
uz flag
@PonJar As far as I know `rsync` does not retry to sync a changed file at the end of the job. It lists the files to be copied at the start of the job. If a file is modified while `rsync` runs before it is its turn to be transferred, the modified state will be copied. Files created since the start of the run will be silently omitted. Only when a file was deleted, `rsync` will complain (a bit). This is how I understand it; I may be wrong.
Marco avatar
br flag
Put your home on a partition/filesystem which can handle snapshots, e.g. lvm, btrfs.
cn flag

If you want to backup your home directory while it is not in use, then perform the backup from within a different account on that computer or from a live session. For practical purposes, though, you should not worry. Still, prefer to do the backup when all programs are closed, i.e. before or after work.

I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.