Labels

Wednesday, December 28, 2011

File System in Linux

File system is a formated partition on a hard disk

It contains 2 things

  • User Data : Most of the space is used by user`s data

  • Metadata : Metadata describes the structure of the file system. Most common metadata structure are superblock, inode and directories


Superblock


superblock, which contains information about file system such as:

  • File system type

  • Size

  • Status

  • Information about other metadata structures

Due to filesystem failure:

  • File system will refuse to mount

  • Entire system get hangs

  • Even if filesystem mount operation result into success, users may notice strange behavior when mounted such as system reboot, gibberish characters in directory listings etc

To repair file system

e2fsck -f /dev/sda3



Where,

  • -f : Force checking even if the file system seems clean.



If super block is not found

dumpe2fs /dev/sda3|grep -i superblock

To repair file system by alternative-superblock use command as follows:
# e2fsck -f -b 8193 /dev/sda3



However it is highly recommended that you make backup before you run fsck command on system, use dd command to create a backup (provided that you have spare space under /disk2)


# dd if=/dev/sda2 of=/disk2/backup-sda2.img

No comments:

Post a Comment