Posts Tagged 'technology'

Recover a Corrupt File System

The Linux File system

The Linux file system is a collection of directories and files stored on the disk. You can verify which file system your server utilizes by running the below command:

[root@example ~]# df –T
Filesystem    Type   1K-blocks      Used       Available    Use%   Mounted on
/dev/sda1     ext3      5160576    1795916   3102516    37%       /
tmpfs            tmpfs     1048576         0            1048576    0%     /dev/shm

By running the command df –T  (print file system type) , we can see this server has an Ext3 file system. Ext3 is an enhanced version of Ext2 with improved journaling, which allows for greater reliability and even faster file system recoveries.

A Corrupt File System

If you are in the middle of doing a system update or scaling the machine’s resources and the machine is then powered off unexpectedly, the server might suffer from a corrupt file system. When the file system becomes corrupt, it is unable to boot into normal mode.

You are able to verify if the file system is corrupt by rebooting the machine into Recovery through the Zunicore User portal. Once the machine is rebooted into Recovery, you can try to run the following commands to determine the file system’s status:

[root@onapp ~]# mkdir /zunicore
[root@onapp ~]# mount /dev/sdb1 /zunicore
EXT3-fs warning: mounting fs with errors, running e2fsk is recommended

Restore the Corrupted System

You can easily restore a corrupted file system while using Zunicore’s Recovery feature. To correct the file system, you will need to run the fsck command. Fsck is a file system check utility that can check the system for inconsistencies and also repair discovered issues.

When you are using the Zunicore Recovery feature, your disk’s drive is labeled sdb1. So, you will need to run the fsck command against /dev/sdb1.

[root@onapp ~]# fsck -yf /dev/sdb1
fsck 1.39 (29-May-2006)
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Filesystem contains large files, but lacks LARGE_FILE flag in superblock.
Fix? yes

The fsck option –y will fix errors without prompting you each time the system attempts to fix a discovered issue.  The –f option will perform a quick check of any system that was not properly unmounted  before a system halt.

Once the fsck command is complete, you can reboot the system into normal mode.


Twitter Updates


Follow

Get every new post delivered to your Inbox.

Join 154 other followers