Pin Me

How To Perform A Backup Recovery in Linux

written by: Daniel Case•edited by: Lamar Stonecypher•updated: 8/8/2010

This article goes through the basics of performing a recovery using dd and then covers how you can use the Ubuntu Simple Backup application to do the same thing, which is a lot more user friendly.

  • slide 1 of 3

    Introduction

    There are many different ways to restore your data to a lost system, maybe you have replaced a hard drive, accidentally deleted something valuable, hosed your system or maybe you got infected by something nasty (which is still possible in Linux). It depends mainly on how you have backed up your data, and in this article I will be going through the most common ways to restore a fully working system.

    This article mainly focuses on the use of dd as it is a universal backup utility. However, a method that you can use in Ubuntu is also included, but it works only if you used the same application to back up your system.

    If you would like to learn more about backing up a system please check the Bright Hub article "Copy Your Ubuntu to another Hard Drive," which covers making a bit-by-bit copy of the hard drive.

  • slide 2 of 3

    dd restore

    I covered a lot of this command in the link above because dd can be used to both backup and restore system data. It is the most effective way of doing a good backup, but you will have to used it to back up using this command as well and stored the data in an archive file. (usually .tar.gz)

    Please read and double check these instructions as you could damage your system even further if you don't know what you are doing as dd is a very advanced utility!

    In order to restore your image, you will need to boot into a Live environment (LiveCD, LiveUSB, etc.) and gain root access. Then you will need to work out where your hard disk is located on the file system. In order to do that run the following command:

    fdisk -l

    This will now show you where all of your disk drives are located. Once you have found the one that is your hard drive keep a note of where it is (/dev/hda as an example). If are not running the command as a root user it will not return anything.

    The next thing to do is run the dd command itself and let the restore commence. In order to do this you will need to be able to access the image I mentioned earlier and have the hard drive unmounted. If it is mounted, just run: umount /dev/hdx replacing hdx with where your actual hard drive is on the system.

    dd if=/path/to/image of=/dev/hdx (Replace hdx with your hard drive- incorrect placement could screw your system over royally!)

    This will take some time because it's a bit-by-bit copy, so go and get a coffee or two :)

  • slide 3 of 3

    Partial Restore

    In order to do a partial restore, you can use some tools included. For this example i will use the Ubuntu Simple Backup Suite. If you are using another distribution I recommend you go and find out what backup methods they include too, because there are too many to list in this one article.

    The simple backup suite is a very nice GUI application that allows you to backup and restore quite easily. It has a massive help page which is located here https://help.ubuntu.com/community/BackupYourSystem/SimpleBackupSuite and is great for anybody who does not want to use dd.

    If you have backed up previously with the backup suite, then this section will show you how to restore it back to your system. The first thing you must do is open the restore application, so click on "System" → "Administration" → "Simple Backup Restore" and then choose the backup you would like to restore and what you would like to restore from it. There will usually be the options of etc, home, var, and usr. If you have just deleted something personal from your home folder, only restore home. If it is more serious then restore them all.