Monday, 20 June 2011

Finding Inode size in EXT2 and EXT3 Filesystem

I need to find out inode size of my ext3 file system for recovery purpose. How can I find the inode size of an ext2/ext3 filesystem?


you can use tune2fs command which allows various tuna able parameters in ext2 and ext3 Filesystem

tune2fs -l /dev/sda2


The -l option lists the inode size of the filesystem. Using the same option, other information of the filesystem superblock can also be seen. The superblock contains information about the filesystem, such as the number of free blocks available, and the number of mounts, that may be useful for tuning purposes.


tune2fs -l /dev/sda2 | grep Inode



Output:
Inode count:              12222464
Inodes per group: 16384
Inode blocks per group: 512
Inode size: 128
Tune2fs allows to change inode size from default 128 bytes to almost anything (but it should be power of two). What are reasons for changing default inode size

An inode is a data structure on a traditional Unix-style file system
such as UFS or ext3. An inode stores basic information about a regular
file, directory, or other file system object.
Each and every file under Linux (and UNIX) has following attributes:
  • File type (executable, block special etc)

  • Permissions (read, write etc)

  • Owner

  • Group

  • File Size

  • File access, change and modification time

  • File deletion time

  • Number of links (soft/hard)

  • Access Control List (ACLs)

All the above information is stored in an inode.
So, each file has an inode associated with it and an unique number called inode number.This number is used to look up an entry in the inode table.


No comments:

Post a Comment