Quote:
Originally Posted by
srirammanohar
Hi,
I have created a file a.txt in Redhat Linux.
Inode number for a file changes every time i update the file using vi editor , gedit etc.
Is there any setting that can be made , such that inode number never changes as that is supposed to be the expected behavior?
It means the file is being replaced by another file, not that the inode on the same file is "changing" somehow. Prevent the directory from being written to by the processes -- to prevent the moving, creation, and deletion of files -- will prevent the inode from "changing" -- by stopping these things from working. The file can still be overwritten.
If you want the inode to remain the same, don't use anything that replaces it. If you use stream commands to alter the file, don't edit "in place" or such -- redirect them to a temp file, then
cat the new file over the original. To edit, copy to a temp file, edit the temp file, then
cat the temp file over the original. I think this is what commands like
crontab -e and
visudo do.