LinuxCommandLibrary

e2undo

Undo changes to an ext4 filesystem

TLDR

Display information about a specific undo file

$ e2undo -h [path/to/undo_file] [/dev/sdXN]
copy

Perform a dry-run and display the candidate blocks for replaying
$ e2undo -nv [path/to/undo_file] [/dev/sdXN]
copy

Perform an undo operation
$ e2undo [path/to/undo_file] [/dev/sdXN]
copy

Perform an undo operation and display verbose information
$ e2undo -v [path/to/undo_file] [/dev/sdXN]
copy

Write the old contents of the block to an undo file before overwriting a file system block
$ e2undo -z [path/to/file.e2undo] [path/to/undo_file] [/dev/sdXN]
copy

SYNOPSIS

e2undo [-d debug_flags] [-l logfile] filesystem

PARAMETERS

-d debug_flags
    Enable debugging output. `debug_flags` is a hexadecimal number.

-l logfile
    Specify the undo log file to use. If not specified, e2undo looks for a file named `undo` in the same directory as the filesystem.

filesystem
    The filesystem to undo changes on.

DESCRIPTION

The e2undo command allows you to undo changes made to an ext2, ext3, or ext4 filesystem. It utilizes an undo log file, which contains a record of modifications performed by certain filesystem operations. This is crucial for recovering from accidental or erroneous operations that could corrupt the filesystem.
This tool is particularly useful when dealing with sensitive operations such as resizing or defragmentation, where errors can lead to significant data loss. By applying the undo log, e2undo reverts the filesystem to its state before the problematic operation. e2undo significantly improves data safety by providing a mechanism to revert unwanted or problematic changes.
Important: The undo log must be available and consistent with the current filesystem state for e2undo to function correctly. Without a valid undo log, recovery is impossible using this tool.

CAVEATS

The undo log must be consistent with the current filesystem state. Inconsistent undo logs can lead to further filesystem corruption. This tool requires root privileges. If the undo log has been partially applied, e2undo might not function correctly.

WHEN TO USE

Use e2undo immediately after an operation such as resize2fs fails or corrupts the filesystem. Do not mount the filesystem in write mode before running e2undo, or the undo log might become invalid.

SEE ALSO

debugfs(8), resize2fs(8), e2fsck(8)

Copied to clipboard