• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

tune2fs Command Examples in Linux

by Deepika

tune2fs is a command-line utility used for adjusting the parameters of an ext2, ext3, or ext4 filesystem. These are the file systems commonly used in Linux distributions. This tool allows users to modify various parameters of the file system, such as the maximum number of files that can be stored, the maximum size of files, and the interval for performing periodic file system checks.

Using tune2fs, users can adjust the file system parameters while the file system is still mounted. This can be useful in situations where it is not feasible to unmount the file system, such as when the file system is being used by a critical application or when it is the root file system.

Some of the parameters that can be modified using tune2fs include the following:

  • Reserved Block Percentage: This parameter specifies the percentage of disk space reserved for the root user. By default, 5% of the disk space is reserved for the root user. However, this can be changed using tune2fs.
  • Maximum Number of Inodes: Inodes are data structures used by the file system to store information about files and directories. By default, the ext file systems reserve one inode for every 16KB of disk space. Using tune2fs, users can adjust this value to meet their needs.
  • Maximum File Size: This parameter specifies the maximum size of a file that can be stored on the file system. By default, ext file systems support files up to 16 TB in size. However, this value can be changed using tune2fs.

tune2fs Command Examples

1. Set the max number of counts before a filesystem is checked to 2:

# tune2fs -c 2 /dev/sdXN

2. Set the filesystem label to MY_LABEL:

# tune2fs -L 'MY_LABEL' /dev/sdXN

3. Enable discard and user-specified extended attributes for a filesystem:

# tune2fs -o discard,user_xattr /dev/sdXN

4. Enable journaling for a filesystem:

# tune2fs -o^nobarrier /dev/sdXN

Summary

In summary, tune2fs is a powerful command-line tool that allows users to adjust various parameters of an ext2, ext3, or ext4 file system. The tool is highly customizable and can be used on mounted file systems. It is an essential tool for Linux system administrators and can be used to optimize file system performance and improve the overall stability of the system.

Filed Under: Linux

Some more articles you might also be interested in …

  1. whoami: command not found
  2. How to enable/disable SELinux Modes in RHEL/CentOS
  3. gnome-extension Command Examples in Linux
  4. a2dismod: command not found
  5. How to kill Processes in Linux using kill, killall and pkill
  6. wg Command Examples in Linux
  7. base32 Command Examples (Encode or decode file or standard input to/from Base32, to standard output)
  8. Difference between soft links and hard links in Linux
  9. How to use tar command under Linux
  10. ctest: CMake test driver program

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright