Home > Enterprise Linux Tips > Administrator > Troubleshooting, finding lost files in Linux servers
Enterprise Linux Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ADMINISTRATOR

Troubleshooting, finding lost files in Linux servers


Sander van Vugt
03.05.2007
Rating: -4.56- (out of 5)


Enterprise IT tips and expert advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


Sometimes a server crashes or an error appears on a hard drive, and you can't access your file system. It's a hard fact of IT life, but it doesn't have to be terribly difficult to access data you thought was lost forever. If it is an ext2 or ext3 file system in a Linux environment, there is a way to access it anyway, even if at first sight you can't.

This tip will help you troubleshoot and then access damaged partitions in a Linux environment where the ext3 file system is used, as it is in about 80% of all Linux servers in use today. You'll learn how to benefit from advanced mount options that allow you to access data that you may have considered lost.

Accessing a file system with superblock

In order to access a file system, you need the superblock. This is a 1 kilobyte block that contains all metadata about the file system. It normally is the second 1 K block on an ext3 file system. In the listing below, you can see a part of the contents of the superblock as displayed with the debugfs utility:

The problem arises when, due to some error, the superblock isn't accessible anymore. Fortunately, some backup copies of the superblock are written on the ext3 file system by default. Using these backup copies, you can still mount a file system that you may have considered lost otherwise.

The actual position on disk of the first


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


backup of the superblock depends on the size of the file system. On modern large file systems, you will always find it at block 32768. To access it, you can use the mount option -o sb.

The problem arises when the mount expects you to specify the position of the superblock in 1024 byte blocks. 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 the position of the superblock by 4; which would result in the block value 131072 in most cases. 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 thus limited the scope of the problem to the superblock, it is time to fix the problem. You can do this by copying the backup superblock back the the location of the old superblock. You can do that using

Once you've finished, your file system is accessible again in the way it was before.

Problems mounting ext3 file systems often occur because of a problem in the administrative information at the beginning of the file system. If the problem comes from the superblock, you can mount the file system anyway, using a backup superblock and the mount option -o sb. Using dd, you can even restore the superblock to its original location.

Rate this Tip
To rate tips, you must be a member of SearchEnterpriseLinux.com.
Register now to start rating these tips. Log in if you are already a member.




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Enterprise Linux Web Server & Application Server
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2003 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts