Not sure if this is the correct stack-site to ask this question, but I found this being the most "logical" one.

We're having a huge argument over where the file name is stored in the system. One of us think the file name is stored in the files' meta-data. The others disagrees, we think the filename is somehow stored in the directory or the file-system. If this is correct, how does the file-system point from the file name to the correct file and binary data?

Is it stored with some sort of ID or does the file-system add a reference to the point on the hard drive where the file is located?

Am I lost? I've tried searching for this on the Internet, but I could not find what I was looking for.

Edit: I see some of you asking what kind of file-system I am referring to, but I ask this "in general". If some file systems does not store this in their system, it means the file name must be stored in the metadata? Where else is the filename supposed to be stored?

  • In HopelessN00bFS, the file names are stored in the cloud. Which file system do you refer to? (It matters.) Nov 20, 2012 at 17:45
  • 1
    Did you try downloading the Linux kernel source? The source for a dozen filesystems is there.
    – Zoredache
    Nov 20, 2012 at 17:45
  • @HopelessN00b : Added clarification in the bottom. Nov 20, 2012 at 17:49
  • 1
    You keep saying 'metadata' as if it is some separate location. Where do you think the metadata is stored?
    – Zoredache
    Nov 20, 2012 at 17:58
  • 1
    This really is filesystem dependant and just saying 'in general' doesn't help for that reason.
    – user9517
    Nov 20, 2012 at 18:26

4 Answers 4


It seems, both from your original question and your follow-up questions, that you don't understand how filesystems work.

A "disk" is nothing but a very very long string of zeros and ones. A computer must use a standard method of managing these zeros and ones, called a "filesystem". There are many different types of filesystems on various types of computers -- FAT32, NTFS, EXTFS, ResierFS, and so no. The choice of filesystem is critical to the relationship between the computer accessing the disk and the zeros and ones stored on the disk. If a filesystem is formatted as an EXTFS, but the computer decides for some reason to use ResierFS to manage the disk, it will end in complete data corruption.

Many Unix-based file systems, for example, EXTFS and its derivatives, will logically divide a disk into multiple sections. One section is the "inode table". This area contains the "inodes". Each inode refers to a specific file and will describe, for example, what type of file it is ("normal" file, directory, device, socket, etc), the owner, the permissions, and the section(s) of the "data" portion of the disk where the file's data can be located.

Then there will be a "data" area. For a "normal" file, the file's contents will be stored here. In the case of a directory, what is stored here is a list of filenames (one name for each file contained inside that directory) and the inodes that each of those filenames refers to.

When you want to find a file, you specify it by its "path". The computer starts at the root of the path ("/"), finds the name of the first object in the path ("usr"), and then

  • locates its inode
  • notices it's a directory
  • gets the name of the next object in the path
  • finds that object in the directory
  • repeat

until finally it finds an object whose inode indicates "not a directory".


One of us think the file name is stored in the files' meta-data.

Not in most classic Unix filesystems, no. In FAT32 and NTFS, I have no idea.

The others disagrees, we think the filename is somehow stored in the directory

In most classic Unix filesystems, yes.

or the file-system.

Everything is stored in the filesystem.


Without specifying an OS or a file system type, it's almost impossible to answer this question.

In most Unix-based file systems, the filename is stored as a name/inode lookup table in the "data" section of the directory containing the file (that is, the space on the disk where a normal file would store its data).

  • I am not so familiar with the different file systems. So I was hoping for a "general" answer. Does this mean that some systems only store the file name in the meta-data? Nov 20, 2012 at 17:52
  • 6
    There isn't a "general" answer to this question. You can also ask "where on a car's dashboard will I find the gas gauge?" but it depends on the car.
    – hymie
    Nov 20, 2012 at 18:01

First - it technically depends on the filesystem.

However, it's safe to summarize that the "metadata" about a file (name, attributes, location on disk, etc) is stored in a reserved space not intended for file content called an inode.

The POSIX standard dictates at a minimum what should be stored in that for UNIX filesystems.

There's no correlation of a file being stored in a "directory" on disk. A filesystem is what's responsible to make it appear that there's an organizational structure of directories containing files, but underneath it all there's no real structure except metadata and addresses.

  • Does this mean that the meta-data you list up is not stored within the file itself, but in a separate file or table? Nov 20, 2012 at 17:54
  • You can't think of it as a 'file'. It's a sequence of blocks. An inode is a partitioned set of blocks that contains the raw-level data for the filesystem to determine the attributes (including name) of what people in userspace consider a "file".
    – thinice
    Nov 20, 2012 at 19:32

When you format a hard drive partition, it depends on the partition type/file system, but typically some of the space on the partition is reserved for things like file names and the directory structure. That is where the name lives.

Not the answer you're looking for? Browse other questions tagged or ask your own question.