How to: Find the inode size of an ext2 / ext3 filesystem

in Categories , , , , , , last updated November 9, 2007

Q. 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?

A. You need to use tune2fs command, which allows the system administrator to adjust various tunable filesystem parameters on Linux ext2/ext3 filesystems.

Find the inode size of the filesystem

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.
# sudo tune2fs -l /dev/sda2

tune2fs 1.40.2 (12-Jul-2007)
Filesystem volume name:   
Last mounted on:          
Filesystem UUID:          8c2da865-13f4-47a2-9c92-2f31738469e8
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal resize_inode dir_index filetype needs_recovery sparse_super large_file
Filesystem flags:         signed directory hash 
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              12222464
Block count:              24412775
Reserved block count:     1220638
Free blocks:              17464715
Free inodes:              12055081
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      1018
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         16384
Inode blocks per group:   512
Filesystem created:       Sat Oct  6 04:51:23 2007
Last mount time:          Fri Nov  9 08:07:04 2007
Last write time:          Fri Nov  9 08:07:04 2007
Mount count:              12
Maximum mount count:      32
Last checked:             Mon Nov  5 13:33:36 2007
Check interval:           15552000 (6 months)
Next check after:         Sat May  3 13:33:36 2008
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128
Journal inode:            8
First orphan inode:       1163400
Default directory hash:   tea
Directory Hash Seed:      bcaf359b-11c2-4c1a-8823-92be72c09ac4
Journal backup:           inode blocks

To find the inode size, enter:
# sudo tune2fs -l /dev/sda2 | grep Inode

Inode count:              12222464
Inodes per group:         16384
Inode blocks per group:   512
Inode size:               128

Linux / UNIX: Cannot Preserve Ownership Error when Files are Moved or Copied

in Categories , , , , , , , , , last updated September 21, 2007

Q. I’m using CentOS Linux. I’m getting an error – Cannot Preserve Ownership, when I try to copy files from Linux ext3 to FAT32 or files moved to an NFS NAS server mount point. How do I fix this error and copy / move files?

A. Generally you use command like cp or my to copy file. While copying a file these command try to copy file attributes such as ACL information or group access information etc. FAT32 and NFS mount mount cannot support all sort of attributes and these commands cannot differentiate between a filesystem that doesn’t support ACL and Linux file system permission.

All your files will be copied or moved without ACL and permissions. You can ignore this error and files should be copied / moved successfully.

Examining the Linux / FreeBSD / UNIX filesystem with ls command

in Categories , , , , , , , , , , , , , last updated August 6, 2007

Q. I’m new to Linux and how do I examine filesystem and identify regular files or directories?

A. Both Linux and UNIX comes with ls command for examining the filesystem. You can use ls command to look at the filesystem. ls command can display:
=> Character devices
=> Regular files
=> Sym links (symbolic links)
=> Directories
=> Pipes
=> Sockets
=> Block devices

ls command examples

Display /etc directory files, enter:
$ ls /etc
When invoked without any arguments, ls lists the files in the current working directory:
$ ls
Use -l (long option) to lists filenames, sizes, permissions, type and all other information:
$ ls /etc/passwd

-rw-r--r-- 1 root root 2453 Jul 17 16:25 /etc/passwd

See Linux / UNIX file permissions for more information


A directory is marked with a d as the first letter of the permissions field:
ls -ld /etc

drwxr-xr-x 88 root root 12288 Aug  5 23:46 /etc

Symbolic link

A symbolic link is marked with an l (lower case L) as the first letter of the permissions string:
ls -l /bin/nisdomainname

lrwxrwxrwx 1 root root 8 Jul 10 08:50 /bin/nisdomainname -> hostname


  • A named pipe is marked with a p as the first letter of the permissions string.
  • A socket is marked with a s as the first letter of the permissions string.
  • A character device is marked with a c as the first letter of the permissions strings. (ls -l /dev/console)
  • A block device is marked with a b (ls -l /dev/sdb1).

MySQL error 28 and solution

in Categories , , , , , , , , , last updated December 17, 2007

Q. I am getting an error that read as follows:

MySQL: got error 28 from server handler

How do I fix this problem?

A. This error means no space left on hard disk. According to official MySQL docs, “If you get his error, you need to check all filesystems where MySQL operates. It may be single filesystem or as we recommend you can have datadir, tmpdir and log files split into dedicated filesystems.”


a) Stop mysql server
# /etc/init.d/mysql stop
# /etc/init.d/mysqld stop
b) Check filesystem and /tmp directories:
$ df -h
$ cd /tmp
$ df -h /tmp

c) Remove files from /tmp to free up space:
# cd /tmp
# rm -rf *

d) Look into /var/log directory and remove or compress logs file.

e) Use myisamchk command to check and repair of ISAM table:
# cd /var/lib/mysql
# myisamchk

f) Increase disk space (add new hard disk or remove unwanted software(s) )

g) Start the mysql server:
# /etc/init.d/mysql start
# /etc/init.d/mysqld start

Linux Kernel panic VFS Unable to mount root fs and solution

in Categories , last updated March 13, 2008

Q. I am using Linux on HP server and I am getting error that read as follows:
Linux Kernel panic: VFS: Unable to mount root fs

How do I solve this problem?

A. Most modern distributions including Debian uses loadable kernel module for ext3 file system. So to read ext3/ext2 file system kernel must load ext3 kernel module (ext3.ko).

This module is included in an initrd image. If an initrd image is missing or that image does not include suitable kernel modules to access the ext3 filesystem on the partition, an error message (Linux Kernel panic: VFS: Unable to mount root fs) will be displayed to you.

To solve this problem you need to use mkinitrd script that constructs a directory structure that can serve as an initrd root file system.

The instructions for creating initrd images are here on our site.