In the rush before Thanksgiving, I rsync'd my desktop to laptop backwards. Which deleted all files on my desktop's personal directory that were new since the last sync. (using rsync -d delete, so that renames aren't duplicated; but finger error, i was pushing not pulling, using wrong alias command, oops argh).
I did manage to grab the whole scrollback in laptop terminal listing all the deleted files, good.
(Looked to have a lot of things that were previously merged with hardlink(8) to save space! Unexpected as the push rsync did have -H to preserve hardlinks?.)
Desktop /home is formatted ext4, a journalling filesystem, so this should be easy, right ? It's not quite as sparkly-shiny as btrfs but good enough?
A quick Google from the laptop found two choices
ext4magicsudo debugfs -R "dump <8> /opt/sda1.journal" /dev/sda1extundelete--dry-run mode?start network, root shell, umount /home (or whatever) to work/opt (not /tmp as it is likely cleaned on boot)/opt as instructed (by ext4magic page)mkdir /opt/me and transfer the list of missing files captured on laptop there toosudo apt-get install ext4magic extundeleteumount /home to dismount (or whereever was hurt!)mkdir /opt/me/recoveryextundelete --restore-files listfile but either it needed different --flags than I guessed or my choice of path prefix to match was wrong; it didn't work for me. I think I tried the --restore-directory version in the webpage also. Nope.ext4magic with the journal cache as recommended, first in list mode (like a dry run) and then do-it; worked like a charm. (Example has hardcoded date time_t in second command, but repeating the $(date... +%s) by history editing -l to -r etc is fine.)chown -r me:me ./recovery (there's a stronger form ext4magic -R instead of -r that might have recovered this, but i didn't feel like trying the stronger form , on without understanding the rest of implications.)cd ./recovery; cp -ar * /home/me/there/.