e2undo
Undo changes to an ext4 filesystem
TLDR
Display information about a specific undo file
Perform a dry-run and display the candidate blocks for replaying
Perform an undo operation
Perform an undo operation and display [v]erbose information
Write the old contents of the block to an undo file before overwriting a file system block
SYNOPSIS
e2undo [-f] [-n] [-v] [-z undo_nblocks] device backup-file
PARAMETERS
-f, --force
Force overwrite even if filesystem errors detected
-n, --noaction
Dry-run: open read-only, print actions without changes
-v, --verbose
Enable detailed output of restoration steps
-z undo_nblocks
Specify number of undo blocks for partial restore
--help
Display usage summary
--version
Print program version
device
Path to block device or image file
backup-file
Path to .e2backup or .e2undo file
DESCRIPTION
e2undo is a specialized tool from the e2fsprogs package for ext2/ext3/ext4 filesystems. It reverts modifications to filesystem metadata—such as superblocks, inode tables, block group descriptors, and bitmaps—made by e2fsck or tune2fs, using backup files those tools create automatically.
During non-dry-run operations, e2fsck saves backups named like NNNNN.e2backup (where NNNNN is a sequential number) in /var/lib/e2undo/, keyed to the device. tune2fs does similarly for superblock changes. e2undo reads these to precisely restore the prior state, avoiding data loss from erroneous repairs or tweaks.
Ideal for undoing aggressive e2fsck fixes on delicate systems or mistaken tune2fs options. It supports selective restoration via undo blocks and verbose logging. Run as root; preview with -n to verify safety before applying.
CAVEATS
Risk of filesystem corruption if wrong backup used; always test with -n. Requires root. Backups expire or rotate; verify timestamps.
Does not handle journaled changes post-backup.
BACKUP NAMING
Files like /var/lib/e2undo/12345.e2backup or /dev/sda1.e2undo; use e2fsck -n to generate previews.
EXAMPLE
e2undo -n /dev/sda1 /var/lib/e2undo/12345.e2backup
Preview, then omit -n to apply.
HISTORY
Added in e2fsprogs 1.41 (Feb 2008) by Theodore Ts'o to enable safe rollback of online fsck/tune2fs ops, evolving from earlier debugfs internals.


