Before changing a filesystem setting, check its current value and identify the device that holds it. tune2fs reads and adjusts stored parameters on supported ext filesystems.
I’ll show how to read tune2fs parameters and distinguish an inspection from a metadata change.
TL;DR
tune2fs reads and changes tunable metadata on ext2, ext3, and ext4 filesystems, so identify the right filesystem and inspect it before changing anything.
- Run tune2fs -l DEVICE to list filesystem parameters.
- Use -L for a label, -m for a reserved-block percentage, and -r for a reserved-block count.
- Use -c and -i only after deciding how filesystem checks should be scheduled.
- Run write operations only against a verified target, with a backup and a recovery plan.
What is the tune2fs command?
tune2fs is an e2fsprogs utility for reading or adjusting filesystem parameters on ext2, ext3, and ext4 filesystems. It stores many of those settings in the filesystem superblock, the metadata structure that describes the filesystem.
The device argument identifies the filesystem to inspect or change. It can be a device path such as /dev/sda2, or a label or UUID selector such as LABEL=home or UUID=….
The command does not manage every Linux filesystem. XFS and Btrfs have their own tools. A filesystem has metadata of its own even when mounted inside the same directory tree as other filesystems.
A useful boundary is the difference between reading a superblock and writing one. The -l option lists current values. Options such as -L, -m, and -c change metadata, so a typo in the target or a mistaken setting can affect the filesystem itself.
Treat the listing as a baseline, not a recommendation to change every field. Each value has a separate purpose, and some interact with mount behavior or e2fsck scheduling.
tune2fs [options] DEVICE
Use the device that contains the filesystem, usually a partition or logical volume rather than the whole disk. The manual also accepts LABEL= and UUID= selectors, stable identifiers that can be matched against mount configuration.
How to use tune2fs step by step
Work from identification to inspection, then choose one setting and verify it. This order separates a read-only lookup from a later write and gives you a chance to catch a wrong device first. Keep a note of the original field and intended value so another administrator can review the change.
Step 1: Identify the filesystem device
First find the partition or logical volume that holds the target filesystem. You can check mounted filesystems and their types with findmnt, or inspect identifiers with lsblk -f. Confirm the type is ext2, ext3, or ext4 before using tune2fs.
A mount point tells you where contents appear in the directory tree. It does not identify which metadata-changing option is safe.
lsblk -f
Choose the partition or logical volume shown in the output, not its parent disk by default. A disk such as /dev/sda can contain several partitions, each with a different filesystem. A whole-device target is correct only when that device itself contains the filesystem.
If the output does not make the target clear, check identifiers with blkid first. The LinuxForDevices guide to lsblk and blkid explains how device topology and filesystem metadata complement each other.
Step 2: Read the current parameters
Use -l to list superblock values before choosing a change. It reports the filesystem label, UUID, mount count, maximum mount count, check interval, reserved blocks, and feature flags.
sudo tune2fs -l /dev/sda2
Replace the example path with the device you confirmed in the previous step. The command is a read operation, but it still needs permission to access the block device on many systems. Narrow the output only after you know which field you are checking.
sudo tune2fs -l /dev/sda2 | grep -E 'Filesystem volume name|Filesystem UUID|Mount count|Maximum mount count|Check interval|Reserved block count'
The filtered view is useful for comparison, while the full listing remains a useful baseline for checking a change or investigating an unfamiliar filesystem. Save relevant values before modifying them.
Look at filesystem state and feature fields as well as the requested parameter. Existing error markers are reasons to investigate before applying a routine setting.
Step 3: Set a volume label
A volume label is a human-readable name stored with the filesystem. The -L option sets it, and -l lets you confirm the saved label afterward.
sudo tune2fs -L data /dev/sda2
sudo tune2fs -l /dev/sda2 | grep 'Filesystem volume name'
Choose a label distinct from names already used on the machine, then inspect it with -l after the change. The operation changes only the filesystem’s stored label, so check UUID and mount configuration separately when system startup relies on a label.
Step 4: Adjust reserved blocks with the right unit
The reserved-block pool keeps some filesystem space available to a designated user or group when ordinary users have filled the filesystem. Use -m to set the reserved share as a percentage, or -r to set an absolute number of blocks.
sudo tune2fs -m 2 /dev/sda2
sudo tune2fs -r 10000 /dev/sda2
These commands are alternatives, not a pair to run in sequence. Pick the unit that matches the capacity policy and calculate the effect before writing it. A percentage scales with filesystem size, while a block count stays fixed as the filesystem grows.
Check the resulting count with tune2fs -l. The manual assigns percentage units to -m and absolute blocks to -r, so the same number means a different amount under each option.
Step 5: Understand filesystem check scheduling
The -c option sets a maximum mount count before e2fsck is scheduled to check the filesystem. The -i option sets a time interval between checks, using days, weeks, or months.
These options set check scheduling. Use e2fsck when a filesystem needs to be checked or repaired.
The mount count is a stored counter rather than a health score. Reaching a configured threshold affects when a check is requested, while a kernel-detected error can trigger checking for a separate reason.
sudo tune2fs -c 30 /dev/sda2
sudo tune2fs -i 6m /dev/sda2
sudo tune2fs -l /dev/sda2 | grep -E 'Maximum mount count|Check interval'
The commands above set both limits, so use only the one that matches your maintenance policy. The manual defines zero or minus one for -c as disregarding mount-count checks. Disabling that trigger is a maintenance policy choice and does not improve performance by itself.
Time and mount-count limits are separate triggers. Setting one leaves the other unchanged, and neither change runs e2fsck immediately.
-C differs from -c because it changes the recorded mount count rather than the maximum. If the recorded count exceeds the maximum, e2fsck can check the filesystem at the next boot. Avoid changing -C without a specific reason to adjust that stored counter.
Read the stored maximum and current count together before interpreting them.
What should you check before changing a filesystem?
Check the filesystem type, target device, mount state, and exact option meaning before writing. Feature changes and UUID reassignment are advanced operations because they can affect compatibility or system boot configuration.
| Option | Meaning | Check before using it |
|---|---|---|
| -l | List current parameters | Confirm you are inspecting the intended filesystem |
| -L | Set the volume label | Avoid duplicate or confusing labels |
| -m | Set reserved blocks as a percentage | Estimate the space retained |
| -r | Set reserved blocks as an absolute count | Know the filesystem block units |
| -c | Set maximum mount count for checks | Understand the maintenance policy |
| -i | Set the time between checks | Use a supported interval and unit |
Use a backup and recovery plan before changing filesystem metadata. Feature options such as -O can enable or disable filesystem capabilities. These changes are not interchangeable with setting a label or reading values.
Verify feature requirements in the e2fsprogs manual and filesystem documentation first. A feature may require specific kernel or userspace support. Some transitions have prerequisites or cannot be reversed by removing a flag.
For changes that require an unmounted filesystem, schedule downtime or use a suitable rescue environment. A mounted read-only filesystem still counts as mounted. Support depends on the option and filesystem state, so check the manual for the specific change.
A remote root filesystem needs extra planning because lost access can prevent correction. Console access or a rescue environment may be needed for boot or feature changes.
A superblock default can also interact with mount configuration. An entry in /etc/fstab may specify a mount option that takes precedence over a default stored in the filesystem. If active behavior differs from the value shown by tune2fs, inspect mount configuration and currently applied options instead of repeatedly changing the superblock.
tune2fs writes a filesystem default, while fstab describes how a system mounts a filesystem. A command-line mount option can override a stored default for that mount.
Finally, tune2fs exposes status fields and adjusts selected metadata, while e2fsck checks and repairs supported ext filesystems under its own operating conditions. Run a repair against a mounted filesystem only when the tool documentation explicitly permits that mode.
The LinuxForDevices fsck guide covers its separate check-and-repair workflow and unmounted-filesystem precautions. If tune2fs reports errors, preserve the output and plan the appropriate check rather than clearing error indicators blindly.
The word “mount” appears in several option names, but the options do not all describe the same value. The maximum mount count set by -c is a threshold. The mount count set by -C is the recorded counter.
The currently mounted state is separate again. Checking those fields together helps explain why a configured check may be due even though the filesystem is mounted now.
Check intervals also have a specific syntax. The manual accepts a number followed by a day, week, or month suffix. Confirm the accepted unit on the installed version before saving a policy, especially when a script supplies the value.
A zero interval disables time-based scheduling, while mount-count and error-triggered checks follow their own rules.
Reserved space affects capacity reported to ordinary users. Its purpose is to leave room for privileged system work when a filesystem is nearly full.
Reducing it makes more blocks available to regular users, but removes that buffer. The amount depends on filesystem size, workload, and recovery requirements, so choose a value for the actual system.
A label is descriptive, while a UUID identifies a filesystem for configuration. Changing a label with -L leaves the UUID unchanged. Changing a UUID with -U is a separate operation that can require updates to fstab, boot settings, or other references.
Identifier changes need a check of every consumer alongside a tune2fs readback. UUID replacement therefore belongs in a planned maintenance task rather than an example label change.
When a command reports that it cannot find a valid filesystem superblock, first confirm the selected device is the filesystem-bearing partition and that its type is supported. Forcing the operation or switching partitions at random can target a partition table, an empty partition, or a filesystem managed by a different utility.
When a command says the filesystem is mounted or busy, treat that as a state warning rather than a prompt to force it. Read-only listing and metadata changes have different requirements. Consult the option-specific manual entry, determine which process or mount is involved, and arrange a maintenance window if an unmounted state is required.
The examples show command syntax without invented output. Check the installed utility’s manual and help text for its supported flags. Before applying a write command, replace the sample device with the one you identified and reviewed.
Conclusion: inspect before changing
tune2fs is useful when you know which ext filesystem you are targeting and understand whether an option reads or changes its superblock. Start with -l, choose one change with the correct units, then read the value back.
For the full option list and warnings, consult the tune2fs manual page. To identify a target, see the LinuxForDevices guide to lsblk and blkid. Its guide to mounting USB drives explains device and mount-point roles.
The filesystem hierarchy guide explains where mounted filesystems appear. For checking damage, read the fsck command guide. The Arch installation guide shows where fstab fits into mounting.
FAQ
These answers clarify the filesystem scope and the main safety questions.
Can tune2fs inspect a mounted filesystem?
The -l option reads filesystem parameters and is commonly used for inspection. Write operations depend on the option and filesystem state, so check the tune2fs manual before changing a mounted filesystem.
What is the difference between tune2fs -m and -r?
The -m option sets reserved blocks as a percentage. The -r option sets an absolute reserved-block count.
Does tune2fs repair filesystem corruption?
No. tune2fs reads or adjusts selected filesystem parameters. e2fsck is the filesystem check and repair utility for supported ext filesystems, subject to its operating requirements.
Which filesystems does tune2fs support?
The tune2fs manual documents ext2, ext3, and ext4 filesystems. XFS and Btrfs use different filesystem tools.
