tune2fs: command not found

The tune2fs command helps you configure various “tunable” parameters associated with an ext2/3/4 file system. Tunable parameters enable you to remove reserved blocks, alter reserved block count, specify the number of mounts between checks, specify the time interval between checks, and more.

You can also use tune2fs to add a journal to an existing ext2 or ext3 file system (neither of which include journaling by default). If the file system is already mounted, the journal will be visible in the root directory of the file system. If the file system is not
mounted, the journal will be hidden.

Syntax

The syntax of the tune2fs command is:

# tune2fs [options] {device/ file system name}

tune2fs COMMAND OPTIONS

The tune2fs command has various options.

Option Description
-j Add an ext3 journal to the existing file system.
-i {d|m|w} Specify the maximum time interval between file system checks in days, months, or weeks.
-c {maximum mounts count} Specify the maximum number of mounts between file system checks.
-C {mount count} Specify the number of times the file system can be mounted.
-r {reserved blocks count} Specify the number of reserved file system blocks.
-e {continue|remount-ro|panic} Specify the behavior of the kernel code, whether the file system should continue with normal execution, remount the file system in read-only mode, or cause a kernel panic, when errors are detected.
-l List the contents within the superblock (metadata) of the file system.
-U {UUID} Set the specified UUID for the file system.

If you encounter the below error while running the tune2fs command:

tune2fs: command not found

you may install below package as per your choice of distribution:

Distribution Command
OS X brew install e2fsprogs
Debian apt-get install e2fsprogs
Ubuntu apt-get install e2fsprogs
Alpine apk add e2fsprogs
Arch Linux pacman -S e2fsprogs
Kali Linux apt-get install e2fsprogs
CentOS yum install e2fsprogs
Fedora dnf install e2fsprogs
Raspbian apt-get install e2fsprogs

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

5. List the contents of the superblock on /dev/sda1:

# tune2fs -l /dev/sda1

6. Turn off the maximum mount count and check interval tests on /dev/sda1:

# tune2fs -i 0 -c 0 /dev/sda1
Related Post