Use this when using or repairing ext4 file systems.
ext4 · Linux Storage
ext4 is the long-standing default Linux journaling file system: stable, fast to check and able to grow and shrink offline. It supports volumes up to 1 EiB and files up to 16 TiB.
1. ext4: reliable default.
2. Fixed inodes.
3. Online grow, offline shrink.
4. Reserved blocks 5 % (adjust for data disks).
5. Periodic checks configurable.
files → ext4 → block device
Context & applicabilityCommon mistakes · platform/version boundaries
- Running out of inodes on file systems with many small files (set
-ior-Nat creation). - Forgetting
-rwithlvextend, then runningresize2fson the wrong device. - Skipping
e2fsck -fbefore an offline shrink. - Disabling the journal for speed on important data.
Operational reference
Fast context before you go deeper.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- ext4 can grow online and shrink offline.
- Reserved blocks (5 %) are for root.
- Inode count is fixed at creation.
tune2fs -l /dev/<dev> | grep -E 'state|Mount count|Reserved block'— ext4 infoe2fsck -fn /dev/<dev>— check (unmounted)resize2fs /dev/<dev>— grow
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
ext4 on Linux servers: good defaults, online grow, offline shrink, mature repair tools.
mkfs.ext4 -L app -E stride=64,stripe_width=256 /dev/md0 # 256 KiB chunk, 4 data disks, 4 KiB blocks
tune2fs -o journal_data_writeback /dev/X # change default journal mode (with care)
tune2fs -c 0 -i 0 /dev/X # disable periodic forced fsck
dumpe2fs -h /dev/X | grep -iE 'state|errors|features'
errors=remount-ro (default on many distributions) makes the filesystem read-only on metadata errors to prevent further damage — investigate with dmesg before remounting.
Tuning and limits
| Item | Value |
|---|---|
| Max volume / file | 1 EiB / 16 TiB (4K blocks) |
| Reserved blocks | 5 % by default — tune2fs -m 1 /dev/sdb1 on data volumes |
| Journal modes | data=ordered (default), writeback, journal |
| Online resize | Grow yes; shrink only offline |
ReferenceConfiguration & state1 section · depth on demand
Commands
mkfs.ext4 -L data /dev/sdb1
tune2fs -l /dev/sdb1 | grep -E 'Block count|Reserved|Mount count'
tune2fs -m 1 /dev/sdb1 # reserved blocks 1 % instead of 5 % on data disks
resize2fs /dev/vg/lv # grow (online) or shrink (offline)
e2fsck -f /dev/sdb1 # unmounted only
Documented example, not captured output. ext4 can shrink (unlike XFS); maximum file system 1 EiB, file 16 TiB. Running out of inodes (df -i) is possible with many small files.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Linux Storage → ext4. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.kernel.org/block/index.html · confidence 94%