Directories in a common Linux filesystem to backup
Pay special attention to these in your
~/.rvm … etc.
You get the general idea of this. User data, downloads, documents, pictures, files and other extremely important information is kept in your
/home and for that reason it is the probably the most important when backing up. Most of your installed software use either their installation directories or
/home/user/.local/ to store configurations and these may have taken a long time to either write or setup. You may wish to save time by keeping a copy around on a separate disk. It’s up to you to know where your important /home directories are and what is maybe not so important and to avoid altogether.
/home can accrue a large amount of junk as well, so you may wish to clean before you backup, but again, it’s up to you. It takes a bit to backup my own
/home, which includes my development environments for Python, Java, C and Ruby. An alternative is to keep a Gemfile somewhere to record your gems and a
requirements.txt or Poetry lockfile containing your important Python modules to easily and quickly reinstall them later, so you can save space when making backups.
Sort of self-explanatory to system administrators but for the regular user this will contain all your administration scripts you create for maintaining the system and is vital to backup because if things go wrong and you can’t repair your
/root directory then you are gonna have a bad time.
This contains very important databases (MySQL, PgSQL, spool, spamassassin, etc…). Backup only the important databases containing what you need. You probably don’t need a full copy of
/var unless you really want to, so I would avoid doing it if not needed. Add exceptions with
--exclude to avoid backing up certain files and paths if you have to; this will keep your backup clean and avoid duplicates later on which can be annoying to sort. I also recommend avoiding system OS specific
It’s up to you if this is a priority. It may also just be empty, who knows.
This is important to me and I keep a regular backup for my own reasons. It may be important to you as well.
Third party software goes here, at least for most. For me, this just includes one or two sub-directories, such as
gradle-7.4.2/ and others that I wanted separate from my usual installed software.
You can either use
rsync like I do (on almost all my systems including domain controller client), or you can pick another way to do it. I have a full RAID setup but that’s beyond the scope of a blog post.