Simplify Your Computer Backup Process

Since we never plan for a laptop to physically break, it is critical to consistently and routinely maintain a computer backup of what’s important. But identifying and targeting what is important is an evolving problem as we increase the number of things to configure.

I’ve had to move dev machines many times in my career, whether its from a standard refresh cycle or a water spill catastrophe, and I’ve developed a technique to make switching laptops seamless and easy.

Pain of Migration

Before I talk about the solution, let me describe the problem.

  • When I would move to a new laptop, I often found myself needing a file, a configuration, or some environment variable from my old laptop. And those needs would arise days or weeks later, when the old machine is no longer in my possession.
  • In my environment, there are configurations which give me access to things, such as an AWS or OCI config file. It can be a pain to rebuild those, but if I had the originial file, I’m good as gold.
  • I have customized settings for my main IDEs, and it is annoying to have to reconfigure hotkeys, plugins, etc.

Centralize Your Configuration

My solution — centralize my configuration to a single directory. With everything in one folder, which I name meta, I simply backup that folder, and restoration to a new machine will have everything I need. Another benefit is accessibilty to view or edit these from one folder, rather than having to remember where each may be.

Sounds simple, but let me describe the magic of it.

magic computer backup

By utilizing symlinks, I can store all the configuration files in my one directory, and reference them where services or processes expect them to be.

Let’s say I want to keep my ssh keys in a subdirectory in my ~/meta directory — ~/meta/ssh. Running the following in my home directory creates the reference to my subdirectory.

-> ln -s ~/meta/ssh .ssh
-> ls -al | grep ssh
lrwxr-xr-x    1 bknear  mygroup        8 Sep  8 11:29 .ssh -> meta/ssh

What To Backup

Here’s a list of things I maintain in this meta directory, and how I use them.

ItemTarget
ssh keysln -s ~/meta/ssh ~/.ssh
zsh themeln -s ~/meta/zsh/my-awesome-theme.zsh-theme ~/.oh-my-zsh/themes/my-awesome-theme.zsh-theme
env aliases and exportsecho 'source ~/meta/myenv.sh' >> ~/.zshrc
AWS configln -s ~/meta/configs/aws ~/.aws
Kubernetes configln -s ~/meta/configs/kube ~/.kube
Maven Settingsln -s ~/meta/config/m2/settings.xml ~/.m2/settings.xml
OCI configln -s ~/meta/configs/oci ~/.oci

Restoration

If I’m restoring to a new machine, I’ve written a script to execute roughly the above commands to quickly setup everything for me by automatically creating my symlinks.