Search for file by the name it had before being renamed
Solution 1:
- Do file renamings get saved in any log or metadata somewhere?
Practically speaking, no. File names are a single record in the file system. In Linux, a file name points to an inode, which is the real unique identifier of a file. That way, a single file can exist in multiple places in a linux file system. If you rename a file, the new name takes the place of the old in the file system.
That is a simplification: modern file systems are complex. For example, they usually also have journalling, where an old name temporarily may be kept. This, however, has a time scale of only minutes, certainly not two years.
- Is there a way to search for old files using their pre-rename name? If yes, what command or tool do I use?
Because of 1, no. A renamed filename is overwritten.
- Is there a way I could search the hard drive (SSD) for (probably) deleted files in a specific path without rebuilding the file layout table of the whole partition (that could take an eternity!?) ?
You are in the area of data recovery now. Data recovery is quite difficult in modern linux file system, because of the way they work. There is a tool photorec
(and its accompagnying tool testdisk
) that allows some rescuing of deleted file - photorec
will, however, not work based on file names, but will carve the digital data, recovering blocks when it recognized digital data that resemble a known file format.
Moving and especially deleting data is to be considered an irreversible process for practical purposes. The only precaution against undesired or erroneous file operations is to maintain a backup, in your case preferably with versioning (i.e. keeping very old version around).