What is the best tool to backup my Linux system including user files?

I want to create a backup of my Linux system, including user files, from the command line. I tried using Timeshift but it doesn’t have a CLI argument to include a folder.

I found a guide on dev.to that explains how to use Timeshift from the command line, but it doesn’t mention how to include user files. According to ItsFOSS, Timeshift is designed to protect system files and settings, not user data, so user home directories are excluded by default.

I came across a list of backup programs for Linux on Slant, and BackInTime appears to be the best.

Has anyone used BackInTime to backup the whole system including user files? Are there any other tools that you would recommend?

Edit: would also be nice if it had similar features to Timeshift, like incremental snapshots, weekly snapshots, list, restore and delete snapshots, etc.

utopiah,

So… I’m not going to answer your question, feel free to ignore me.

It’s of course possible to do so and the most obvious way is to use dd since on Linux devices, including disks, are files. Consequently you can indeed “save” the whole system from the CLI.

That being said I would argue it’s a bit waste of time unless you have a very specific, and usually rare, use case e.g testing OSes themselves. Most likely I imagine (and again I’m not directly answering your question here so please do feel free to fix my assumptions or ignore this entirely) you “just” want to “quickly” go from a “broken” state to one where you can “work” again.

It might be because you are doing something “weird” e.g tinkering with the OS itself or lack of “trust” in your current setup.

Here my recommendation would be instead to have a “work” OS and then other partitions, or even virtual machines (not containers) dedicated to testing because it’s truly a great way to learn BUT it shouldn’t come at he risk of your data or your time.

Finally, one of the bounding resource is the speed of your disk and your time to focus. I find that installing a “fresh” OS from a modern USB stick is fast, like take 2 coffees fast. I installed Ubuntu just yesterday, twice, so rather confident about that comment.

What is indeed slow is to copy YOUR files because they are larges and numerous.

So… finally, the “trick” do NOT copy your files despite reinstalling the system! Instead, have a dedicated /home partition so that if you reinstall the OS, your files are untouched. Yes you might have to install a couple of software but if you keep track of them via e.g ~/.history (which BTW will be saved in that situation) you will be able to e.g grep apt install it and be back on track in minutes.

TL;DR: /home partition that is not deleted on OS reinstallation is often IMHO the most efficient way to go.

utopiah,

PS: obviously all the backup tools other recommended are still useful. I personally use rdiff-backup to save important data on my NAS with SSDs over Ethernet. Once again it’s all about speed but only after you identified what actually matters to you and it the vast majority of cases, the whole system ain’t it.

overkill,

I use btrbk (on a btrfs filesystem) and I’ve never been happier. It fits my workflow perfectly: Frequent automated local snapshots with the occasional incremental backup to one of several encrypted external drives. It’s fast and reproducible since it’s all in a single conf file.

Minty95,

How about Cron? If it’s just for copying your files / data, super easy to set up and extremely rapid, it doesn’t do snapshots, it’s just a simple ‘copy my file to another place’, but it works 👍

Kongar,

I like separating backups and snapshots as timeshift recommends. Backups are better handled by a different process copying your files to a remote location (pc failure, house fire, etc.). Lastly, backups are personal, so you gotta do what works for you - whatever makes them happen is good enough in my opinion ;)

My setup (not perfect, but it works for me). I keep one snapshot only - but it is the entire drive including the home folder. It’s really close to a disk image minus the mount folders. This is done to a second local disk via rsync. The arch wiki entry on rsync has the full rsync command for this operation called out. I run this right before a system update.

Backups go to my NAS. Synology in my case. They have a cloud software package like iCloud, OneDrive, etc, except I run it on the NAS and I’m only limited on storage by what drives I throw into it. That software scoops up my user folders on all my PCs and I set it to keep the 10 latest versions.

Then since my NAS is inside my house, I back the entire NAS up to an external hdd and sneaker net it to work and keep it in my office drawer. This protects me from fires and whatnot. I do this monthly. This is a completely manual process.

