You won't normally see many problems with your server's file system, but occasionally things go wrong and it will be damaged. In this article, you'll learn how to access a damaged ext3 file system.
If you receive a file system error, you will lose file system access. If it is an ext2 or ext3 file system, however, there is still a way in. Advanced mount options will help allow you to access data that you may have considered lost.
In order to gain this access, you need the superblock. This is a 1 KB block that contains all metadata about the file system, which is what you need to mount the file system. It is normally stored as the second 1 KB block on an ext3 file system. To show the contents of the superblock, you can use the utility. Listing 1 shows what the contents of the superblock looks like:
Listing 1: Contents of the superblock as displayed with debugfs
.
The problem with this command, however, is that it expects you to specify the position of the superblock in 1024-byte blocks, whereas the default block size for a modern ext3 volume or partition is 4096 bytes. Therefore, to tell the mount command where it can find the superblock, you have to multiply t...
To continue reading for free, register below or login
To read more you must become a member of SearchEnterpriseLinux.com
');
// -->

he position of the superblock by four. This means you should enter the block value 141072 when the first backup superblock is stored on block 32768. If, for example, your /dev/sda5 file system had a problem, you could try mounting it with the command .
Now that you have mounted the problematic file system and limited the scope of the problem to the superblock, it is time to actually fix the problem. There are both easy and not-as-easy options available. Let's start with the tougher solution, in which you can copy the backup superblock back to the location of the old superblock with the utility. To do this, use the code . Once finished, your file system should be accessible just as it was before.
If you don't like this complex and somewhat geeky way of recovering the lost superblock, you can always go for the easy solution. Just enter the code and your superblock will be noted as damaged and get repaired for you.
ABOUT THE AUTHOR: Sander van Vugt is an author and independent technical trainer, specializing in Linux since 1994. Vugt is also a technical consultant for high-availability (HA) clustering and performance optimization, as well as an expert on SLED 10 administration.