You don't delete an inode; you unlink directory entries from it (this is the operation that is performed when you "delete" a file... you sever the linkage between a particular *name* and the inode that it references).
Each "unlink()" decreases the reference count as the reference is removed. When the last reference is unlink()-ed, you now have no way to reference the inode so it is *then* deleted.
A consequence of this is that you can only "link" (i.e., add another
*name* that references a particular inode) names residing on the same volume together. E.g., if: /some/particular/pathname /some/long/name each reside on the same volume, then: /some/particular/pathname/file1 /some/particular/pathname/file2 /some/particular/pathname/file3 /some/long/name/fileA /some/long/name/fileB can all reference the same "physical" file. (These are called "hard links" -- see below)If, however: /another/point/in/the/filesystem is on a *different* volume, then you can't link to the file referenced above -- because the other volume has no ties to the first one. For that reason, there are "soft links" (symbolic links) that can be located anywhere and, effectively, encode the referenced pathname *in* the symlink. So, the inode for: /another/point/in/the/filesystem/othername would actually "contain" the equivalent of: "/some/particular/pathname/file1" When /another/point/in/the/filesystem/othername is referenced, it is seen to be such a structure and it's contents are used to find the actual file.
Note that a symlink can reference another symlink, etc. So, this resolution process can be extended arbitrarily.
A consequence of this symlinks implementation is that the
*pathname* which the symlink references can be *deleted* and the symlink is never notified. E.g., if: /some/particular/pathname/file1 is unlinked ("deleted"), then any later attempt to access /another/point/in/the/filesystem/othername will result in "file not found". This is because the *name* "/another/point/in/the/filesystem/othername" persists but the name that it *references*, "/some/particular/pathname/file1", doesn't -- even though the *file* that it was intended to reference is still present as: /some/particular/pathname/file2 /some/particular/pathname/file3 /some/long/name/fileA /some/long/name/fileB I.e., there's no way of knowing how many symlinks reference a particular name when that name is "unlinked"! Nor of sorting out where they reside in the file system(s) -- some of which may not even be *mounted* at the present time!
Links (hard and soft) have value in many ways. E.g., I can put a "name" in a particular place in the filesystem hierarchy (remember, filesystem is just a big, unified namespace!). Then, place links to the actual file in different places for convenience or access control.
E.g., links in every user's home directory that point to "important message" allows everyone to read their apparently *local* "copy" of that "important message" while, in fact, only referencing that one copy. When you've read it, you can freely delete your "copy" of it (unlink the *name* that resides in your home directory) yet still have the actual file persist for the other users who may not, yet, have read it.
inodes are used for multiple purposes in the filesystem. For a regular file, they contain most of the metadata associated with the actual file (its size, owner, access permissions, timestamps, etc -- and, pointers to the actual disk blocks that contain the file's data, for small files... inodes are cascaded to multiple levels of indirection to support bigger files; e.g., the first inode contains pointers to "indirect" inodes which then reference other inodes -- or, the actual data blocks themselves)
A directory is actually a special file whose contents are (name,inode) pairs.
[Disk blocks can contain multiple inodes, so the INITIAL size of a directory varies with the underlying format of the filesystem; bigger blocks create bigger directories before the directory starts to need to reference other disk blocks... just like regular files grow!]