aspose file tools*
The moose likes Linux / UNIX and the fly likes File Names doubt in Linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "File Names doubt in Linux" Watch "File Names doubt in Linux" New topic
Author

File Names doubt in Linux

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9520
    
    2

Guys,

What is an inode in Linux? What meaning does it have with respect to filenames?


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9520
    
    2

What is confusing is that multiple file names point to an inode. But it is also known that inodes are unique... What would that mean? I do not understand how multiple filenames point to one inode?
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959


I do not understand how multiple filenames point to one inode?

With hard link, more than one file name can refer to the same inode.

Wiki


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

This link maybe useful for you.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

There's plenty of good literature on inodes and their functions, but the key thing is that it's different from DOS/Windows. In DOS, the directory referred directly to a file. In Unix/Linux, it's the inode that does that. The directory is basically a name/value pairing that associates an inode with a filename (along with some other things, like access rights).

The main consequences are

1. Multiple filenames in multiple directories can refer to the same file (hard links) as long as it's on the same device (inodes are not unique between different devices).

2. Locking is done on inodes, and not on directories. Which is one of the main reasons why Windows has "reboot fever" - Windows locks on the filename. In Unix/Linux, you can assign a new inode (file) to a directory entry, and running apps will continue to use the old file (usually), but new references will be via the new inode. So all that's required to update a system resource is to assign a new inode and restart the software that references that file. Instead of the whole OS.

I think I had a third item, but I've forgotten it already.


Customer surveys are for companies who didn't pay proper attention to begin with.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9520
    
    2

Thanks guys for the participation.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File Names doubt in Linux