Thursday, October 29, 2015

How To See Characteristics of File Systems on Linux or Unix

How do I display the characteristics of file systems such as inodes, blocks, block size, file system name, state, lifetime writes, fsck status and more on Linux or Unix-like operating system?

You can use any one of the following command as per your Linux or Unix variant:
=> tune2fs command
=> lsfs command
=> fstyp command
=> df command

Linux show file system characteristics

Pass the -l option to list the contents of the filesystem superblock, including the current values of the parameters that can be set via tune2fs command. Type the following command:
# tune2fs -l /path/to/device | more
# tune2fs -l /dev/sda2 | grep
# tune2fs -l /dev/cciss/c1d1p1
# tune2fs -l /dev/mapper/data

Sample outputs:
Fig.01: tune2fs command in action
Fig.01: tune2fs command in action

You can use grep command to filter out information. For example, to see lifetime writes on ext4 filesystem, enter:
# tune2fs -l /dev/md0 | grep 'writes'
Sample outputs:
Lifetime writes:          90 GB

A note about HP-UX specific command

The fstyp command allows the user to determine the file system type of a mounted or unmounted file system. You need to pass special a device special file such as /dev/dsk/c1t6d0 and -v option to see information about the file system's superblock.
# fstyp -v /dev/vg02/lvol2
# fstyp -v /dev/dsk/c1t6d0 | more
# df -g /dev/vg02/lvol2

The 'df -g' command the entire structure of the file system.

A note about Solaris Unix to see the file system characteristics

Type the following command:
# fstyp -v /dev/md/dsk/d200
# fstyp -v /dev/md/dsk/d200 | more
# df -g /dev/md/dsk/d200

A note about AIX unix specific command

The lsfs command displays characteristics of file systems, such as mount points, automatic mounts, permissions, and file system size. The FileSystem parameter reports on a specific file system:
# lsfs -q /dev/hd10admin
# lsfs -q / | more

No comments:

Post a Comment