Linux Recovery: Restore Guide

Linux Recovery: Restore Guide
Page content

Introduction

A Linux system is not perfect, and sometimes things can go very wrong as with any system. It is important to backup your data and ensure that if the worst happens you still have a copy. In this article I will go through how to restore your system should something happen, and also how to prevent it happening in the future.

You may also want to report a bug if it was a software problem that caused your Linux installation to completely fail. Also note that using Beta or unreleased software can cause an unsolicited amount of problems, which is why it is only recommended for test machines with no important data.

Restore Your Linux System

The first thing you need to do is identify the problem, if the system will not boot at all then in all likelihood it is to do with your bootloader. If you have a newer Linux system you are likely using Grub2. You can boot from a LiveCD which will allow you to access your previous system and fix the bootloader using the recovery commands.

The LiveCD can be used to gain access to your local system as if you were on it normally, to do this you just need to run a few simple commands to chroot your system.

If it is not the bootloader but something within the system, you can edit the file /etc/default/grub from your LiveCD, and take out the quiet splash from GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash”. Then run update-grub from the chrooted system, and reboot. This will then show you exactly where the system crashes, and allow you to solve it from there.

Recover Your Linux System

ubuntu-partition-8-all

If all else fails then we must do a destructive recovery. This process will delete everything on the computer (or the Linux partition) so make sure you have all your important data backed up elsewhere. If you have a USB drive or some spare DVD’s on hand and back everything up from within the LiveCD by mounting your Linux partition and dragging the important data onto external media.

Now that all the files are certainly safe, ensure that you take out the external media you used for the backup, and you can run the install process. On most LiveCDs there is a desktop icon which allows you to install the operating system, Ubuntu is one of the most popular. If Linux is the only operating system then feel free to choose the Guided - Use Entire Disk option to overwrite your entire hard drive. If you have more than one operating system on the machine then you must choose manual, and select the old Linux partition to be formatted and mounted as root (/).

The install should proceed and when it is completed you should be able to boot into a new Linux system, and start to restore your important data from the external media.

Conclusion

That concludes this article on recovery and restoration of your Linux system. A destructive recovery is always to be used as a last resort should nothing else work, but you may notice a very large speed increase and it might often be better to start a new as an operating system can age and slow down over time.

In order to prevent this from happening again, always ensure that you only download software from the official repositories, and if you do need to compile something ensure that you know precisely what it does first. You may also want to do an fsck to check your file system and hard disk are all in good shape.