remote virtual server backup.
June 9, 2008 9:10 AM   Subscribe

What's the best way to back up a Debian Linux install? I have a virtual hosted Debian instance I use as a personal server, but right now I'm not doing anything to back it up. So what's the best way to do that? One thing I'd like to be able to do is take a snapshot of the entire installation, so that I could restore the entire system on another machine (or virtual machine) so that any software I'd installed would work and stay configured.

So what's the best way to do this? I'm running Debian 3.1, and I don't have much freespace on the machine, so I'd helpful to do the backup directly over the network. the root partition is just 2.4G, with 1.7G used. In theory I can add another partition or 'grow' this one by a few gigs but I'd like to have a backup before I actually do that. It would also be nice if I could do incremental backups later on.
posted by delmoi to Computers & Internet (11 answers total) 3 users marked this as a favorite
I'd suggest using 'tar -cvrjf /home' The rest you can re-install in case of a HD failure, but /home is usually your data. You might want to also backup /etc and it's subdirectories using the same command. This will save you having to reconfigure a new machine.
posted by Fferret at 9:44 AM on June 9, 2008

You might find this thread on the Ubuntu forums of some use.
posted by gene_machine at 9:58 AM on June 9, 2008

I'm partial to rsync for simple backups. You can copy the whole system over the network and do quick updates, but it's not going to get you real incrementals. For that you'll need actual backup software (amanda, bacula, etc).
posted by roue at 9:59 AM on June 9, 2008

Or rsnapshot.
posted by nicwolff at 10:05 AM on June 9, 2008

Adding to Fferrets answer, I've had major success rebuilding a Debian machine using a backup of the /etc directory as well as the list of installed packages (dpkg -l).

On the machine to rebuild, a simple bit of scripting could pull in all the required packages and the /etc contained all the config.

I've also used sbackup which may fit the bill.
posted by azlondon at 10:17 AM on June 9, 2008

Response by poster: I need more then just /home. I want all the applications I've installed backed up as well, along with any config file changes I've made, and I'm not sure where all those files are at this point. Next time I'll be sure to take notes :P
posted by delmoi at 11:54 AM on June 9, 2008

azlondon solves that problem, use dpkg -l. Backing up the actual software will not buy you anything, and will make the size of your backup much bigger. The config files (if the devs have been paying attention...) should all be in /etc. It's been my experience that taking a full image backup only gets you something if you are intending to deploy a large number of cloned machines. Otherwise, you waste a lot of time and CPU cycles backing up what you already have on the install disc. The one exception to this, in my estimation, is when you're running an earlier version of some software that you need for a certain application, but is no longer supported by the devs. I'd only back up that directory in that case, seperately from /home and /etc. if you need to locate certain software, you're best bet might be to 'sudo updatedb', then 'sudo locate | less'. This should show you all the directories involved with that piece of software.
posted by Fferret at 12:43 PM on June 9, 2008 [1 favorite]

Seconding rsnapshot. It's easy, efficient, and automatic. Can do local or offsite backups.

It's not entirely clear how to back up everything important on a Debian box. If you have plenty of disk/bandwidth, just tell rsnapshot to backup / and be done with it. (If you have more than one disk partition, back up every single partition mount point, probably /boot). If that's too much data you can probably get away with not backing up /usr, but backing up /usr/local. Alternately you can cherry pick just backing up /etc and the parts of /var that contain data you care about, at least /var/www and /var/mysql. But that's more error-prone.
posted by Nelson at 12:48 PM on June 9, 2008

Response by poster: Alright cool. I'm installing rsnapshot now.

One interesting thing I discovered, I can actually make duplicates of my virtual host's partitions a (as well as new blank partitions) through my hosting provider's website and add those new partitions as devices on the machine (which I can then mount).

So right now I have a duplicate copy of my whole partition mounted in /mnt/20080609, and a blank filesystem in /mnt/blank, so I can experiment with those two.
posted by delmoi at 1:25 PM on June 9, 2008

Response by poster: Oooh, I just discovered Partimage which lets me create an image from an unmounted partition. Unfortunately it seems to have failed on me when tried making a copy of my duplicate file system to my blank file system.

posted by delmoi at 1:49 PM on June 9, 2008

To add to Azlondon's post, its really easy to mirror Debian installs using dpkg --get-selections[>dpkg.out] on the box you want to back up, then [cat dpkg.out] | sudo dpkg --set-selections followed by deselect install on the target box. Here's a post I wrote that goes into a little more detail.
posted by tallus at 7:42 AM on June 10, 2008 [1 favorite]

« Older Tattoos and Sun   |   Custom Bracelet Design in Toronto? Newer »
This thread is closed to new comments.