At any moment a system admin may come across file system failures due to issues with data structures (or objects such as inode, directories, superblock etc. This can be caused by any reason:
Buggy device driver or utilities (especially third party utilities)
Mistakes by System Admin
Kernel bugs
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
So how you are going to Survive in a Filesystem Failures? Most of time fsck utility can fix the problem, first simply run e2fsck to check a Linux ext2/ext3 file system
Assuming /data /dev/sda2 partition filesystem, first unmount /dev/sda2 then type following command :
# e2fsck -f /dev/sda2
Where,
-f : Force checking even if the file system seems clean.
Please note that If the superblock is not found, e2fsck will terminate with a fatal error. However Linux maintains multiple redundant copies of the superblock in every file system, so you can use -b {alternative-superblock} option to get rid of this problem. The location of the backup superblock is dependent on the filesystem’s blocksize:
For filesystems with 1k blocksizes, a backup superblock can be found at block 8193
For filesystems with 2k blocksizes, at block 16384
For 4k blocksizes, at block 32768.
You can also try any one of the following command(s) to determine alternative-superblock locations:
# mke2fs -n /dev/sda2
OR
# dumpe2fs /dev/sda2 | grep -i superblock
To repair file system by alternative-superblock use command as follows:
# e2fsck -f -b 8193 /dev/sda2
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 other partition or disk)
# dd if=/dev/sda2 of=/disk2/backup-sda2.img
Buggy device driver or utilities (especially third party utilities)
Mistakes by System Admin
Kernel bugs
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
So how you are going to Survive in a Filesystem Failures? Most of time fsck utility can fix the problem, first simply run e2fsck to check a Linux ext2/ext3 file system
Assuming /data /dev/sda2 partition filesystem, first unmount /dev/sda2 then type following command :
# e2fsck -f /dev/sda2
Where,
-f : Force checking even if the file system seems clean.
Please note that If the superblock is not found, e2fsck will terminate with a fatal error. However Linux maintains multiple redundant copies of the superblock in every file system, so you can use -b {alternative-superblock} option to get rid of this problem. The location of the backup superblock is dependent on the filesystem’s blocksize:
For filesystems with 1k blocksizes, a backup superblock can be found at block 8193
For filesystems with 2k blocksizes, at block 16384
For 4k blocksizes, at block 32768.
You can also try any one of the following command(s) to determine alternative-superblock locations:
# mke2fs -n /dev/sda2
OR
# dumpe2fs /dev/sda2 | grep -i superblock
To repair file system by alternative-superblock use command as follows:
# e2fsck -f -b 8193 /dev/sda2
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 other partition or disk)
# dd if=/dev/sda2 of=/disk2/backup-sda2.img
DISCLAIMER: The
information provided on this website comes without warranty of any kind and is
distributed AS IS. Every effort has been made to provide the information as
accurate as possible, but no warranty or fitness is implied. The information
may be incomplete, may contain errors or may have become out of date. The use
of this information described herein is your responsibility, and to use it in
your own environments do so at your own risk.
Copyright
© 2012 LINUXHOWTO.IN
No comments:
Post a Comment