Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
while reading Maurice Bach's "The Design Of The Unix Operating System", i came across inode.
As file gets updated inode also changes but are there any scenarios like,
- file is same and new inode is assigned
- file is changed and previous(old) inode is still there
Are these situations may happen? if yes how? and why?
while reading Maurice Bach's "The Design Of The Unix Operating System", i came across inode.
As file gets updated inode also changes but are there any scenarios like,
- file is same and new inode is assigned
- file is changed and previous(old) inode is still there
Are these situations may happen? if yes how? and why?
If it's a new inode, it's a new file, perhaps created as a copy of the old file and then renamed to replace the old one, but it's still a new file.
A file can be read and rewritten in place (opened for reading and writing) and would keep the same inode. Note that most editors will, for safety, save the new version under a temporary name and then, once the new version has been written successfully, rename it over the old. The file would thus have a different inode. Cases where this can't be done, and the file is thus rewritten in-place, include (a) a directory that is not writable and thus no file creation or renaming can be done there, and (b) files with multiple hard links, since the new file would not share the hard links.
Yes, i got the concept of how the new inode is assigned to same file.
But i am still not clear about 2nd scenario that, file is changed and old inode remains same. is this case possible?
OK, it remains same. But as i read in the book, it says, as the file gets updated the inode also get changed. do they mean the content of the inode changes like access/modify time?
An "Inode" is an object with a numeric key. The term "Inode" is sometimes simplified and meant as the "inode number" when it really should refer to the record as a whole. For example, an Inode Record contains these fields:
Inode number
Access Control List (ACL)
Extended attribute
Direct/indirect disk blocks
Number of blocks
File access, change and modification time
File deletion time
File generation number
File size
File type
Group
Number of links
Owner
Permissions
Status flags
Notice that the "Inode Record" contains a field called "Inode Number"? That is the source of your confusion. The "Inode Number" does not change with every operation. But other fields in the record itself may.
Last edited by szboardstretcher; 02-21-2017 at 01:59 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.