If you have a home server powered by Linux, you’ll probably be upgrading your OS every so often.  Here are some important files to back up and some alternative utilities that will help you get up and running quickly.

Of course, every home server is going to be a little different, and you should adjust these recommendations accordingly—it's just a general guide to help you understand where to start.

Image by daryl_mitchell

/home

home File Browser

Let’s start with the obvious.  /home contains a folder for each user on your system.  Your personal home directory is where all of your music, movies, pictures, and documents are (unless you use a separate partition for them), but it also houses configuration files for your other programs.  Hit ctrl+H in nautilus to show hidden files and you’ll see a slew of them!  Back up whatever you need.  It’s not a bad idea to back this directory up even if you have a separate /home partition, as reinstalling may overwrite a small number of these configuration files.  Repeat the process for all users.

Apt Sources

-etc-apt

The list of software sources used by apt is located at “/etc/apt/sources.list” and the signed gpg keys are in the /etc/apt/sources.list.d/ directory.  If you’ve used Linux at all, you’ve likely installed software from other repositories than just the defaults.  After you reinstall, you may just have to change the final distro marker to the newer one (e.g. “lucid” to “maverick”) and copy those lines to your new sources.list, but for many repositories you’ll have to download a new gpg key before you can use them.  At the very least, it will at least serve as a reminder of what you had on your old setup.  Ubuntu-Tweak offers a way to install software and repositories, as well as change loads of settings, and serves as an excellent alternative to this backup.

Samba Configuration

-etc-samba

If you set up Samba (Windows) shares, then you’ll need to copy “/etc/samba/smb.conf”.  Samba’s configurations change very little between versions, so you can just use your old copy after reinstalling it.  If you need to reconfigure it or forget to back it up, gadmin-samba (for Gnome) and KSambaPlugin (for KDE) both provide a GUI editor for smb.conf that makes it easier to edit and redo.

SSH

-etc-ssh

If use SSH to remotely access your computer, you may want to save time by backing up its configuration files, located at “/etc/ssh/ssh_config” and “/etc/ssh/sshd_config”.

fstab

fstab after

The file in question is “/etc/fstab” and its job is to be Linux’s file system table.  Make no mistake, you will NOT be able to use your old installation’s fstab file on your new installation.  This is because UUIDs change anytime you reformat a partition.  However, you can copy the rest of the line in your old fstab file so that you don’t have to spend time looking up all of the options.  This is really useful if you have a lot of partitions, auto-mounted shares, a separate /home partition, etc.  You can also use pySDM (Gnome) or mountmanager (KDE), as both provide a GUI process to edit your fstab file, but be sure to do a manual backup yourself first.  From most accounts around the ‘net, it seems safest to learn about the options in fstab and edit it manually, so keep that in mind.

Backup Programs

Backup Properties

If you have your server set up to do automatic backups with tools like rsync or Simple Backup, then you’ll want to grab their configuration files.  Rsync’s config is location at “/etc/rsyncd.conf” and Simple Backup’s is at “/etc/sbackup.conf”.

Website Files

Many people have Apache, MySQL, and/or PHP installed on their home servers to run personal websites.  While their configuration files can be a little too complicated to back up, you shouldn’t forget to do it for your website itself, located in “/var/www”.

-var-www

You’re probably better off reconfiguring Apache, MySQL, and PHP when you reinstall them, as their versions can change and you may want to use newer passwords.  When you go to do that, you can easily install all three in one-shot in Ubuntu with the following command:

sudo apt-get install lamp-server^

And yes, that caret (^) needs to be there.  Don’t forget to install phpMyAdmin to easily configure your MySQL databases!

sudo apt-get install libapache2-mod-auth-mysql phpmyadmin

You’ll need to hit the spacebar when you select your Apache installation.  You’ve done it properly if see an asterisk (*) come up next to it.  And, as always, make sure you change all of the default passwords for everything.  Happy re-installing!