Okay, some time ago I found what seems to be a bug in nautilus.
/tmp$ mkdir test/
/tmp$ mkdir test2/
/tmp$ echo "very important stuff" > test/important-file.txt
/tmp$ ln -s /tmp/test/ test2/test
If you try to mv test2/test .
bash is smart enough to answer :
mv: «test2/test» and «./test» identify the same file
I created a symbolic link to test (a directory containing a file) in another location, and then I moved the symbolic link to the place where the directory was
But then , nautilus gets into the game:
Nautilus understands that the symbolic link is a directory, and it kindly offers me to merge them:
Now, I merged them (I obviously thought it was two different directories). And as a result...
tmp$ ls -la
lrwxrwxrwx 1 cool-user best-group-ever 9 août 26 23:51 test -> /tmp/test
Okay. So I lost my directory (which is normal, because I overwrote it) and ended up with a useless circular symbolic link, but... what happened with my important-file.txt
? It had an inode, that's not referenced by any directory in my system anymore.
Obviously, I didn't write that inode in a post-it... so, where is it ?. Is there any way to find every file with an inode which is not referenced by any dir?
And as a bonus question: Is this the expecteb behaviour of nautilus, or is it a bug?
Why and how this happened to me is a long story, but I had some really important (and confidential) files within my directory that I would like to get back
cd
command on line 4 of the snippet – kos Sep 18 '15 at 10:02important-file.txt
is still opened by another process, so you can find out the inode by listing all open files (lsof | grep important-file.txt
) and then re-link it. See http://serverfault.com/questions/168909/relinking-a-deleted-file and http://www.barricane.com/undelete-open-file-from-inode - but I guess your file is not opened any more, so it could also probably be overwritten already... – Byte Commander Sep 18 '15 at 11:56