I'm sure at some point you have experienced the lost file upset by an accident or a failure of your hardware. Once lost data can be recovered difficult, or requires a high financial outlay for recovery. It is therefore a good idea to prevent these incidents with proper data backup system. However, having to move your data to pendrive (or cloud) can be quite tedious.
With this article I intend to show that, for me, is the best solution in Deepin OS to keep your files safe without having to worry about start moving files from one place to another. To do this, we will rely on the applications called rsync and cron rclone with which we can execute synchronization folders automatically on the date and frequency to indicate.
If you have a large hard drive is advisable to have a dedicated partition for backups only the data you want to retain. But it is still safer to have double security dump copying my data both specifies a partition for data, as my personal clouds. That is, copy your data to two different platforms, because if for some reason fails one, always have available the other. However, it is a personal decision to use both mechanisms or only one of them. In any case, I will explain both
To illustrate more clearly I'm the way I configure my computer:
Example backup system
My initial idea was to keep my PC four folders: Music, Documents, my projects and my personal library. The first folder occupied over 10 Gigabytes, my documents about 8, my projects and my library 5GB 35.
The first thing I did was plantearme distribute my data. Synchronizing with the data partition had no space problems, since I have a second hard drive with 300 GB, so spare me space. However, clouds rarely go free 50GB So, I decided to distribute backups as follows.:
- Musica -> Google Drive con mi cuenta firstname.lastname@example.org
- Documentos -> Google Drive con mi cuenta email@example.com
- Proyectos -> Google Drive con mi cuenta firstname.lastname@example.org
- Biblioteca -> Mega con mi cuenta email@example.com
Once that was clear as I wanted, synchronize folders with the cloud by rclone and added the necessary commands to perform the automatic saved periodically. It sounds somewhat confusing, but now I explain everything in more detail.
Settings to automatically save your data to another partition / disk:
Going to the terminal, we type sudo nano crontab -e With which we access the crontab configuration page. There add commands that synchronize the folders you want to backup, including how often you want to run
In this case we have chosen because they run every day at 7 pm. The following image is detailed in depth
Cron allows you to completely customize how often you want to run a command. However, I intend that this article does not become too extensive. For those interested in knowing more about it here I leave a link where you can learn more about how to manage cron https://www.redeszone.net/2017/01/09/utilizar-cron-crontab-linux-programar-tareas/
Settings to automatically save your data in the cloud:
- Step 1 - Configure the clouds that we will use with rclone. They can be used multiple accounts and different platforms. In my case, I use three different drive google accounts (one for my images, one for documents and the last to save my personal projects) and Mega (for my library). So I had to set the four accounts with the rclone config command. It's nothing complicated, just follow the steps in the project website Rclone
The configuration generally consists of the following steps:
- We open a terminal and run the following command: rclone config
- you type n (Create new account) and click enter
- Asks for the name for that account adds that that you please and enter
- Then will offer a list of the clouds that you can configure. Choose one of them by simply typing the corresponding number and then enter
- From here, each platform is configured differently. Henceforth, I will continue with the steps to the most popular cloud (Google Drive). then we continue to the Drive platform and leave the empty clientID client_secret pressing enter twice in a row. For other platforms I recommend that you follow the steps outlined by the official website of Rclone (click on the icon with a book on the web rclone.org belonging to the cloud you want to install).
- After that it asks us to choose how it syncs. Select the first mode by typing 1 and pressing enter twice
- Finally, press and Y enter , Which will open a browser tab to link your account, and there We accept linking
Then we repeat the process (for each platform itself, obviously) with each of the accounts you want to link to rclone.
- 2nd Step - Just need to add commands that synchronize our folders with clouds already have configured and assign the time you want to execute the synchronized with crontab. In this case I will tell the machine to synchronize with the cloud every week, except folders Documents and Projects, which change much more frequently. Open the configuration sheet by terminal crontab sudo crontab -e and I added the following:
Ready! From now on you will not have to walk pending burn your copies, the machine will do it for you.