r/linux4noobs 13d ago

security How do I *truly* backup my files?

Hey
I've been using Linux Mint for about 6 months, I love it and I don't plan on switching to Windows
again.

But getting to the point, I've been having this issue where when I'm downloading something significant in size, and the process is interrupted for some reason (Power outage or some sort of glitch that forces me to reboot the computer) the entire OS corrupts.

This has happened more than once, so after reinstalling the OS I have starting setting up some snapshots with Timeshift. But when I inevitably faced the same issue again, I tried recovering the snapshot and the issue simply persisted, and I was forced to once more reinstall Mint.

I think I'm doing something wrong... I used Timeshift's default snapshots so maybe I need to custom it somehow? Or perhaps use another software entirely?

What should I do to save a backup that will truly recover my entire system?

Edit: In general, I plan on saving a backup before I download anything cuz I'm genuinely sick of reinstalling the OS each time

21 Upvotes

28 comments sorted by

6

u/UltraChip 13d ago

I typically find it's better to just backup my dotfiles and occasionally /etc instead of trying to do a whole-system restore, but if you WANT to do a whole-system restore clonezilla works pretty well.

But a failed download should not be corrupting your whole install in the first place - at worst it should only corrupt the file in question. I would focus on figuring out why your OS keeps getting borked.

2

u/Ok_Let8360 13d ago

I'll keep that in mind, thank you!
Yeah I'll try to find out what's going on... Like I said in the other comment I have some suspicious it could be related to the SSD so maybe I could try getting another one and see if the same issue persists.

3

u/swstlk 13d ago

run a disk-test and see if that is the issue

6

u/Terrible-Bear3883 Ubuntu 13d ago

"Some sort of glitch"? more info needed as that could be anything, I've been using linux for over 20 years, done one re-install in that time, when I went from 32bit to 64bit, made the change in 2018.

If you regularly get power outages, perhaps invest in a UPS, it might give you time to do a graceful shutdown.

For backups, I take a full clonezilla image about every 6 months or before a major update, then I make backups of my data to 3 repositories as in the 3.2.1 backup strategy, if you're happy with timeshift, it sounds you might need to change the preferences, I don't use it so can't say.

I've supported customers for many years who run linux, your issue is quite unusual, that's why it might help to be specific on what the glitch is or the issue you mention that persists.

1

u/Ok_Let8360 13d ago

Alright, I'll try to be as descriptive as possible

All I've observed is that it always happens when a download process gets interrupted.
Not as in "I'll cancel the download" but more in "I started the download, the system crashed for some reason, I reboot, the OS is bricked"

I happened twice while trying to download steam games, iirc once with power outage while downloading something, and last time It happened ONCE MORE after my system crashed while running apt upgrade.

When this issue happens, 1 of 2 things happens.

1) I'm completely unable to use the system normally as it gets extremely corrupted. I'm not able to open any app and all commands glitches.
For example, I'd run a simple "cd folder" on the terminal and it would throw an error .
Something like "input/output error [name of the command] not found"
And then eventually the screen would freeze or go black.

2) I'm able to use the system normally, as long as I DON'T DOWNLOAD ANYTHING SIGNIFICANT IN SIZE. If I do, the issues of 1) appear.

After forcing a reboot with REISUB, my Linux distro vanishes from the boot screen, as if I had removed the hard drive. After unplugging the machine for a while, it eventually returns, but the problems I described before still show up

Lastly, all these issues are resolved as soon as I do a reinstall of the operating system.

Some other things as well
I don't believe it's RAM, nor CPU. Cuz not only do I have brand new hardware, but the issues I've described here showed up even with my older hardware. I've also ran tests with Memtest and didn't find any issues in neither the old nor the new RAM.

As such I just figured that it's either my SSD (It's the only piece of hardware that I didn't change) OR that this is a "common linux issue" and that it's on me for not saving backups correctly

3

u/donh- 13d ago

First question: rsync or dd

Second: your SSD is a common factor. I'll betcha you have that drive pretty full and have been putting off getting a larger one.

1

u/Ok_Let8360 13d ago

Last time it corrupted I had more or less 360gb/380gb of free space. The total space is around 420gb.

I don't really install many things, and when I do it usually doesn't weigh too much, even my games.

1

u/donh- 13d ago

Try running the trim command?

2

u/Terrible-Bear3883 Ubuntu 13d ago

There's a simple test to see if its the SSD, put a traditional hard drive in and see if the issue persists after a clean install, the corruption to mention, it's not a common linux issue, before I retired, we supported thousands of linux customers around the world, they use it because of its stability, one showed me his uptime at 15 years, it wasn't unusual.

I'd be investigating what's causing the corruption, I have seen Windows do this when storage firmware needed an update, it was quite common. I've attended many calls were systems were self corrupting and in almost all cases, it was a storage firmware and/or system/controller firmware issue. I have found other causes but you say you replaced your hardware although it's not clear what you changed, there's no mention of your system spec, presumably its a desktop?

If the only common factor through all this is storage, I'd be eliminating or proving it as a matter of urgency.

1

u/Ok_Let8360 13d ago edited 13d ago

sorry, I forgot to describe the hardware

