tune2fs — quick reference
Inspect the superblock
Read current tunables from the filesystem superblock. Safe on a mounted root when you only use -l.
| When to use | Command |
|---|---|
| List superblock fields (label, UUID, mount counts, features, reserved blocks) | sudo tune2fs -l /dev/mapper/ubuntu--vg-ubuntu--lv |
| Show only the volume label | sudo tune2fs -l DEVICE | grep 'volume name' |
| Show mount-count and check-interval fields | sudo tune2fs -l DEVICE | grep -Ei 'mount count|check interval|last checked' |
Filesystem check scheduling
Control when e2fsck runs at boot. On modern ext4 with journaling, many sites disable periodic checks and rely on monitoring instead.
| When to use | Command |
|---|---|
Set maximum mounts before forced fsck (-1 disables mount-count checks) |
sudo tune2fs -c 30 DEVICE |
| Pick a random max mount count between 20 and 40 | sudo tune2fs -c random DEVICE |
| Disable mount-count-based fsck | sudo tune2fs -c -1 DEVICE |
Set the recorded mount count (triggers fsck if above -c value) |
sudo tune2fs -C 5 DEVICE |
Set maximum days/weeks/months between checks (2w, 6m, 90d) |
sudo tune2fs -i 2w DEVICE |
Disable time-based fsck (-i 0; -i -1 errors on Ubuntu 25.04) |
sudo tune2fs -i 0 DEVICE |
| Stamp last-checked time to now (snapshots / maintenance scripts) | sudo tune2fs -T now DEVICE |
Set last-checked time explicitly (YYYYMMDD or YYYYMMDDhhmmss) |
sudo tune2fs -T 202607011200 DEVICE |
Labels, mount metadata, and UUID
| When to use | Command |
|---|---|
| Set a volume label (max 16 characters on ext4) | sudo tune2fs -L mydata DEVICE |
| Record the last mount point path in the superblock | sudo tune2fs -M /mnt/data DEVICE |
| Assign a specific UUID string | sudo tune2fs -U c1b9d5a2-f162-11cf-9ece-0020afc76f16 DEVICE |
| Generate a new random UUID (device must be unmounted) | sudo tune2fs -U random DEVICE |
| Generate a time-based UUID | sudo tune2fs -U time DEVICE |
| Clear the filesystem UUID | sudo tune2fs -U clear DEVICE |
Error handling and extended options
| When to use | Command |
|---|---|
| Continue after detected errors (default on many systems) | sudo tune2fs -e continue DEVICE |
| Remount read-only when the kernel sees errors | sudo tune2fs -e remount-ro DEVICE |
| Panic the kernel on filesystem errors | sudo tune2fs -e panic DEVICE |
| Flag the filesystem so fsck runs at next mount | sudo tune2fs -E force_fsck DEVICE |
| Set RAID stride width in filesystem blocks | sudo tune2fs -E stride=16 DEVICE |
| Set RAID stripe width in filesystem blocks | sudo tune2fs -E stripe_width=32 DEVICE |
| Force past errors (needed twice when replaying an external journal) | sudo tune2fs -f DEVICE |
Reserved blocks
Root keeps a pool of blocks for daemons when the disk fills up. Default is often 5% on ext4.
| When to use | Command |
|---|---|
| Set reserved space as a percentage | sudo tune2fs -m 5 DEVICE |
| Set an absolute reserved block count | sudo tune2fs -r 1000 DEVICE |
| Set which user may use reserved blocks (name or UID) | sudo tune2fs -u root DEVICE |
| Set which group may use reserved blocks (name or GID) | sudo tune2fs -g 0 DEVICE |
Default mount options
Store default mount flags in the superblock (honoured by ext4 on 2.6.35+ kernels). Use ^ to clear an option.
| When to use | Command |
|---|---|
| Add default mount options | sudo tune2fs -o user_xattr,acl DEVICE |
| Clear a default mount option | sudo tune2fs -o ^acl DEVICE |
Journaling and features
Destructive on live data — run only on an unmounted device or a disposable test image. Back up first.
| When to use | Command |
|---|---|
| Add an ext3 journal to an ext2 filesystem | sudo tune2fs -j DEVICE |
| Override journal size or external journal device | sudo tune2fs -J size=128 DEVICE |
Enable an ext4 feature (example: dir_index) |
sudo tune2fs -O dir_index DEVICE |
| Clear a feature (caret prefix) | sudo tune2fs -O ^sparse_super DEVICE |
| Grow inode size to 256 bytes (requires e2fsck first) | sudo tune2fs -I 256 DEVICE |
Quota inodes
| When to use | Command |
|---|---|
| Enable user quota feature and quota inode | sudo tune2fs -Q usrquota DEVICE |
| Enable group quota inode | sudo tune2fs -Q grpquota DEVICE |
| Enable project quota inode | sudo tune2fs -Q prjquota DEVICE |
| Clear user quota feature | sudo tune2fs -Q ^usrquota DEVICE |
Undo log
| When to use | Command |
|---|---|
Write block changes to an undo file (restore with e2undo) |
sudo tune2fs -z /path/to/undo.e2undo DEVICE |
| Clear undo file setting | sudo tune2fs -z "" DEVICE |
tune2fs — command syntax
Synopsis from tune2fs usage text on Ubuntu 25.04 (tune2fs 1.47.2):
tune2fs [-c max_mounts_count] [-e errors_behavior] [-f] [-g group]
[-i interval[d|m|w]] [-j] [-J journal_options] [-l]
[-m reserved_blocks_percent] [-o [^]mount_options[,...]]
[-r reserved_blocks_count] [-u user] [-C mount_count]
[-L volume_label] [-M last_mounted_dir]
[-O [^]feature[,...]] [-Q quota_options]
[-E extended-option[,...]] [-T last_check_time] [-U UUID]
[-I new_inode_size] [-z undo_file] devicedevice can be /dev/sda1, LABEL=name, or UUID=uuid. Most write operations need the filesystem unmounted; -l is the usual safe read on a mounted volume. Requires sudo.
tune2fs — command examples
Essential List superblock — read-only on a live LVM root
Before changing anything, read the superblock. On Ubuntu 25.04 this works read-only on the mounted root logical volume.
Run the command:
sudo tune2fs -l /dev/mapper/ubuntu--vg-ubuntu--lvSample output (trimmed):
tune2fs 1.47.2 (1-Jan-2025)
Filesystem volume name: <none>
Last mounted on: /
Filesystem UUID: 72457fae-1731-4c94-b5c1-ac4564f4311c
Filesystem state: clean
Errors behavior: Continue
Mount count: 13
Maximum mount count: -1
Last checked: Mon Oct 6 10:35:36 2025
Check interval: 0 (<none>)
Reserved block count: 672747Check mount-count and interval fields when planning fsck policy:
sudo tune2fs -l /dev/mapper/ubuntu--vg-ubuntu--lv | grep -Ei 'mount count|check interval|last checked'Sample output:
Mount count: 13
Maximum mount count: -1
Last checked: Mon Oct 6 10:35:36 2025
Check interval: 0 (<none>)A max mount count of -1 and check interval 0 mean neither mount-count nor time rules force e2fsck at boot.
Common Set a volume label on a loop ext4 test image
Use a loop-backed ext4 image in /tmp for write tests — never leave it mounted after you finish.
Create and attach a test image:
sudo dd if=/dev/zero of=/tmp/tune2fs-test.img bs=1M count=64 status=none
sudo mkfs.ext4 -F -L origlabel /tmp/tune2fs-test.img
LOOP=$(sudo losetup -f --show /tmp/tune2fs-test.img)Set a new label:
sudo tune2fs -L testlabel "$LOOP"Sample output:
tune2fs 1.47.2 (1-Jan-2025)Verify and clean up:
sudo tune2fs -l "$LOOP" | grep 'volume name'
sudo tune2fs -L origlabel "$LOOP"
sudo losetup -d "$LOOP"
sudo rm -f /tmp/tune2fs-test.imgSample verification line:
Filesystem volume name: testlabelRestore the original label and remove the loop device so the host is unchanged.
Common Schedule and disable periodic e2fsck checks
On a test loop device, set mount-count and time limits, then turn them off again.
sudo tune2fs -c 30 "$LOOP"
sudo tune2fs -C 5 "$LOOP"
sudo tune2fs -i 2w "$LOOP"Sample output:
tune2fs 1.47.2 (1-Jan-2025)
Setting maximal mount count to 30
Setting current mount count to 5
Setting interval between checks to 1209600 secondsConfirm:
sudo tune2fs -l "$LOOP" | grep -E 'Mount count|Maximum mount|Check interval'Sample output:
Mount count: 5
Maximum mount count: 30
Check interval: 1209600 (2 weeks)Disable both policies before cleanup:
sudo tune2fs -c -1 "$LOOP"
sudo tune2fs -i 0 "$LOOP"On Ubuntu 25.04, tune2fs -i -1 prints interval between checks is too big — use -i 0 instead.
Common Tune reserved block pool for root-only emergency space
Adjust how much space only privileged users can allocate when the disk is nearly full.
sudo tune2fs -m 5 "$LOOP"
sudo tune2fs -r 1000 "$LOOP"Sample output:
tune2fs 1.47.2 (1-Jan-2025)
Setting reserved blocks percentage to 5% (819 blocks)
Setting reserved blocks count to 1000Check the result:
sudo tune2fs -l "$LOOP" | grep -E 'Reserved block'Sample output:
Reserved block count: 1000
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)Advanced Rotate UUID on an unmounted test filesystem
UUID changes apply only when the filesystem is not mounted. Use a loop image, not production /.
sudo tune2fs -U random "$LOOP"Sample output:
tune2fs 1.47.2 (1-Jan-2025)Read the new value:
sudo tune2fs -l "$LOOP" | grep 'Filesystem UUID'Update /etc/fstab if it references the old UUID before mounting this device on a real system.
Advanced Add a journal to ext2 (offline conversion)
tune2fs -j upgrades ext2 to ext3 by creating a journal inode. Test on a throwaway image first.
sudo dd if=/dev/zero of=/tmp/tune2fs-ext2.img bs=1M count=64 status=none
sudo mkfs.ext2 -F -q /tmp/tune2fs-ext2.img
LOOP2=$(sudo losetup -f --show /tmp/tune2fs-ext2.img)
sudo tune2fs -j "$LOOP2"Sample output:
tune2fs 1.47.2 (1-Jan-2025)
Creating journal inode: doneConfirm the feature flag:
sudo tune2fs -l "$LOOP2" | grep 'Filesystem features'Sample output:
Filesystem features: has_journal ext_attr resize_inode dir_index filetype sparse_super large_fileClean up:
sudo losetup -d "$LOOP2"
sudo rm -f /tmp/tune2fs-ext2.imgNever run -j or -O feature changes on a mounted production filesystem without a verified backup.
Advanced Mark filesystem for fsck on next mount
-E force_fsck sets the error flag so e2fsck runs at the next mount — useful after snapshot consistency checks.
sudo tune2fs -E force_fsck "$LOOP"Sample output:
tune2fs 1.47.2 (1-Jan-2025)
Setting filesystem error flag to force fsck.State changes from clean to clean with errors until e2fsck clears it:
sudo tune2fs -l "$LOOP" | grep 'Filesystem state'Sample output:
Filesystem state: clean with errorsAdvanced Capture an undo log before risky tune2fs writes
Pair -z with e2undo when you need a rollback path. The undo file does not survive power loss.
sudo tune2fs -z /tmp/tune2fs-undo.e2undo -L ztest "$LOOP"Sample output:
tune2fs 1.47.2 (1-Jan-2025)
Overwriting existing filesystem; this can be undone using the command:
e2undo /tmp/tune2fs-undo.e2undo /dev/loopNList the undo file, then remove it during cleanup:
ls -la /tmp/tune2fs-undo.e2undo
sudo rm -f /tmp/tune2fs-undo.e2undotune2fs — when to use / when not
Choose tune2fs when you need to read or change ext-family superblock tunables. Use another tool when the task is formatting, repair, or non-ext filesystems.
| Use tune2fs when | Use something else when |
|---|---|
|
|
tune2fs vs dumpe2fs
Both read superblock data; only tune2fs writes tunables.
| tune2fs | dumpe2fs | |
|---|---|---|
| Primary role | Read and change tunable parameters | Dump superblock and block-group metadata |
| Writes superblock | Yes (most flags except -l) |
No |
| Best for | Labels, UUID, fsck policy, reserved blocks | Deep inspection, debugging layout |
| Mounted root | -l is usually safe read-only |
Read-only dump |
See the dumpe2fs command when you need more detail than tune2fs -l provides.
Related commands
Filesystem creation, inspection, and repair around ext volumes.
| Command | One line |
|---|---|
| tune2fs | Tune ext superblock parameters (this page) |
| mount | Mount by UUID, LABEL, or device path |
Browse the full index in our Linux commands reference.
tune2fs — interview corner
What does tune2fs do on Linux?
tune2fs adjusts tunable parameters stored in the superblock of ext2, ext3, and ext4 filesystems. It does not format disks — mke2fs does that — and it is not a full repair tool like e2fsck.
Common tasks:
- Read metadata with
tune2fs -l DEVICE(label, UUID, mount counts, features) - Set volume labels (
-L), UUIDs (-U), and fsck schedules (-c,-i,-T) - Change reserved block pools (
-m,-r) and default mount options (-o) - Enable features such as journals (
-j) or ext4 flags (-O) on an unmounted device
Most writes need root and an unmounted filesystem; -l on a mounted ext4 root is the everyday safe read.
A strong answer is:
"tune2fs reads and changes ext superblock tunables — labels, UUIDs, fsck scheduling, reserved blocks, and feature flags. I use tune2fs -l for inspection and only run write flags on unmounted filesystems or test images."
How do you disable periodic e2fsck on ext4?
Two superblock counters drive automatic checks:
| Field | Disable with |
|---|---|
| Maximum mount count | sudo tune2fs -c -1 DEVICE |
| Check interval (time) | sudo tune2fs -i 0 DEVICE |
Verify:
sudo tune2fs -l DEVICE | grep -Ei 'maximum mount|check interval'Sample lines when disabled:
Maximum mount count: -1
Check interval: 0 (<none>)On Ubuntu 25.04, tune2fs -i -1 fails — use -i 0. Journaled ext4 systems often disable both counters and rely on monitoring plus manual e2fsck after unclean shutdown.
A strong answer is:
"I set maximal mount count to -1 with tune2fs -c -1 and disable the time interval with tune2fs -i 0, then confirm with tune2fs -l. On Ubuntu I avoid -i -1 because it errors on e2fsprogs 1.47.2."
When can you change a filesystem UUID with tune2fs?
The filesystem must be unmounted. Changing the UUID of a mounted volume corrupts in-flight metadata.
sudo tune2fs -U random /dev/sdXNAccepted -U values: a hex UUID string, random, time, or clear.
After a change, update /etc/fstab, systemd mount units, and LVM references that used the old UUID. blkid shows the current value.
A strong answer is:
"UUID changes require an unmounted ext filesystem. I use tune2fs -U random or a explicit UUID, then update fstab and verify with blkid before mounting."
What is the difference between tune2fs and dumpe2fs?
tune2fs is for reading (-l) and writing tunable superblock fields. dumpe2fs dumps richer layout detail — block groups, bitmaps, inode tables — and never modifies the disk.
Use tune2fs -l for a quick admin summary (label, counts, features). Use dumpe2fs when debugging allocation or comparing block-group layout.
A strong answer is:
"tune2fs -l is the quick tunables view and can change settings; dumpe2fs is a read-only deep dump of superblock and block groups for forensic or layout analysis."
Why does ext4 reserve blocks for root?
By default ext4 reserves about 5% of blocks so root (and sometimes a reserved group) can still write when the disk is full — syslog, package managers, and rescue shells keep working.
tune2fs -m sets the percentage; tune2fs -r sets an absolute block count. On large data volumes admins sometimes lower the percentage; on small root volumes keeping reserve space is safer.
A strong answer is:
"Reserved blocks let root write when the filesystem is full so the system stays manageable. tune2fs -m changes the percentage; I lower it only on dedicated data volumes after checking operational impact."
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Couldn't find valid filesystem superblock |
Wrong device, wiped disk, or non-ext FS | Confirm type with blkid or file -s DEVICE; use the correct tool for XFS/Btrfs |
Filesystem is mounted / busy device |
Write attempted on mounted FS | Unmount, or use -l only for reads on live systems |
interval between checks is too big with -i -1 |
e2fsprogs 1.47.2 rejects -1 for interval |
Use sudo tune2fs -i 0 DEVICE to disable time-based checks |
Could not find program / permission errors |
Missing sudo | Prefix with sudo or run as root |
UUID already in use |
Duplicate UUID on another volume | Pick a unique UUID with -U random and update fstab |
| Feature change requests e2fsck | -O, -j, or -I altered metadata layout |
Run sudo e2fsck -f DEVICE before mounting |
tune2fs: invalid option |
Typo or wrong e2fsprogs build | Compare with usage text from tune2fs (invalid flag prints synopsis on 1.47.2) |
