Two days ago I lost a lot of important data that I had on the laptop's hard drive. Yesterday, I lost an important part of my emails. Why? For not having a backup responsible for my data.
It all started when, while updating Arch Linux , one of the updated packages conflicted with the rest, and upon restarting, I could not access my session; in fact, X would not start.
As I mentioned before, the solution offered to me on the Arch Linux forums was to reinstall the system, so I set about doing so. Frustrated, grumpy, and in a hurry, I didn't notice the order of my partitions and ended up converting my data partition (/home) to swap space.
Everything happened in a second. Luckily, a few days ago I had made an exact copy of my data on an external disk and I was able to recover a large part of my stuff.
But the folders that KMail uses to store my messages were not copied correctly, something I can't explain because I'm 100% sure that Rsync ran correctly.
End of story: I lost many important files and thousands of emails. Why? Due to human error, but mainly due to not having made a Backup of my data.
How to avoid this?
Of course, because the only way to lose data is to have a backup and of course, for this we must have the necessary resources, be it hardware (HDDs, Flash Memories, DVDs), such as the Internet if we want to trust the Cloud.
If we do not have the means to make our saves, then we are exposed to a fatality. But OK, let's say we have the resources. How do we make our saves?
Performing the saves
In GNU/Linux, we have a lot of applications for creating backups of our files. Let's look at some variations and alternatives.
Rsync
This tool would be the most effective method for carrying out our salvos, mainly because of its power and because it comes installed in most GNU/Linux distributions.
But be careful! If not used correctly, the cure could be worse than the disease. The two examples I show below, although they seem the same, ARE NOT.
$ rsync -av / folder / source / folder / destination $ rsync -av / folder / source / / folder / destination
A bar can change our lives. In the first case, it will copy the source folder into the destination folder , but in the second case, it will copy the contents of the source folder into the destination folder.
To avoid mistakes, I always copy entire directories. For example, my / home folder.
$ rsync -av --progress /home/elav/ /run/media/elav/HDD/Salva/elav/
If we have a server that we can access via SSH, we can use something like this:
$ rsync -av --progress /home/elav/ usuario@servidor:/home/elav/
We only have to assign in the Cron every time we want to save our files. The good thing about Rsync is that, unless we tell it otherwise, it will not copy the files that are the same because it looks at the date and their size.
Graphical tools
Of course, there will always be someone who prefers a more visual approach. Linux Mint has MintBackup , its own tool for backing up your data.
Ubuntu also has its own tool for performing these types of tasks (I think it's Deja-Dup) and we have applications like Bacula if we want to back up our data on the network.
Other interesting tools include BackupPC and Deja-Dup :
In short, there are many others, it is only a matter of choosing the one we need. Do you use any of these? Or what is more important, do they save your data?