::getting ready for edgy, part duex–backups

21 10 2006

In this exciting episode, we’ll talk about the incredibly mundane and unsexy topic of backing up your key files and folders prior to making the move to Edgy. If backups are a normal part of your life, you can skip this. If not, they should be. I’ll do an entry at some point in the future talking about how to do regular backups. For this entry, though, I’m making a few assumptions:

  1. You don’t do regular backups of any kind.
  2. You have important files that you want to retain.
  3. You don’t have a second computer with linux installed, or it doesn’t have adequate space for your purposes.
  4. You have space enough to back up your data without having to wrestle for space.


Planning what you want to back up and how you want to do it is very important in terms of time taken to do your back up, the ease in getting it back, and storing it for the long term, if you want to. It is not necessary to back up your entire system, but you could do that if you wanted to and had the resources. My emphasis here will be in backing up your /home directory, as that is where most people store their personal files that they would want to keep.

Not everyone does this, though, and it is important that you take an inventory of your system before your upgrade to make sure you’re not missing anything. Be sure you look for directories on other paths to make sure you’re not missing anything. Where do you keep your writing? Your web site? Your mp3s? Your photos? Here’s how I plan out my backups:

What to Back Up?

  • Make a list of the types of files you want to save. Not necessarily the file types, but the category they would fall into. For example; music, photos, writing, ebooks, movies, and so on as you see fit. Don’t forget your email address book and your browser bookmarks.
  • Go through your /home directory and document where each file type is stored. If there are multiple users on your system, it would be a good idea to do this for each one.
  • Go through the rest of your hard drive and make sure you don’t have those files elsewhere, as well.
  • Write down all of directories that have files you want to keep. If your organization is spotty, you might want to take this opportunity to put your files into some logical order. If you move things, be sure to update your list.
  • Make a list, check it twice. You don’t want to do a back up only to discover you forgot that one really important set of files.
  • Get a rough estimate on how much space all of this is going to take up.

Where to Put it?

Now you need to plan out where you’re going to put all of this stuff you want to save. In a perfect world, you’ve got a spare disk (maybe external?), with enough space for everything you want to save. If this is the case, it makes life a lot easier. If not, hope is not lost.

Most likely, you’re going to end up putting your data on a spare disk or on some static media like a DVD or CD. A spare disk is probably the easiest way to go, but if you don’t have one, DVDs or CDs are still viable options. Depending on the total amount of data you’re retaining, you might end up using a lot of DVDs\CDs.

How to Back Up

There are a slew of ways you can back up your data. Some are easier than others, some are more complicated than others. For this example, I’m going to use rsync. Rsync is a simple and robust tool that you can use now and with your regular backups.

  • Backing up to a Spare Disk

So, let’s say you’ve want to save your /home directory (about 5GB, let’s say) and your music directory, which is actually off of the root tree in /mp3. You’ve got a 200GB external USB drive with plenty of space.

Sweet. This will be easy.

Once your external drive is plugged into the system, you’ll most likly find a new mountpoint in /media, called something like /usbdrive. The full path would be something like /media/usbdrive. For the sake of organization, I would create separate destinations for each unique path. So in /media/usbdrive, I’ll make a directory called /home_backup and another called /mp3_backup.

cd /media/usbdrive

mkdir home_backup

mkdir mp3_backup

Now we start the back up:

rsync -avrc /home/yourusername/ /media/usbdrive/home_backup

Here’s what we did:

The switches:

  • -a does the transfer in archive mode, so your permissions, symbolic links, etc. are preserved.
  • -v does the transfer in verbose mode, so rsync will tell you what it is doing. This is optional; I like to have it around.
  • -r does the transfer recursively into all subdirectories.
  • -c forces a checksum to make sure there were no errors in the copying process.

The rest:

  • /home/yourusername is the source directory
  • /media/usbdrive/home_backup is the–that’s right, you guessed it–destination directory.

This is going to take a while, most likely, and is incredibly boring to watch. Really. Once it is complete, you’ll do the same thing for the other data you want to back up, changing the source and destination as appropriate.

Backing up to a directory on the same partition

This is just as easy as backing up to an external drive, with a few extra steps and a little more time.

Navigate to the root directory and make a back up directory, then take ownership of it.

cd /

sudo mkdir backups

sudo chown yourusername:yourgroupname backups

Now again, we want to have separate directories for each destination.

cd backups

mkdir /home_backup

mkdir /mp3_backup

And now for the backup itself:

rsync -avrc /home/yourusername/ /backups/home_backup

Repeat for any other directories you want to save.

many hours later….
Your backups are complete, now what?

Verifying Your Backups (either method)

Now that you’ve got your backups completed, you’ll want to double-check them and make sure that your data has been preserved.  The -c switch did this for you, making sure that all of the file sizes matched up okay, but I’m paranoid and always want to check for myself.

Do this by simply browsing the files and checking them at random, maybe 20-30.  If there’s anything that’s really important, you might want to check the whole directory.
Moving Your Backups to Other Media

Now that you’ve got everything backed up and verified, it is time to move everything to your (hopefully) DVDs or (ick) CDs.  I’m sure there are better ways to do this that are far more elegant, but I just select blocks of files and burn them using k3b (or Gnomebaker, if you go that way).

Once you’ve moved your data to your DVDs, be anal and verify them again.  It would lame to go to all this trouble, only to find there was an error and you’ve lost your shit.  That, I think, would make me lose my shit in a big way.

Next time…on to the upgrade!






Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: