Link to a specific inode

家住魔仙堡 提交于 2019-12-18 04:53:07

问题


I have a file that was deleted, but is still held open my a program. I found the inode number using lsof. How can I create a hard link back to that inode?

Any code helps, but Perl would be handy.


回答1:


Copy from /proc/pid/fd/file descriptor

Use lsof to find the pid and the file descriptor.




回答2:


on EXT filesystem you can use debugfs command to recreate the link like :

debugfs -w /dev/mapper/vg0-root -R 'link <16> myfile'

Which will create a "file" named myfile and pointing to inode 16.



来源:https://stackoverflow.com/questions/1178593/link-to-a-specific-inode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!