Setup your system for an easy backup

From Andreida

How to setup your system

You want as much data as possible in one directory and you want that directory to contain ONLY data which goes into your backup. Not one temporary or cache file should be inside that directory. We will call this directory "data" from now on.

This "data" directory might contain your MP3s, your videos, your pictures, your virtual machines, your Subversion or Mercurial repositories and your installers for tools which you don't want to download again.

  • You will never work directly in "data".
  • You will add files from "data" to your media player, install tools from "data" or have your svn working directories access the server repository in "data".
  • But Mercurial for example will be different.
  • You will have a "work" directory somewhere.
  • Here you will do your work.
  • Here you will checkout svn or Mercurial.
  • Here you will have a downloads directory (Change the OS download directory here).

If you are using Mercurial, you will have a server repository in "data" which has an empty working directory ("hg update null") and you will work with the clone in "work".

If using Windows, you will have a script in %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\ which will commit (for svn) or commit+push (for Mercurial) for certain checked out projects. Of course NOT for your development projects.

But if you have a folder which contains your documents and personal scripts and stuff you want to keep all your life, auto commit/push is the thing you want. This must be - of course - be prepared correctly too, like having an ignore file for "*.aux *.log *.out *.synctex.gz and the like.

You nearly always work in "work"
Backups will be created from "data"

Using links

Many files are somewhere in the system and you change them all the time. It is normally hard to ensure a backup of these. You have to use links.

You are using a work directory and have there a directory for your personal documents. Imagine something like this:

"C:\Users\Andreas\.ssh\config" is a link which points to "C:\work\andreas\documents\always\ssh\config" ("always" is parallel to 2023, 2024...)

If you have it setup this way, you change the file "C:\Users\Andreas\.ssh\config" like normal, but backups of "data" will have the repository which is referenced by c:\work\andreas which contains the real file.

The same procedure is possible for other ssh files (keys etc..), ThunderBird Junk Training Data or whatever makes sense in your setup.

Create links with Linux

Crates a link in .hg

cd .hg
ln -s ../.hg-configs-managed/hgrc-MY-CORPORATION-PC01 hgrc

Create links with Windows 10

Creates a linke in .ssh

mklink /H c:\Users\Andreas\.ssh\test.txt C:\work\andreas\documents\always\keys\test.txt