Linux EXT2 File System Data Recovery

Data Recovery for EXT 2 : File System for Linux

The ext2 file system supports standard UNIX file types: regular files, device special files, symbolic links and directories. The UNIX files are supported by ext2 file system.

Ext2 file system is able to manage file systems created on really big partitions. While the original kernel code restricted the maximal file system size to 2 GB, but with recent work, it is now possible to use big disks without the need of creating many partitions.

Ext2 file system provides long file names. It uses variable length directory entries. The maximum file name size is 255 characters. This limit could be extended to 1012 if required.

Ext2 file system reserves some blocks for the super user (root). Normally, 5% of the blocks are reserved. This allows the administrator to recover easily from situations where data recovery process is much difficult.

Ext2 file system is a powerful and extensible file system for Linux and it is the most successful file system in the Linux community. The EXT2 file system is built on the basis that the data held in files is kept in data blocks. These data blocks are all equal in length. This length can vary between different types of EXT2 file systems. The block size of a particular EXT2 file system is set when it is created. Every file's size is rounded up to an integral number of blocks.

EXT2 defines the file system topology by describing each file in the system with an inode data structure. An inode describes the access rights of the file, the file's modification times and the type of the file. Every file in the EXT2 file system is described by a single inode and each inode has a single unique number identifying it. The inodes for the file system are all kept together in inode tables. EXT2 directories are simply special files which contain pointers to the inodes of their directory entries.

  • EXT2 Inode: The basic building block in the EXT2 file system is the inode. Every file and directory in the file system is described by only one inode. In order to keep track of allocated and unallocated inodes, the EXT2 inodes for each Block Group are kept in the inode table together with a bitmap.

  • EXT2 Superblock: The description of the basic size and shape of this file system is contained in the superblock. The information within the superblock is used by the file system manager to maintain the file system. Usually only the Superblock in Block Group 0 is read when the file system is mounted but each Block Group contains a duplicate copy in case of file system corruption or failure which and it is an indication for the administrator to check the consistency of blocks and recover files if needed.

  • EXT2 Group Descriptor: Each Block Group has a data structure describing it. Like the Superblock, all the group descriptors for all of the Block Groups are duplicated in each Block Group in case of file system corruption.
  • EXT2 Directories: In the EXT2 file system, directories are special files that are used to create and hold access paths to the files in the file system.

Ext2 Memory Data Structures

When the file system is mounted, all the information stored in the disk data structures of an Ext2 partition is copied into RAM. This allows the kernel to avoid many subsequent disk read operations. Some fundamental operations are given below to get an idea of how often some data structures change:

  • On the creation of a new file, the values of the s_free_inodes_count field in the Ext2 superblock and of the bg_free_inodes_count field in the proper group descriptor must be decremented.
  • If the kernel appends some data to an existing file so that the number of data blocks allocated for it increases, the values of the s_free_blocks_count field in the Ext2 superblock and of the bg_free_blocks_count field in the group descriptor must be modified.
  • Even just rewriting a portion of an existing file involves an update of the s_wtime field of the Ext2 superblock.

Creating The Ext2 Filesystem

In general there are two stages to create a file system on a disk. The first step is to format the hard disk so that the disk driver can read and write blocks on it. Modern hard disks come preformatted and need not be reformatted; floppy disks may be formatted on Linux using the superformat utility program. The second step involves creating a filesystem, which means setting up the structures.

Ext2 filesystems are created by the mke2fs utility program; it assumes the following default options, which may be modified by the user with flags on the command line:

  • Block size: 1,024 bytes
  • Number of allocated inodes: one for each group of 4,096 bytes
  • Fragment size: block size (block fragmentation is not implemented)
  • Percentage of reserved blocks: 5 percent

The program performs the following actions:

  • Initializes the group descriptors and superblock.
  • Optionally, checks whether the partition contains defective blocks, in which case, it creates a list of defective blocks.
  • For each block group, all the disk blocks needed to store the superblock, the inode table, the group descriptors, and the two bitmaps.
  • Initializes the inode bitmap and the data map bitmap of each block group to 0.
  • Initializes the inode table of each block group.
  • Creates the /root directory.
  • Creates the lost+found directory, which is used by e2fsck to link the lost and found defective blocks.
  • Updates the inode bitmap and the data block bitmap of the block group in which the two previous directories have been created.
  • Groups the defective blocks (if any) in lotsht+e found directory.

Recovering Lost EXT2 Linux Filesystems

There are multiple types of media failures and for each type of failure is a process for recovery. Data recovery is a very precise method. There are a variety of software programs available that recover data. In many cases where your hard drive is not physically damaged, these tools can often be helpful. However, when dealing with physical damage to a hard drive, these tools can destroy any last hope of a successful recovery.

In case of data loss, if you require file recovery from your lost ext2 file system, you should immediately stop using the damaged drive. Every moment the drive is powered can potentially cause critical damage making the drive unrecoverable. For data recovery contact at: www.optimumrecovery.com

Standard Ext2 Features

  • The Ext2fs supports standard Unix file types: regular files, directories, device special files and symbolic links.
  • Ext2fs is able to manage filesystems created on really big partitions. While the original kernel code restricted the maximal filesystem size to 2 GB, recent work in the VFS layer have raised this limit to 4 TB. Thus, it is now possible to use big disks without the need of creating many partitions.
  • Ext2fs provides long file names. It uses variable length directory entries. The maximal file name size is 255 characters. This limit could be extended to 1012 if needed.
  • Ext2fs reserves some blocks for the super user (root). Normally, 5% of the blocks are reserved to recover data in case of damage.

Efficiency of EXT2

  • The system administrator may choose the optimal block size (from 1,024 to 4,096 bytes), while creating an ext2 file system, For instance, a 1,024-block size is preferable when the average file length is smaller than a few thousand bytes because this leads to less internal fragmentation. It is usually preferable to use larger block size when files are greater than a few thousand bytes because this leads to fewer disk transfers, thus reducing system overhead.
  • When creating an Ext2 filesystem, the system administrator may choose how many inodes to allow for a partition of a given size, depending on the expected number of files to be stored on it. This maximizes the effectively usable disk space.
  • The filesystem preallocates disk data blocks to regular files before they are actually used. Thus, when the file increases in size, several blocks are already reserved at physically adjacent positions, reducing file fragmentation.
  • The filesystem partitions disk blocks into groups. Each group includes data blocks and inodes stored in adjacent tracks. Files stored in a single block group can be accessed with a lower average disk seek time.
  • Fast symbolic links are supported. If the pathname of the symbolic link has 60 bytes or less, it is stored in the inode and can thus be translated without reading a data block.

info image For data recovery, visit www.optimumrecovery.com

Top of current page image Up

 

About Us  |   Data Recovery Services   |  Data Security  |  Privacy Policy  |   Partners  |  Testimonials  |  Contact Us  |  Site Map
Data Recovery UK | Data Recovery US
Copyright 2006 © Optimum Data Recovery, Inc.
SEO by Geeksnerds