So if i move a file from one directory to another within one Filesystem, say "/opt" which is a mounted point, the i-node of that file stays consistent as long as the files stays within that mount-point "/opt". Now, if I move that file to say, "/usr", which is a different mount-point, the i-node of that file changes. Is there a way to keep the i-node of a file consistent when moving the file across filesystems?
1 Answer
no - the inode is "assigned" by the filesystem (i.e., driver within the kernel).
In theory (using some low-level tool), you could write onto a specific inode, but in practice you would really not want to do this (too much work and too much chance of breakage).
A while back, I worked with someone who had the (not) bright idea of using inode numbers as unique identifiers for files. That came to an end when considering how to restore a backup.
-
Thanks for the clarification! Haha, how did inodes affect the way of restoring backups?chromechris– chromechris2016-11-05 03:51:42 +00:00Commented Nov 5, 2016 at 3:51
-
They did not find it possible to restore the files with the same inode values (due to the nature of the application, using
ddto save a raw device was not considered).Thomas Dickey– Thomas Dickey2016-11-05 11:51:37 +00:00Commented Nov 5, 2016 at 11:51 -
Ohh, haha. So the recovery backup was removed from the system right? Then inserted back in?chromechris– chromechris2016-11-06 01:19:12 +00:00Commented Nov 6, 2016 at 1:19