Scrub All Mounted ext Filesystems with e2scrub_all

Running e2scrub by hand against every LVM volume on a big host gets old fast, and e2scrub_all exists to sweep the eligible ones in one pass. You preview, then run it against eligible ext2, ext3 and ext4 filesystems on LVM logical volumes: the command asks e2scrub to check each target, and a damaged filesystem gets marked so that fsck runs before its next mount. Allow about fifteen minutes for a first review, plus the time the actual checks need.

This guide describes the installed e2fsprogs package, version 1.47.0-2.4~exp1ubuntu4.1, whose command reports e2scrub_all version 1.47.0. You need root privileges for every invocation, including the preview. You also need LVM, enough free space for the scrub snapshot, and a maintenance window for real checks.

1. Confirm the installed command

Check the path and package version before relying on examples. These are ordinary inspection commands, so the first two do not need sudo:

$ command -v e2scrub_all
/usr/sbin/e2scrub_all
$ dpkg-query -W -f='${Package} ${Version}\n' e2fsprogs
e2fsprogs 1.47.0-2.4~exp1ubuntu4.1

Ask the command for its version with elevation; the installed script checks for root before processing even the version option:

$ sudo e2scrub_all -V
e2scrub_all 1.47.0 (5-Feb-2023)

Checkpoint: if the version or path differs, stop and reread the local manual page. Option details and diagnostic text vary between e2fsprogs releases.

2. Check the prerequisites without starting a scrub

The normal scan looks for active LVM logical volumes with ext2, ext3 or ext4 filesystems, and a mounted filesystem is included by default. The implementation also needs LVM tools, lsblk, and a volume group with at least 256 MiB of free space for the snapshot. Inspect those facts without changing storage:

$ command -v lvs lsblk lvcreate
/usr/sbin/lvs
/usr/bin/lsblk
/usr/sbin/lvcreate
$ sudo lvs -o lv_path,lv_active,lv_role,vg_free
$ lsblk -o NAME,MOUNTPOINT,FSTYPE,TYPE

Do not infer eligibility from a device name. The filesystem type, LVM status and mount state are what matter: a non-LVM ext4 filesystem sits outside this command's normal target set.

3. Preview the commands

Run the dry run before any real check:

$ sudo e2scrub_all -n
Would execute: systemctl start e2scrub@-srv-data

The exact output is host-specific and may be empty when no eligible logical volume is found. -n prints what would be used to start the scrub, but it is not an unprivileged simulation: the command still needs root to query the host. If systemd is unavailable or cannot start the instance, the normal implementation can fall back to an e2scrub command, so do not treat the preview as a guarantee of the final execution path.

Checkpoint: compare every proposed target with your maintenance plan. A target you did not expect is a reason to stop and investigate its LVM, filesystem and mount details.

4. Run the standard mounted-filesystem check

When the preview is correct and the host has a recovery plan, run:

$ sudo e2scrub_all
$ printf 'e2scrub_all status: %s\n' "$?"
e2scrub_all status: 0

The command starts a check for each eligible mounted target, using a temporary LVM snapshot rather than writing the filesystem being examined directly. If corruption is found, the filesystem is tagged for an fsck before its next mount. When no errors are found and the filesystem is mounted, the manual says fstrim gets called.

A zero status means e2scrub_all completed its dispatch successfully. It is not a substitute for reading the service or system logs, and it does not mean every ext filesystem on the machine was checked. Review the preview output and the relevant e2scrub or systemd logs before closing the maintenance task.

5. Include unmounted filesystems only deliberately

Use -A when you have a specific reason to scrub eligible ext2, ext3 or ext4 logical volumes even when they are not mounted:

$ sudo e2scrub_all -n -A
$ sudo e2scrub_all -A

Preview the exact set with -n -A first. The option broadens the target selection; it does not mean every block device or every filesystem gets checked. Do not add it merely to make an empty default preview produce output.

6. Treat snapshot removal as a separate operation

-r removes leftover e2scrub snapshots without checking filesystems. It changes LVM state and can discard the temporary copy that would otherwise be available for investigation. Do not use it as a routine clean-up command or combine it casually with a scrub.

$ sudo e2scrub_all -n -r
$ sudo e2scrub_all -r

Only proceed after confirming the listed snapshots are abandoned scrub snapshots and that no scrub job is using them. If a check failed, keep the surrounding logs and work out why the snapshot remains before removing it. There is no general undo for removal; recovery depends on the original logical volume, backups and the storage team's procedures.

Common traps

Done means