One wrong device letter and tune2fs can relabel the wrong file system entirely. This guide inspects, changes one thing at a time, and verifies before moving on, covering labels, reserved space and check schedules without guessing at a device or touching a live root file system.
This guide matches e2fsprogs 1.47.0, installed here as package version 1.47.0-2.4~exp1ubuntu4.1. Allow about fifteen minutes, plus time to identify the correct device. You need a shell, an ext2/ext3/ext4 file system, and administrative access for changes. Replace /dev/DEVICE with an exact device name from your machine.
Safety boundary: a typo in a device path can change the wrong file system. Check the device and its mount state before every write, and do not experiment on a valuable file system without a current backup.
Establish which binary and package version you are using first. These are read-only commands and do not need sudo:
$ command -v tune2fs
/usr/sbin/tune2fs
$ tune2fs --help
tune2fs: invalid option -- '-'
Usage: tune2fs [-c max_mounts_count] [-e errors_behavior] [-f] [-g group]
...
tune2fs 1.47.0 (5-Feb-2023)
$ dpkg-query -W -f='${Package} ${Version}\n' e2fsprogs
e2fsprogs 1.47.0-2.4~exp1ubuntu4.1
The installed program does not provide a GNU-style --help option: its usage text is printed alongside the error, followed by the program version. The syntax below follows that output and the local manual page dated February 2023.
Use findmnt to map a mount point to its source, or inspect a known block device. Both stay read-only:
$ findmnt -no SOURCE,FSTYPE,TARGET /var
/dev/DEVICE ext4 /var
$ lsblk -f /dev/DEVICE
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
DEVICE ext4 1.0 DATA 12345678-1234-1234-1234-123456789abc ... ... /var
Your output will differ. Confirm the file system type is ext2, ext3 or ext4, and confirm the mount point belongs to the data you intend to tune. A label or UUID can be used instead of a device path, for example LABEL=DATA or UUID=12345678-1234-1234-1234-123456789abc; an exact UUID is less prone to device-order changes.
Checkpoint: write down the device, file system type and mount point. If they do not match your plan, stop here.
List the current tunable values with -l, a read-only operation:
$ sudo tune2fs -l /dev/DEVICE
tune2fs 1.47.0 (5-Feb-2023)
Filesystem volume name: DATA
Last mounted directory: /var
Filesystem UUID: 12345678-1234-1234-1234-123456789abc
Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent 64bit
Reserved block count: 26214
Reserved block percentage: 5%
Mount count: 12
Maximum mount count: -1
Last checked: ...
Exact fields and values depend on the file system. The useful baseline is the volume name, UUID, features, reserved blocks, mount count and last-check information. Save this output before making a change, it gives you something concrete to compare afterwards.
A label is a practical first change: it makes later commands and /etc/fstab entries easier to read. Setting it requires elevated privileges:
$ sudo tune2fs -L DATA-ARCHIVE /dev/DEVICE
tune2fs 1.47.0 (5-Feb-2023)
Setting filesystem label to DATA-ARCHIVE
$ sudo tune2fs -l /dev/DEVICE | grep -E 'Filesystem volume name|Filesystem UUID'
Filesystem volume name: DATA-ARCHIVE
Filesystem UUID: 12345678-1234-1234-1234-123456789abc
Do not assume the label is unique. Check it with lsblk -f before using LABEL=DATA-ARCHIVE in a mount configuration.
Recovery: set the old label again, or clear it with an empty label, to undo this particular change.
$ sudo tune2fs -L OLD-LABEL /dev/DEVICE
# Or, if the intended result is no label:
$ sudo tune2fs -L '' /dev/DEVICE
On ext2, labels longer than 16 characters are truncated with a warning. Keep labels short and verify what was actually stored.
-m sets the percentage of blocks reserved for privileged processes. The default is normally 5 percent. That reserve can help system services keep writing when an ordinary user has filled the file system, so reducing it removes that emergency margin.
$ sudo tune2fs -m 2 /dev/DEVICE
tune2fs 1.47.0 (5-Feb-2023)
Setting reserved blocks percentage to 2% (was 5%)
$ sudo tune2fs -l /dev/DEVICE | grep -E 'Reserved block (count|percentage)'
Reserved block count: ...
Reserved block percentage: 2%
Use a percentage, not a guess about free space; for a precise block count, -r sets the reserved block count directly. These changes do not create free space, they change who may allocate the reserved blocks. Restore the earlier percentage if monitoring or service behaviour shows the smaller reserve is unsuitable:
$ sudo tune2fs -m 5 /dev/DEVICE
Two independent settings request future checks by e2fsck: -c controls the mount count and -i controls elapsed time. The local manual says mount-count checking is disabled by default, represented by a maximum mount count of 0 or -1. A value of random chooses a value between 20 and 40.
$ sudo tune2fs -c 30 -i 6m /dev/DEVICE
Setting maximal mount count to 30
Setting interval between checks to 15552000 seconds
$ sudo tune2fs -l /dev/DEVICE | grep -E 'Mount count|Maximum mount count|Check interval|Last checked'
Mount count: 12
Maximum mount count: 30
Check interval: 15552000 (6 months)
Last checked: ...
Exact wording may vary. A scheduled check can make a later boot take longer, so choose a maintenance policy deliberately. The manual recommends e2scrub as a better answer to suspected hardware or kernel problems where the file system is on an LVM volume. Do not treat a mount-count threshold as a substitute for backups or monitoring.
To disable either trigger, set its value to zero, having recorded the old values first so you can restore the previous policy:
$ sudo tune2fs -c 0 -i 0 /dev/DEVICE
Several options alter the on-disk format or boot-time behaviour. Treat them as maintenance work, not harmless tuning:
-I changes inode size by rewriting the inode table. Run the required consistency check first, back up the file system, and plan for a long operation; an interruption can corrupt data.-O sets or clears file system features. Some features require a later e2fsck, and newer features may prevent older kernels from mounting the file system.-e panic can cause a kernel panic when errors are detected. Do not use it as a casual diagnostic setting.-E clear_mmp is only safe when you are certain the device is not mounted or being checked. The manual warns that a wrong assumption can cause major corruption.-U changes the UUID used by mounts and file system tools. Update every dependent configuration and recovery procedure before doing this.Warning: removing a journal is especially dangerous. The local manual warns that removing an external journal without replaying it after an unclean unmount can cause severe data loss. Do not add -f merely to force a command through an error.
Re-read the superblock and compare it with the baseline from step 3. For a label change, also check the system's device view:
$ sudo tune2fs -l /dev/DEVICE | grep -E 'Filesystem volume name|Filesystem UUID|Reserved block percentage|Maximum mount count|Check interval'
$ lsblk -f /dev/DEVICE
If a command fails, do not immediately add -f. Check the device, mount state, file system type and exact option spelling instead. For feature or inode changes, follow the program's request to run e2fsck from an appropriate maintenance environment, and keep the original backup until verification and any required check have completed.
lsblk -f where relevant.