issue118:c_c
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
issue118:c_c [2017/02/28 11:06] – créée auntiee | issue118:c_c [2017/03/08 14:48] (Version actuelle) – andre_domenech | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | As anyone who has used a computer for any period of time will know - sometimes, things disappear. This can be from a power outage, careless deleting, or hardware failure. As such, backups are always necessary. There are a number of ways to go about this, so today I will outline my personal approach, and the thoughts behind it. | + | **As anyone who has used a computer for any period of time will know - sometimes, things disappear. This can be from a power outage, careless deleting, or hardware failure. As such, backups are always necessary. There are a number of ways to go about this, so today I will outline my personal approach, and the thoughts behind it. |
Distinctions | Distinctions | ||
Ligne 7: | Ligne 7: | ||
Manual backups are ones I do by hand - typically for large files (such as Linux ISOs), and that I save on an external hard drive. I’m not typically too worried about redundancy for these files, as I can easily download them again. For some files that I want a bit of safety for, I copy it to multiple drives. They’re irregular, and, as such, not worth automating. | Manual backups are ones I do by hand - typically for large files (such as Linux ISOs), and that I save on an external hard drive. I’m not typically too worried about redundancy for these files, as I can easily download them again. For some files that I want a bit of safety for, I copy it to multiple drives. They’re irregular, and, as such, not worth automating. | ||
- | Lastly, the backups I call defaults. These are mostly dotfiles (configuration files) that I will re-use if I ever set up a new computer, or have to reset my computer for some reason. I save these in a git repository, saved to a private gitlab repository. The actual copying and committing happens through a shell script, which can be found here: http:// | + | Lastly, the backups I call defaults. These are mostly dotfiles (configuration files) that I will re-use if I ever set up a new computer, or have to reset my computer for some reason. I save these in a git repository, saved to a private gitlab repository. The actual copying and committing happens through a shell script, which can be found here: http:// |
- | Explanations | + | Comme tous ceux qui ont utilisé un ordinateur pendant un certain temps le savent, parfois des choses disparaissent. Cela peut être dû à une coupure de courant, une suppression malencontreuse, |
+ | |||
+ | Je divise mes sauvegardes en trois niveaux : automatique, | ||
+ | |||
+ | Je fais les sauvegardes manuelles à la main, en général pour de grands fichiers (comme les ISO Linux) ; je les enregistre sur un disque dur externe. Je ne m' | ||
+ | |||
+ | Enfin, il y a des sauvegardes que j' | ||
+ | |||
+ | **Explanations | ||
Borg | Borg | ||
Ligne 17: | Ligne 25: | ||
I focus mainly on the home folder, as those are the files I want safe. I hardly make any changes to the root filesystem, and the important configuration files I want to keep are covered in my defaults backup. | I focus mainly on the home folder, as those are the files I want safe. I hardly make any changes to the root filesystem, and the important configuration files I want to keep are covered in my defaults backup. | ||
- | I’ve never had to restore anything from Borg, but using borg extract should allow you to extract all (or some) files from the backup. The Borg documentation is fairly thorough. | + | I’ve never had to restore anything from Borg, but using borg extract should allow you to extract all (or some) files from the backup. The Borg documentation is fairly thorough.** |
- | Manuals | + | Explications |
+ | |||
+ | Borg | ||
+ | |||
+ | Le script pour Borg est assez simple, j'ai paramétré quelques variables qui devront être mises à jour. Le script contient également un commutateur optionnel « -p », qui affiche le progrès de la sauvegarde quand elle est faite à la main. La commande borg elle-même est assez explicite, bien que peu lisible à cause des variables. En substance, elle ignore quelques dossiers que je ne veux pas sauvegarder et sauvegarde mon dossier home vers le NAS, tout en le compressant. À la fin de la sauvegarde, les vieilles sauvegardes sont élaguées : les sauvegardes quotidiennes pendant une semaine, 4 sauvegardes hebdomadaires et 6 sauvegardes mensuelles, afin de minimiser l' | ||
+ | |||
+ | Je me concentre principalement sur le dossier home, car ce sont ces fichiers-là que je veux mettre en sécurité. Je ne fais guère de modifications au système de fichiers root et les fichiers de configuration importants que je veux garder sont traités dans la sauvegarde des défauts. | ||
+ | |||
+ | Je n'ai jamais eu besoin de restaurer quoi que ce soit de Borg, mais l' | ||
+ | |||
+ | **Manuals | ||
I just use Thunar or a Terminal to copy files around. The thought process on why I do this by hand is outlined above. This also includes a text file in Dropbox listing some fixes I’ve implemented for some bugs my particular setup has dealt with. | I just use Thunar or a Terminal to copy files around. The thought process on why I do this by hand is outlined above. This also includes a text file in Dropbox listing some fixes I’ve implemented for some bugs my particular setup has dealt with. | ||
Ligne 25: | Ligne 43: | ||
Defaults | Defaults | ||
- | These are files like my configuration for i3, my git settings, and some system-wide files that I’ve changed. The script listed above contains an array of files and directories. The if statements then check if the file is in /etc/ or in my home folder. It then creates a version of the file path without the leading slash or the home path. This is then saved in my repository folder. If the file ends in a slash - i.e. is a directory - then creates the directory if it doesn’t exist in the repository, and copies the contents over. Otherwise it just copies the file. In the else statement, the -r switch is not really necessary for rsync, but I left it there just in case something slips through the if statement. | + | These are files like my configuration for i3, my git settings, and some system-wide files that I’ve changed. The script listed above contains an array of files and directories. The if statements then check if the file is in /etc/ or in my home folder. It then creates a version of the file path without the leading slash or the home path. This is then saved in my repository folder. If the file ends in a slash - i.e. is a directory - then creates the directory if it doesn’t exist in the repository, and copies the contents over. Otherwise it just copies the file. In the else statement, the -r switch is not really necessary for rsync, but I left it there just in case something slips through the if statement.** |
- | I also used rsync instead of cp, in order to be able to avoid .git folders (as they cause permission errors), and because rsync will copy a file only if there are changes. | + | Les sauvegardes manuelles |
+ | |||
+ | J' | ||
+ | |||
+ | Les défauts | ||
+ | |||
+ | Ce sont des fichiers comme ma configuration pour i3, mes paramètres git et quelques fichiers système que j'ai modifiés. Le script dont le lien est donné ci-dessus contient tout un ensemble de fichiers et dossiers. Ensuite, les arguments if vérifient si le fichier se trouve dans /etc/ ou dans mon dossier home. Le script crée alors une version du chemin du fichier sans la barre oblique du début ou le chemin vers home. Puis cela est sauvegardé dans le dossier de mon dépôt. Si le fichier se termine par une barre oblique (autrement dit, est un répertoire), | ||
+ | |||
+ | **I also used rsync instead of cp, in order to be able to avoid .git folders (as they cause permission errors), and because rsync will copy a file only if there are changes. | ||
The script also creates a list of packages installed. Since I run Arch Linux, the script uses pacman. For Ubuntu, replacing line 15 with pkglist=”apt list --installed > pkglist.txt” should work. You can then reinstall the packages with | The script also creates a list of packages installed. Since I run Arch Linux, the script uses pacman. For Ubuntu, replacing line 15 with pkglist=”apt list --installed > pkglist.txt” should work. You can then reinstall the packages with | ||
Ligne 33: | Ligne 59: | ||
cat ~/ | cat ~/ | ||
- | The very last command simply commits and pushes the changes to the git repository. | + | The very last command simply commits and pushes the changes to the git repository.** |
- | The reason for doing it this way is so I can easily recreate my setup - whether it’s on a new computer, or if I need to recover after extensive hardware failure. Since the files are pretty small, I pop them into a git repository to keep many versions of it, and then save it to gitlab, so I have access to it, even on other computers. I tend to run the command by hand after editing any of the files it contains. However, you can easily use cron to run it. | + | J'ai également utilisé rsync à la place de cp afin de pouvoir éviter des dossiers |
+ | Le script crée aussi une liste des paquets installés. Puisque mon ordinateur est sous Arch Linux, le script utilise pacman. Sous Ubuntu, le remplacement de la ligne 15 par pkglist=" | ||
+ | |||
+ | cat ~/ | ||
+ | |||
+ | La toute dernière commande valide et envoie les modifications au dépôt git. | ||
+ | |||
+ | **The reason for doing it this way is so I can easily recreate my setup - whether it’s on a new computer, or if I need to recover after extensive hardware failure. Since the files are pretty small, I pop them into a git repository to keep many versions of it, and then save it to gitlab, so I have access to it, even on other computers. I tend to run the command by hand after editing any of the files it contains. However, you can easily use cron to run it. | ||
Conclusion | Conclusion | ||
Ligne 42: | Ligne 75: | ||
I’ve been using these solutions for a few years, and while I haven’t had any cases of having to restore from Borg, I have had a few external drives fail. And I’ve also set up a few new devices in that time. While there can be some hiccups, it’s been a pretty smooth process overall. | I’ve been using these solutions for a few years, and while I haven’t had any cases of having to restore from Borg, I have had a few external drives fail. And I’ve also set up a few new devices in that time. While there can be some hiccups, it’s been a pretty smooth process overall. | ||
- | I hope this article is helpful to anyone who may be uncertain as to backup approaches. If you already have a setup, feel free to share it with me at lswest34+fcm@gmail.com. I also welcome any questions, or article suggestions. | + | I hope this article is helpful to anyone who may be uncertain as to backup approaches. If you already have a setup, feel free to share it with me at lswest34+fcm@gmail.com. I also welcome any questions, or article suggestions.** |
+ | |||
+ | Je fais mes sauvegardes ainsi pour pouvoir recréer ma configuration facilement, que ce soit sur un nouvel ordinateur ou si j'ai besoin de tout restaurer après des défaillances matérielles importantes. Puisque les fichiers sont très petits, je les mets dans un dépôt git pour en garder plusieurs versions ; ensuite, je les enregistre sur gitlab afin de pouvoir y accéder même depuis d' | ||
+ | |||
+ | Conclusion | ||
+ | |||
+ | J' | ||
+ | |||
+ | J' |
issue118/c_c.1488276378.txt.gz · Dernière modification : 2017/02/28 11:06 de auntiee