recover deleted files on ext4

So I just happened to delete two files by accident. So here's a quick and dirty way to recover them.

Please note: Deleted files may be over-written at any point in time by your OS. So typically you have to immediately unmount the disk. (or pull the plug if its on '/' and start forensics distro) for minimizing risk of data-loss.

However I felt lucky and just did this:

sudo apt-get install extundelete
sudo extundelete --restore-file /home/user/theFile.txt /dev/sda1

One file could be restored, the other one not. I guess I was lucky.

written by uniq on 2017-03-13