How can I access file by inode on Linux

情到浓时终转凉″ 提交于 2019-12-05 14:35:04
Luke

I found the question connected concerning similar topic here.

Summarizing, check out those commands:

  • find /path/to/mountpoint -inum <inode number>
  • sudo debugfs -R 'ncheck 393094' /dev/sdaX 2>/dev/null

Hope this helps you investigate further.

Not sure if I understood your problem correctly but:
You can start with "/" directory and proceed recursively (or any loop for that matter) with children. Compare the inode value with strcut stat.ino_t. Once you find it, open the path/file.

I don't know if there is an easier way or not but you can do this with bash. with ls -i command you can see the inodes too,

$ ls -i
11147622 file.txt

the first column is the inode number, the blow command shows the inodes in current directory

$ ls -i | awk {'print $1'}

so you need to check the inodes from / too all it's subdirectories until find it

ls -iR /

it shows all subdirectories and there files with there inode number

now you should start from / and use awk to or cut command to have the first column(inode number is in the first column) then compare it with the inode you want to find.

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