Honestly... this question has many answers... too many to enumerate here. Largely this depends on the type of file-system... and the OS reading it... and also what features of the file-system are enabled.
Every file system has some sort of "database" as you described to translate a name/path to one or more locations on the disk. How this "database" works is what makes each file-system different. Some methods are better for some tasks than others. Some are more recoverable & redundant in the event of a failure... some are strictly geared towards speed and have almost no recovery in the event of a single failure.
Depending on the OS, and the file-system type, the "database" can be partially or even completely loaded into RAM in order to help speed-up the process of locating the position on the disk. Some file-systems make use of linked-lists & b-trees or other types of ordered trees in order to quickly locate files. Journaling can also speed-up the read/write processes dramatically (given the right conditions). There are even file-systems (mostly proprietary) that truly ARE a database.
The real question is... Why do you want to know... and what are you trying to accomplish? If you want more specific answers... give more specifics about what OS/platform/file-system you are talking about.
This probably isn't the place to ask such a question. At best, we can get this migrated to the Programmers site. But this is also very broad. I'd suggest you google
linked lists
andB tree
. – surfasb – 2011-07-29T16:11:37.897@TheCompWiz has summarized it anyway: > The real question is... Why do you want to know... and what are you trying to accomplish? If you want more specific answers... give more specifics about what OS/platform/file-system you are talking about. – slhck – 2011-07-29T16:54:43.183
I tried googling and wikipedia and there's a lot of information but not realy about the method the OS uses to find the file, but I understand that it's different for each OS and filesystem as you say so I'll try to post a more specific question probably in the Unix forum since I use linux. – fiftyeight – 2011-07-29T18:01:27.947
The FAT does not list files; it is just an array of pointers, one for each cluster on the fs. Each one points to the next cluster that logically follows this one in whatever file this one is a part of, or is one of several reserved values for things such as free/unused, end of file, and bad sectors. Directories are what lists files, and they are linearly searched. – psusi – 2011-07-29T19:14:02.887
hmmm... so say I request from the OS a listing of files on the directory "/usr", how does it know the address of this directory on the HDD? – fiftyeight – 2011-07-29T19:40:43.367