How do you backup your Linux box?
-
The request has been made to open up a discussion on how some us go about backing up our Linux systems and PCs. So, here were are.
I've tried a few backup applications on my Linux PCs over the years, but I always seem to prefer just doing the process myself, simply by using tar.
I can appreciate at how much effort goes into the GUI backup applications, trying to make them as easy as possible for users. But, I guess because I've been doing it using the command line and tar for so long, it's just the method I'm most comfortable with. I trust it, I know exactly what it's doing, and I have complete control over the process. I also find it easier to do "target" backups of anything on my system.
But, most importantly, I like it's compatibility. tar is available on every Linux system. I've never come across a Linux desktop that didn't have it installed. So, no matter the distro, I can pretty much guarantee that any backups I've ever done with it will always be usable no matter what flavour of Linux I happen to be using at the time.
If I want to use tar via the GUI desktop, then I just run XArchiver.
It requires a bit of "grunt work" to use, but once you've spent a bit of time using tar, it is pretty easy. And if you really want it to do timed backups, you can get it to do so with the help of cron.
What do you use?
Extra Tid-bit:
Here's a little snippet from history, from way back in 2003. I wrote this how-to on using tar to back up your Linux user files onto FLOPPY DISKS!!!
Wayback Machine Dave's Desktop Archive
Just goes to show you how long I've been backing up files this way.
-
@dbouley OMZ, given your terminal-based pedigree & history here, i feel a bit too inadequate to post anything much about my current & historical methods, which are & were all entirely GUI-based.
All i shall mention, is that my backup need spans files & directories in my home, data & a third partition, but that it is imperative to exclude numerous specific individual files & subdirectories from within those partitions. On occasion, as my data storage arrangements morph over time, i need to tweak my backup GUI's settings. Historically, some of my dedicated apps have handled this better than others.
-
@guigirl said in How do you backup your Linux box?:
OMZ, given your terminal-based pedigree & history here, i feel a bit too inadequate to post anything much about my current & historical methods, which are & were all entirely GUI-based.
Ppfffft. Don't feel that way at all. I'm a dinosaur, very stubborn to change. So, I'm happy to learn about how effective and efficient GUI tools have become on the Linux desktop. Please share all that you know.
Being a KDE user yourself, do they not still support their own backup solutions (Ark or something like that)?
-
@dbouley said in How do you backup your Linux box?:
from history, from way back in 2003
After reading this earlier, i was away from my pooter for a little while for post-brekkie teeth-brushing etc. Mulling over recent posts/threads whilst i did so, i somehow managed to make a non-trivial error in my recollection ... i thought you'd said "1973". As the numerous implications of that slowly dawned on me, i felt utterly astonished, but then also honoured that finally our humble forum has an honest to goodness time-travelling parallel-universe Immortal amongst us. Ofc, once i came back to pooter & re-read your actual date, i felt a sudden fury that you had so gravely mislead me!
-
@guigirl said in How do you backup your Linux box?:
Ofc, once i came back to pooter & re-read your actual date, i felt a sudden fury that you had so gravely mislead me!
Sorry to disappoint you.
-
@dbouley said in How do you backup your Linux box?:
Please share
Ta, ok.
KDE ... support their own backup solutions ... ?
Yes, & ironically i have only just very very recently discovered this. Fwiw, my 2013 to now:
Actively used for my weekly external backups [to USB3 sticks]:
- Areca --> luckyBackup --> BackInTime --> Kup
Actively used for my weekly internal backups [to a dedicated encrypted partition]:
- Grsync
Assessed but rejected along the way:
- Déjà Dup, DirSync Pro, Mint Backup-Tool, fwbackups, kBackup
My recent file-notes on the two K's [sorry for the verbosity; this is a literal copy & paste from my working notes, which i'm too lazy to bother editing for here now ... just ignore it all if too much]
12/1/22: For the past few years I’ve been vaguely aware of a native KDE app called, duh,
kBackup
. Though I am still basically happy enough with BackInTime [except that my occasional small changes to my targets often causes it to go bonkers with failed runs & floods of error messages, & forced reboots to stop it], I’m always interested to consider potential better candidates, so tonight I gave this one a red-hot go. It’s interesting to me because it harks back to the Areca-style app with respect to functionality, in that it uses an entirely hierarchical-tree paradigm, with check-boxes against each partition, & all child sub-directories & files within each partition. It also handles Full & Incremental backups, with optional compression. It outputs the result to a user-specified target destination [so I used my USB stick]. Finally, though pretty visually-busy, the GUI is quite good IMO.
Alas, this app at the moment is A Big Fat Failure for me; I’m really disappointed.
• My initial backup profile I created, included using compression. I tried three times, but all three attempts simply froze solid at only ~2% progress.
• Next I deselected compression, & this time the progress was great; it went gang-busters, all the way through to a notionally successful completion [with status message confirming]. But…
• All attempts to then actually Open the TAR archive result, failed, with error:
◦ “Loading the archive ‘/media/veracrypt1/kBackup_Arch/backup_2022.01.12-19.17.55_1.tar’ failed with the following error:
Could not load the archive because it contains ill-formed entries and might be a malicious archive.”.
• Same error using Dolphin, & using Ark, & also trying SpaceFM. Grrrrrrrrrrrrrrrrrrrrr.
For now I shan’t uninstall it, but might periodically retest it after any future version updates.
17/1/22: Last night's BiT b/u failed repeatedly, with copious errors & the consequently-usual PITA of forcing me to reboot [triggered by another necessary target config change by me]. I've been growing sick of BiT for ages, & that prompted my recent re-examination of possible alternatives, of which kbackup looked great except the fscker creates corrupted archives. This time, i triedKup
, which is easy to configure but unintuitive to first find, post-install [it hides as a new tab in Plasma' System Settings], then hard to understand how to Restore. Once i eventually sussed it out, & verified my initial b/u is Good, i decided i like this & will use it now instead of BiT. I especially like its Areca-esque file-folder config tree [same as kbackup].
Please share
I bet you regret that offer now!
-
@guigirl said in How do you backup your Linux box?:
I bet you regret that offer now!
Nah. It's not like I read every word on the screen.
The problems you had with KBackup seems to ring a bell in my brain. I seem to recall a problem similar to what you experienced. If I'm remembering correctly, my problem was with my USB storage device and r/w speeds. It was too slow for KBackup and I had to first create the tar files on the hard drive, then move them to the USB stick afterwards. But, I'm not sure if this problem was with KBackup or another archiving program I tried.
-
@dbouley for similar reasons i backup via simple
cp
(with lots of rearrangement etc before that). iirc i made a.tar.gz
in my~
initially, then attempted to copy it to my backup disk – but sha256sum failed (it didn’t with USB sticks that i didn’t want to use for permanent backup, however). the disk being ntfs (or fat32 or some other crap) originally, i had to convert it to ext4 though. -
I'm pretty sloppy with backups.
Timeshift works well for the system.
I have a few presets with Grsync.
I have a few random rsync bash scripts. Those are usually on external drives or flash drives or my phone. Since I tend to just have a bunch of stuff backed up on random drives, I usually just set up the rsync as a .sh file and it will just copy a few folders or a drive.
-
@ugly said in How do you backup your Linux box?:
Timeshift works well for the system
@ugly said in How do you backup your Linux box?:
pretty sloppy
Ooh. I hope you'll emerge ok once the sooner-or-later-inevitable digital apocalypse accosts your primary SSD/HDD, wrt your Home & Data partitions.
-
I use
rsync
for local andborg
for remote incremental backups, and I used to usebtrfs
withsnapper
for local snapshots, but running out of inodes from to time to and having to clear data from a thumb drive because your PC would just stop working otherwise is not the greates user experience, so I've stopped doing this for now, although I still think that versioning on a file system level is very nice to have in general.The reason why I use
rsync
only for local backups is that it does not encrypt. My local backups are on LUKS-encrypted [external] drives, and remotely, borg is setup to use encryption with a password and key file.
Local (or remote) backups
rsync -avutAXH --delete -n <directory-to-be-backed-up-with-trailing-slash> <target>
I deliberately added flag
-n
which is a dry run, since this command can easily remove anything at<target>
. Keep in mind that it makes a difference whether the training/
is added to a path. If you want to try this productively, either remove-n
or--delete
flags.It's super fast, can be also used for versioning when making a hard link copy of the existing backup first and then writing only changes to disk. Since no compression is used, it requires the same amount of space as the data to backup.
Remote backups
borg create --stats --progress --compress lz4 <user>@<server>::<dirname>-`date +%Y-%m-%dT%H:%M\` <dirname>
Where the second <dirname> is just the local dir and the other string is the target; and then if I want to access some data, I simply use
borg mount <user>@<server> <dir>
-
@jumpsq The problem for my use-case [quite apart from me being too much of a dweeb for this method] is that it appears to copy everything in the target. As i wrote above, i have numerous exclusions necessary.
-
@guigirl well, I use
--exclude=$HOME/.cache
and such multiple times with this command.// Sorry, I really just use relative paths, and you also need to use paths relative to exclude files (or directories) from your backup. So the correct parameter is
--exclude=.cache
or--exclude=.cache/
See https://askubuntu.com/questions/349613/how-to-exclude-a-folder-from-rsync
-
@jumpsq Ooooh, thanks!
-
@potmeklecbohdan If a person is comfortable using the command line, it certainly seems to be the easier solution.
@ugly For the most part, I take the same approach; that is rather than backup the entire system, I select different directories at different intervals. The "regularly scheduled" backups I do go to an external hard drive. Then a few times a year I'll burn a .tar backup to DVD. If I've had lot of recent activity in my Photos or Documents folders, I'll do an incremental backup and burn to a CD for safe keeping.
-
@jumpsq said in How do you backup your Linux box?:
--exclude=.cache/
or
--exclude="${${XDG_CACHE_HOME:-$HOME/.cache}#$HOME/}/"
? -
@dbouley
XSIBackup-App is a somewhat different concept. Backup is performed from an appliance through SSH (sshfs). This is very convenient when you need to backup multiple Linux boxes, as you can manage many server's backup from a centralized point of management. On addition you don't need to install anything to the Linux servers. You can download it from sourceforge.net
https://sourceforge.net/projects/xsibackup-app/files/
It can run pre and post scripts per job, thus you can prepare the box to be backed up with some script that may dump some database, mount some dir or LVM volume or take a snapshot of a VM.
XSIBackup-App can also backup VMs in
VMWare
ESXi hosts with full native support. It has almost every professional feature that you may require: block level deduplication, hot VM backups, e-mail reports, etc...
Linux backup is free without any limitation.
VMWare
ESXi backup is free for VMs up to 100 GB to local storage.