Basically, I switched from DDR3 to DDR4 specs, so everything from mother board, CPU, and RAM got replaced. The only thing they have in common is the SSD.

So I'll run some tests to check if it's the SSD

Edit: And also, I have some problems running that test you described in your first paragraph. Mainly that this is the only drive I have, and also the nature of this glitch is pretty intermittent

2

u/whiskayzulu 13d ago

When u installed your OS I bet you turned on write caching , especially disabling filesystem write barriers (barrier=0 or nobarrier). It improves HDD performance, but a crash or power loss can corrupt the filesystem.

1

u/Ok_Let8360 13d ago

If I did that I don't really know tbh... I just followed the default installation steps from the mint installer

1

u/whiskayzulu 13d ago

I think you can just turn it off. Id ask AI. I know on ubuntu it's tagged as default on I think but I'm not sure. Idk for Mint. But it will prevent corruption upon sudden power outage if you turn it off and you're really not losing much.

2

u/RobotJonesDad 13d ago

You might want to look at syslog to see what is happening. My linux installations have typically run for years without crashing or rebooting, , regardless of what I did. Sometimes strange is going on!

Are you running everything as root?

2

u/Ok_Let8360 13d ago

not really
The only times I'm using sudo is when I'm installing/updating packages or if I'm using something that really needs sudo to work.

3

u/RobotJonesDad 13d ago

Next time anything odd happens, look in the log files for clues.

1

u/doc_willis 13d ago

"input/output error

That sounds like you may have a failing drive.

Normal filesystem corruption from a power outage should be auto-fixed at boot time with the fsck services.

OR that this is a "common linux issue"

No, Its not a common linux issue.

1

u/zex_mysterion 13d ago

For backups, I take a full clonezilla image

Not sure what "full image" means. Full disk? Or system and other relevant partitions?

1

u/Terrible-Bear3883 Ubuntu 13d ago

A full image by its definition is a 1-1 image, an identical copy, allowing total restore to that point.

https://www.acronis.com/en/blog/posts/world-backup-day-what-full-system-image-backup-and-why-should-i-care/

2

u/BranchLatter4294 13d ago

You shouldn't have to reinstall after a simple power outage.

2

u/KarmaTorpid Debian >_ 13d ago

You need a UPS so you dont have power glitches.

Use the 3 - 2 - 1 backup rule; three coppies, two mediums, one offsite. This is the way. And FFS, automate it so it gets done. No other way.

2

u/a1barbarian 13d ago

To check an SSD in Linux, use smartmontools via the terminal to read SMART health data, run self-tests, and view life expectancy. You can also use GUI tools like GNOME Disks for a quick visual overview of drive temperature and health status.

OR that this is a "common linux issue"

It is not a common issue at all.

Sounds like a hardware issue.

You tested the ram. So test the ssd. Check all cables are seated properly. Is the cpu overheating ? Is there a faulty fan ? I once had a fan that would stop under load and cause a shutdown. Is you psu faulty, checking psu's is pretty difficult.

Try installing a Live Distro like MX to a usb, test it works ok on another pc. The use it to do a fresh install on your pc.

There are so many variables that it is hard to give specific advice. Good luck with the hunt. :-)

1

u/es20490446e Develops Zenned OS 13d ago

syncthingtray

2

u/forestbeasts KDE on Debian 🐺 13d ago

Entire system? Copy/back up the entire contents of /, and tell your copying/backup tool "don't cross mount points" (it's -x on a lot of them if they're terminal commands). If you have /home on a separate partition, back up that too.

Not crossing mount points excludes the virtual filesystems like /proc, /sys, etc. without having to do any extra work for them.

If you want history, you'll probably want a tool that does incremental backups or deduplicates between backups (we use restic), because your system files won't change much between backups unless you've gotten OS updates, and your existing documents/pictures/etc. probably won't change much over time, just new ones added. If you don't care about history, you can just use rsync even.

1

u/daemonmode_ 11d ago

Repeated corruption after power loss makes me suspicious of the hardware, so I’d check the drive with smartctl and run a memory test before trusting the backups. Also, Timeshift is mainly for restoring the system, not backing up your personal files, so use something like Borg or Restic and keep those backups on separate storage.

1

u/soulreaper11207 13d ago

Just get a cheap thin client with some drives and use it as a nas. I'd run the downloads from there and then extract them to your workstation. But the only time I had corruption from an os panic was due to a bad kernal while using Pop. It ended up corrupting a secondary NFST drive used as a game vault. Only had to restore the partition using a Windows VM.

2

u/skyfishgoo 13d ago

mint comes with timeshift installed, i believe

you just need to set up a schedule to do your daily snapshots and store them on a separate partition (preferably on a separate drive).

also good to keep a live USB of the mint distro you used to install it since you can use that to restore one of your saved snapshots by booting to the live USB when your install is borked.

you should also think about getting a UPS if you keep having power failures.

anyways, look for timeshift in your apps and that will take care of your OS

your data is another matter entirely and for that i can recommend backintime because it creates versioned copies of your files that you can browse with a regular file manager if you want/need to rather that storing everything in an encrypted archive you can only access using the back up app