Some people have accused me of insanity-but it’s really not that hard. I don’t worry about losing pictures of my kids, and it’s aged well with my family (for example, my daughter doesn’t worry about losing stuff while she’s in college - if she writes a paper, 10 copies are kept here at home on the NAS automatically). And none of it was hard to set up, maybe just a bit pricey for the NAS (but it’s got a lot of other super useful things going for it)

So ya, I’d recommend letting timeshift do its thing for snapshots, and I’d rethink what you’re trying to do for backups. I strongly believe they are two different things.

captain_aggravated,
@captain_aggravated@sh.itjust.works avatar

I use BackIntime to back up my user files. I kinda don’t bother backing up my system files; both times I’ve had a major issue of the kind that took the OS down A. were my fault and B. I used as an excuse to do an OS version upgrade.

I like BackInTime quite a bit, it works well, AFAIK it’s a front-end for rsync. BackInTime does incremental backups using hardlinks, and you can set how often it takes backups of what directories and how long to keep them for autodeletion, and you can manually delete them.

kylian0087,

Personaly i like to use borg.

jmbreuer,
@jmbreuer@lemmy.ml avatar

I recently came across ReaR and very much like it so far for my “fire and forget” whole system backups (working data I back up differently, typically something rsync-y).

0x0,

rsync, syncthing, nfs mounts, zfs snapshots… YMMV

MalReynolds,
@MalReynolds@slrpnk.net avatar

You might want to look into what backup means (hint: 3-2-1 in it’s various permutations). Timeshift and btrfs snapshots etc, provide the capability to go back in time if an update fucks you, or you copy over that thing you were working on, they will not help you if a disk fails. Backup prevents you from losing data (you have an offline & cloud encrypted backup of your important stuff, right?), they are not the same. Go back and educate yourself on the difference.

PainInTheAES, (edited )

I like using Kopia to backup my home directory

Maoo,
@Maoo@hexbear.net avatar

If it’s a desktop/laptop, I recommend Pika, which is just a nice frontend and scheduler for borg backup. If it’s a server, I recommend borgmatic.

The nice thing about borg is that it does all of the things people usually want from backups but that are kind of frustrating to do with scripts:

  • Encryption so they’re private and can be uploaded to cloud storage safely.
  • Compression so they aren’t too big.
  • Uses snapshots with deduplication so that they don’t take up too much space.
  • Snapshots happen on a schedule.
  • There’s a retention policy of how many snapshots to keep and at what interval (1 snapshot per year for the last 4 years and 1 per month for 12 months, for example).
  • You can browse through old snapshots to retrieve files.
  • You can restore from a snapshot.
  • Ignore certain files, directories, and patterns.

It is surprisingly difficult to get all of that in one solution, but borg things will do all of the above.

PumpkinDrama,

That’s just what I was looking for. Can I do all that from the command line, and include user files in the backup?

Maoo,
@Maoo@hexbear.net avatar

Yep! Borgmatic is the most useful cli option in my opinion. You can create a single yaml config and call borgmatic from a cron job.

Bisexual_Cookie,

vorta is also a nice front-end for borg

zingo,

Urbackup - Set and forget.

MonkderZweite,

cp and cron.

hallettj,
@hallettj@beehaw.org avatar

I recommend Borg with a CLI frontend like Borgmatic. It’s efficient for running frequent backups, storing only changes since the last backup. It gives you snapshots of each backup. You can mount any snapshot using a virtual filesystem without having to copy everything over.

dataprolet,
@dataprolet@lemmy.dbzer0.com avatar

BackInTime or Borg
BackInTime should be easier to set up, Borg is more feature-rich and flexible. If you have any questions, feel free to ask. I use both for local and remote backup for years.

lemmyvore,

Also Pika Backup which makes it super easy to take backups with Borg.

Kolossos,

Borgmatic also made setting up Borg a breeze.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • uselessserver093
  • Food
  • [email protected]
  • aaaaaaacccccccce
  • test
  • CafeMeta
  • testmag
  • MUD
  • RhythmGameZone
  • RSS
  • dabs
  • oklahoma
  • Socialism
  • KbinCafe
  • TheResearchGuardian
  • SuperSentai
  • feritale
  • KamenRider
  • All magazines