Wednesday, January 2, 2013

Backup strategies: Here's mine. What's yours?

Every now and then I start asking some of the people I know and work with about their backup strategies.  I thought it was time for me to share my backup strategy.

I have several systems that I use throughout my house but, they all follow the same basic strategy:
  • daily backups of each computer to a storage device in my home network
  • daily backups of my local storage device to a remove location

I use two different tools for the job:
Déjà Dup

In the following paragraphs, I will provide more details on how I currently backup my main laptop.

My main computer uses Déjà Dup to backup my home directory and saves to a shared network drive via SSH.  This gives me the flexibility of backing up to my drive ( at home ) from anywhere where I have network connectivity.

Let's go through this in a bit more detail:

Backup Drive

First things first.  Let's get a drive in which to backup our data.  I have a 2TB USB drive attached to one of my servers that I make available via SSH to my local network.

Here are the steps that I took to get the drive connected, partitioned, formatted, mounted and available:

  • Connect drive to any available USB port on your server.
    • Make sure to turn the power on your USB drive :)
    • On my server, the USB drive showed up as /dev/sdd1 as there is an existing partition there
  • Let's partition the drive with cfdisk  ( Please read the manual for cfdisk BEFORE doing anything with cfdisk. )
    • sudo cfdisk /dev/sdd ( notice that I am working with the entire drive here and not just the partition )
    • delete any partitions in the drive and create one ext4 partition that uses the entire drive.
      • Use the menu items at the bottom to delete the existing partitions
      • When you create a new partition, cfdisk will default to create a partition using all available space, keep those defaults
      • The linux partition type is 83 ( cfdisk should default to this but, just in case you need it )
      • Make sure to Write the changes to disk

At this point, you should have a new partition on your backup drive:
  • In my case, my USB drive was recognized as /dev/sdd.
  • I created one partition on that drive.
  • The above tells me that my partition should be /dev/sdd1

Let's format our partition to get things going:
  • sudo mkfs.ext4 /dev/sdd1

Alas!  We have a partition ready for use.  Let's mount it ( mine is mounted on /media/Backup1 ):
  • sudo mkdir -p /media/Backup1
  • sudo mount /dev/sdd1 /media/Backup1

If you've made it this far, you should now have a new "mount point" where you can access your backup drive.  Let's verify that by checking what partitions have been mounted:
  • df -h
    • The backup drive should be listed there as one of the partitions.  Here is what the relevant part of mine looks like:
      • /dev/sdd1                1.8T  466G  1.3T  27% /media/Backup1

The last part on getting the Backup drive ready is to ensure that it can be accessed from your network.  In my case, i have a username on all of the boxes that can access the backup server via SSH key.  I also ensure that /media/Backup1 is owned by this username:
  • sudo chown -R negronjl:negronjl /media/Backup1 
    • ( Feel free to use whatever username you want for the above )

Déjà Dup

  • I use Ubuntu on my systems so, I already have Déjà Dup installed and only need to configure a few things to get going
    • Open the dash ( Super key ) and type backup.  Déjà Dup will be in that list under the name of Backup.
    • Click on Backup.
  • My Déjà Dup configuration looks something like:
  • Storage tab:
    • Backup location: SSH
    • Server: <my backup server>
    • Port: 22
    • Folder: /media/Backup1/DejaDup
    • Username: <negronjl> Use whatever username you used in the previous step
  • The Folders tab:
    • Folders to back up: <home directory>
    • Folders to ignore: Trash, Downloads
      • In the above setting, feel free to add any folder already being backed up or that needs to be ignored.
  • Schedule:
    • How often to back up: Daily
    • Keep backups: At least 28 days ( This can be changed )
  • Close the window ... everything should be up and running now.


I use backupninja to backup my entire machine in case of catastrophic failure.  Here is how to set up and configure backupninja:
  • sudo apt-get install backupninja
This is what my backupninja configuration file looks like:
  • when = everyday at 01
    options = --s3-use-new-style
    nicelevel = 19
    testconnect = no
    tmpdir = /home/backupninja/tmp
    sign = yes
    encryptkey = <your GPG key>
    password = <your GPG key password>
    include = /etc
    include = /home
    include = /opt
    include = /usr/local
    include = /root
    exclude = /home/*/.gvfs
    exclude = /home/*/.Private
    exclude = /home/.ecryptfs
    incremental = yes
    increments = 30
    keep = 60
    desturl = rsync://<backup_username>@<backup_server>//media/Backup1/Backups/backupninja/negronjl-laptop/negronjl-laptop
    awsaccesskeyid = <YOUR_AWS_ACCESS_KEY_ID>
    awssecretaccesskey = <YOUR_AWS_SECRET_KEY>
Adapt the above file to suit your needs ( usernames, passwords and such ) and save it to /etc/backup.d as something like <number>-<name>.dup Where <number> determines the order of execution of the files in the /etc/backup.d/ directory and <name> is an identifying name for the file ( something that tells you what the file is/does ).  As an example, my backupninja configuration file is named: 
  • 93-negronjl-laptop-local.dup
I'd love to hear your backup strategies ... 


  1. In the following paragraphs, I will provide more details on how I currently backup my main

  2. Thank you for sharing the information here. Its much informative and really i got some valid information. You had posted the amazing article.

    Hadoop Training in Chennai

  3. Now it is known to me that articles is nothing but inspiring is everything to do something great. This is a great article for the people who want to come in freelancing.

    Android Training in Chennai

  4. Great article!! This is very important information for us.I like all content and information.I have read it.You know more about this please visit again.

    Hadoop training in Chennai


  5. Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care and we take your comments to heart.As always, we appreciate your confidence and trust in us.

    SAP training in Chennai

  6. This article creates a new hope and inspiration with in me. Thanks for sharing article like this. The way you have stated everything above is quite awesome. Keep blogging like this. Thanks.

    SAP training in Chennai

  7. I simply want to say I’m very new to blogs and actually loved you’re blog site. Almost certainly I’m going to bookmark your blog post . You absolutely come with great well written articles. Thanks a lot for sharing your blog.

    Digital marketing company in Chennai

  8. iDeals Virtual data room brings powerful online backup, cloud storage, collaboration and sharing features to your business. It’s easy to use making it suitable for everyone – from one man businesses up to larger enterprises.


  9. Great and useful article. Creating content regularly is very tough. Your points are motivated me to move on.

    SEO Company in Chennai

  10. All are saying the same thing repeatedly, but in your blog I had a chance to get some useful and unique information, I love your writing style very much, I would like to suggest your blog in my dude circle, so keep on updates.

    SAP SD Training in Chennai

  11. Your procedure and way of idea is really good and thus it is very much interesting, i came too know more information about your blog.

    Online Reputation Management

  12. Provides great information about the concept.It helps an individual to gain knowledge on new techniques.Keep on giving this type of information.
    SEO Training in Chennai