How to do a full backup and restore of linuxmafia.com
(Example cheatsheet with casual, full backup of a Debian GNU/Linux system.)

Backup — execute these tasks:

fdisk -l /dev/sda > /root/partitions-sda-$(date +%F)  Partition map of SCSI HD a
fdisk -l /dev/sdb > /root/partitions-sdb-$(date +%F)  Partition map of SCSI HD b
dpkg --get-selections "*" > /root/selections-$(date +%F)  Installed packages
tar cvzf /root/etc-$(date +%F).tar.gz /etc

Then, back up these directories and files, e.g., over rsync to a remote system for safekeeping.

/root                        Root user's home directory (includes above files)
/etc                         System configuration files
/usr/lib/cgi-bin             CGI scripts (omit PHP binaries)
/var/lib/mysql               MySQL database files (dump if not queiscent)
/boot/grub/menu.lst          GRUB bootloader configuration
/var/spool/exim4             Exim and SA-Exim internal files
/var/spool/news              NNTP news spool for Leafnode
/var/spool/mail              SMTP mail spool
/var/lib/mailman/archives    Mailing list archives for Mailman
/var/lib/mailman/data        Mailing list state and other data
/var/lib/mailman/lists       Mailing list definitions for Mailman
/var/lib/mailman/nntp        Mailing list NNTP gateway data
/var/lib/mailman/qfiles      Mailing list in-process data
/usr/local                   Locally installed files and records
/var/www                     Public http, ftp, rsync tree
/home                        Non-root users' home trees

Part of the point of the above is that including all of the directories that need backup is a non-trivial task, and requires some study of one's system.

Restore:

If the above-cited system needed to be reloaded from backup, here is how it would be restored:

Do a minimal Debian installation from trusted media, using partition maps preserved above.

mkdir /usr/local/opt
cd /
rmdir /opt
ln -s /usr/local/opt

Prune the contents of (a copy of) file selections-NNNN-NN-NN from above to remove (1) libs (which will get fetched if needed as dependencies and (2) packages you're pretty sure upon examination you no longer need, then, do

 dpkg --set-selections < selections-[date string]
 apt-get dselect-upgrade
This may recall some interative pruning and correcting of the "selections-NNNN-NN-NN" file, as it's quite possible (especially if you're using a later Debian base version as the migration target) that some formerly used packages no longer exist / have different names. Don't worry too much if you can't find a package's new name; more likely than not, it will be found as a dependency anyway. However, make a note of anything that appears unfindable, for later checking.

Rebuild /etc with reference to /etc copy above, making sure you restore users and groups to /etc/passwd, shadow, group, gshadow. For linuxmafia.com, build/configure leafnode, configure Mailman's nntp service, enable related cronjobs.

2006-05 linuxmafia.com network services:

Copy other files back.

Rebuild or reinstall local packages.

2006-05 local packages on linuxmafia.com:

Full packages:

One-off scripts and utilities:

Restart services. Check logfiles for errors.