Wednesday, January 2, 2013

How to Salvage Your Data Post Linux File System Failures

Every time you do not blame the operating system for issues. Even if you are running solid operating system and using robust file system, you are not immune to failures or corruption. Anything can go wrong with your hardware and cause the underlying file system to get corrupt. In such situations, you will find files missing from their original folders or deleted accidentally from your system. However, if you are using Linux, then you are still on the safe side. A range of essential utilities are built into Linux that can help you get past typical file system errors and recover your deleted files intact. 'e2fsck' is one of the critical Linux file system check tools used for the Ext2/Ext3/Ext4 family of file systems.

The e2fsck tool is a successor to UNIX fsck utility. It can verify the integrity of your file system to repair corruption induced by an unclean shutdown or other similar reasons. Further, it can repair a range of file system errors. One issue that is a pain in the neck for many is that the e2fsck tool can be only used for unmounted partitions. This means you cannot repair a file system that you are currently working on. One way out of this problem is to get your system to run level 1 using 'Init 1' and then unmount the file system to be checked. To run this command, you need to have administrator's rights.

Once you get your system to run level 1, unmount the partition (for instance /dev/sdb1) as follows:

umount /dev/sdb1

Next, perform the check by running 'e2fsck' as shown:

e2fsck -y /dev/sdb1


The '-y' option used with e2fsck will specify 'Yes' for each of the questions asked by the command. The e2fsck utility will find errors on the file system and repair them at the same time. The overall time taken by the repair varies depending on the size of the partition and the extent of corruption. You can rerun the same command to see if all the errors have disappeared.

An alternative to the above workaround is to use your distribution's live CD for booting and then perform the file system check. After performing the check, you need to unmount the file system. If the same errors occur again, you can take help of professional Linux data recovery software. These software enable you to fix file system errors and recover every bit of precious data from your Linux systems.