Linux Recovery and Restore
Linux grants an extraordinary amount of power and control to its users; but all the extra control can be a recipe for disaster if not used with care and responsibility. The command-line shell, when under the control of an experienced user, provides surgical control and manipulation over your environment, but when this powerful tool is misused chaos and confusion can set in.
Case in point: you intend to remove a directory tree with the “rm –r” command, but you accidentally mistype the directory's name, naming another directory instead. Bye, bye directory. What? Most Linux distros don't provide a recycle bin? It's a horrible feeling. Let's go through some common techniques used for Linux recovery and restoration of data.
The best defense against accidental deletion of data is to perform regular backups of your important content. Creating “tarball” archives of all your important files and storing them on a flash drive or even a floppy disk is an excellent preventive measure to ensure your data will “live on” even if your hard disk sadly expires before its time.
All Linux distros should come equipped with a nifty little tool named “tar”, its appellation cryptically referring to the old method of sequential tape backups for important data: Tape ARchiver.
Don't let tar's retroactive name fool you into thinking it's an outdated tool for today's data backup needs; it's perfect for quick backups that can be executed from the shell; tar archives an entire directory and its contents, compressing everything into a single, convenient file. For example, let's say your current working directory contains essential files and other directories inside of it. The following command will back up everything in your current working directory:
liquidbinary@arrakis:~$ tar –cvzf /tmp/mystuff.tar.gz .
Your current working directory—designated by a dot—is archived into a tarball file (mystuff.tar.gz) and placed in your “/tmp” directory; now you can save your tarball in a safe place, and, if disaster strikes, you have an archived copy of your data to restore what you lost. Do a “man tar” to get more information on the “tar” tool.
How do I Recover and Restore lost files?
Unless you run an advanced desktop environment—KDE, GNOME and similar desktop environments—you probably won't be given a second chance to recover an accidentally deleted file from the recycle bin; outside of a Windows-like desktop environment, the recycle bin concept does not exist in Linux.
You're not completely out of luck; you may still have a chance if your file system uses the ext2 format. Run this command to verify that the file you need to recover resides on an ext2 formatted partition:
The mount command should display something that resembles this output:
/dev/hdb on /mnt/backups type ext2 (rw)
Ok, so we know that we have an ext2 formatted partition. There's an easy-to-use program called “Recover v.1.3” that automates the process of restoring accidentally deleted files from the hard drive. Consult Google for the latest version of this program.
Back To Tips Homepage
How To Build A PC | Different Types of Keyboards | Help with Hard Drive Installation | Computer Networking Basics | Introduction of Motherboard Functions | Computer CPU Processor Speed | Upgrade from Windows 95 to Windows 98 | Computer Monitor Troubleshoot | Partition Hard Drive | Installing New CPU Processor | Types of Network Cables