$linuxjunkies
>

tune2fs(8)

Adjust tunable file system parameters on ext2, ext3, and ext4 file systems.

UbuntuDebianFedoraArch

Synopsis

tune2fs [options] device

Description

tune2fs allows the system administrator to adjust various tunable parameters on Linux ext2, ext3, and ext4 file systems. Except for the -j and -J options which perform disk I/O, the changes are made to the superblock on the disk. Most tools that read the superblock, including mount, fsck, and dumpe2fs, will notice the changes immediately. Some tools that cache the superblock, like e2compr, may not see the changes until they reread the superblock.

Warning: Modifying file system parameters on a mounted file system can cause file system corruption or data loss. Most changes should be made only when the file system is unmounted or mounted read-only.

Common options

FlagWhat it does
-lList the contents of the file system superblock, including the current values of the parameters that can be set via tune2fs
-jAdd a journal to the file system, converting ext2 to ext3
-J size=journal-sizeSpecify the size of the journal (in megabytes) when creating a new journal
-c max-mount-countSet the number of times the file system may be mounted before a full file system check is forced by e2fsck
-i interval-between-checksAdjust the maximal time between two file system checks (e.g., 2w for 2 weeks, 1m for 1 month)
-m reserved-blocks-percentageSet the percentage of the file system reserved for the super-user; default is 5%
-L volume-labelSet the volume label of the file system
-U UUIDSet the UUID (Universally Unique Identifier) of the file system; use -U random to generate a new UUID
-e errors=behaviorChange the behavior when errors are detected; options are continue, remount-ro, or panic
-O [^]featureSet or clear file system features such as dir_index, filetype, has_journal, sparse_super, large_file
-C mount-countSet the number of times the file system has been mounted; if set to a value greater than max-mount-count, the next mount attempt will cause a full file system check

Examples

Display the current tunable parameters and file system info for /dev/sda1

sudo tune2fs -l /dev/sda1

Add a journal to /dev/sda1, converting it from ext2 to ext3 (must be unmounted)

sudo tune2fs -j /dev/sda1

Set the volume label of /dev/sda1 to 'mydata'

sudo tune2fs -L mydata /dev/sda1

Generate and assign a new random UUID to /dev/sda1

sudo tune2fs -U random /dev/sda1

Reduce reserved blocks from 5% to 1%, freeing up more space for regular users

sudo tune2fs -m 1 /dev/sda1

Disable automatic file system checks based on mount count and time interval

sudo tune2fs -c 0 -i 0 /dev/sda1

Set the file system to remount read-only if an error is detected

sudo tune2fs -e remount-ro /dev/sda1

Enable the has_journal feature on /dev/sda1

sudo tune2fs -O has_journal /dev/sda1

Related commands