The e2undo command in Linux is used to undo the last file system transaction on an ext2, ext3, or ext4 file system. This command can be used to recover from a file system error, such as an unintended deletion or modification. The e2undo command will undo the last transaction that was made by the file system and return it to its previous state.
If you encounter the below error while running the command e2undo:
e2undo: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
Debian | apt-get install e2fsprogs |
Ubuntu | apt-get install e2fsprogs |
Alpine | apk add e2fsprogs |
Arch Linux | pacman -S e2fsprogs |
Kali Linux | apt-get install e2fsprogs |
CentOS | yum install e2fsprogs |
Fedora | dnf install e2fsprogs |
OS X | brew install e2fsprogs |
Raspbian | apt-get install e2fsprogs |
e2undo Command Examples
1. Display information about a specific undo file:
# e2undo -h path/to/undo_file /dev/sdXN
2. Perform a dry-run and display the candidate blocks for replaying:
# e2undo -nv path/to/undo_file /dev/sdXN
3. Perform an undo operation:
# e2undo path/to/undo_file /dev/sdXN
4. Perform an undo operation and display verbose information:
# e2undo -v path/to/undo_file /dev/sdXN
5. 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