Friday, August 19, 2011

Files with no inode, no owner and no group.

Yesterday i encountered a file system error on my server. Some of files in one of partition formatted with ext3 was showing ? in place of inode, owner and group position.

root# cd /data/Trash

root# ls -li

? ? ? ? ? abc.txt

I become confused. find command also report a number of files which has no owner

root# find /data/Trash -nouser

Investing through problem result in conclusion that there is file system error in that partition. I advised apply fsck command immediately. Applying fsck solved the problem but i am searching in what condition file exist without inode number.

root# fsck -y /dev/vg1/lv1

I also ensured that that file system get applied fsck on reboot

root# shutdown -Fr now

One interesting point i learned in between is that maximum 16 consequent times a file system can get mounted without applying fsck after that a warning come to fsck although this setting can be override with tune2fs command.

The best option to reduce file system error is to apply fsck at booting time. This can be easily done by making entry in /etc/fstab for example in my case the entry is

/dev/vg1/lv1 /data ext3 defaults 1 2

Here 1 says apply fsck and 2 says after applying fsck on root.