Many aspects of Linux functionality are found, albeit in a different form in Windows. Inodes, the subject of this article, are an exception to this rule. Given their practicality, Windows now contains an imitation of this functionality. But if you want to take full advantage of this somewhat complicated concept, you'll have to go to Linux or Unix.
So what are inodes and why would anyone want to use them? Inodes are the internal description of a file. As we will see below, the specific inode contents for a given file are different in memory and on disk. But the key to the inode is that a single file may have different names. Why would anybody want to do that? One very important reason is that a user may access a shared file by an intuitive name. Accounting department users could give a certain file an accounting-style name, while users from the marketing department could access this same file by a name that makes sense to them. This functionality alone makes inodes worth while.
Furthermore, let's say that by accident the "accounting" file was deleted. Accounting users could still access that file if they knew the "marketing" name. Remember, we are talking about one single file that has different names. People don't have to know about these complications to be able to access the file. The extra processing is carried out behind the scenes. Now let's examine inodes more closely.
The inode on disk contains the following information: file owner identifier, file type, file access permissions, file access information, number of links, list of data addresses, and file size. The file owner identifier specifies the file owner and the group owner as discussed in our article on permissions and groups. The file type indicates whether we are talking about a regular file, a directory, or something else. The file access permissions denote the permissions, also discussed in a previous article.
A given file may have different permissions for different users, for example accounting users may have permission to read and modify the file while marketing users only have permission to read it. File access information specifies when the file was last accessed, last modified, and when the associated inode was last modified. The number of links indicates the number of names that the file has. In our example, the file has two links.
If either accounting or marketing delete the file (assuming that they have such permission) the number of links is reduced to 1. But the file is still there and the number of links could be increased. The inode on disk provides a list of data addresses; the single file may be scattered across the disk. The final value is the size of the file in bytes. The inode in memory contains all of the above information plus additional information, for example, whether the file is available for processing (someone else may be using it) and whether someone is waiting to process the file.
Remember, several people may be using Unix or Linux simultaneously. If there were no file usage control two different people in accounting could pay a bill at the same time. Windows doesn't have this problem; it's not a multi-user system. The ln command is used to create a link to a given file. For example, ln acct1 mark1 links the mark1 file to the acct1 file; it makes the name mark1 available for the acct1 file.
It's the same file, but with a new name. The ls 'i command provides information about the file including the number of links (the number of names for the file.) The next article in this series discusses the Linux kernel and processes.
Once upon a time Levi Reiss wrote ten computer and Internet books either alone or with a co-author. The books are over, at least for the time being, replaced by a multitude of websites, including global wine, Italian wine, Italian travel (www.travelitalytravel.com ), and health and nutritional aspects of wine. He has taught various and sundry computer courses including Linux and Windows operating systems at an Ontario French-language community college for decades. His new website http://www.linux4windows.com teaches you how to download and run Damn Small Linux even on that outdated Windows computer which has been gathering dust in the basement.