tune2fs(8)
Adjust tunable file system parameters on ext2, ext3, and ext4 file systems.
Synopsis
tune2fs [options] deviceDescription
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
| Flag | What it does |
|---|---|
-l | List the contents of the file system superblock, including the current values of the parameters that can be set via tune2fs |
-j | Add a journal to the file system, converting ext2 to ext3 |
-J size=journal-size | Specify the size of the journal (in megabytes) when creating a new journal |
-c max-mount-count | Set the number of times the file system may be mounted before a full file system check is forced by e2fsck |
-i interval-between-checks | Adjust the maximal time between two file system checks (e.g., 2w for 2 weeks, 1m for 1 month) |
-m reserved-blocks-percentage | Set the percentage of the file system reserved for the super-user; default is 5% |
-L volume-label | Set the volume label of the file system |
-U UUID | Set the UUID (Universally Unique Identifier) of the file system; use -U random to generate a new UUID |
-e errors=behavior | Change the behavior when errors are detected; options are continue, remount-ro, or panic |
-O [^]feature | Set or clear file system features such as dir_index, filetype, has_journal, sparse_super, large_file |
-C mount-count | Set 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/sda1Add a journal to /dev/sda1, converting it from ext2 to ext3 (must be unmounted)
sudo tune2fs -j /dev/sda1Set the volume label of /dev/sda1 to 'mydata'
sudo tune2fs -L mydata /dev/sda1Generate and assign a new random UUID to /dev/sda1
sudo tune2fs -U random /dev/sda1Reduce reserved blocks from 5% to 1%, freeing up more space for regular users
sudo tune2fs -m 1 /dev/sda1Disable automatic file system checks based on mount count and time interval
sudo tune2fs -c 0 -i 0 /dev/sda1Set the file system to remount read-only if an error is detected
sudo tune2fs -e remount-ro /dev/sda1Enable the has_journal feature on /dev/sda1
sudo tune2fs -O has_journal /dev/sda1