directory structure vs file system

People don't use file system too carefully. In your examples, I would say that /, /bin and /proc are file systems because an entire partition (like /dev/sdb1) is mounted on those directories. My Arch linux system doesn't have /bin as a file system so this example isn't perfect but...

% ls -lid /proc /home /boot /
2 drwxr-xr-x  17 root root 4096 Feb 24 12:12 //
2 drwxr-xr-x   4 root root 4096 May 16 14:29 /boot/
2 drwxr-xr-x   5 root root 4096 Mar 14 18:11 /home/
1 dr-xr-xr-x 116 root root    0 May 16 17:18 /proc/

Inode number 2 is traditionally the "root" inode of an entire on-disk file system (which is the other usage of the phrase). /, /boot and /home all have inode number 2, while /proc, which is presented entirely by the kernel and does not have an on-disk presence, has inode 1. Those inode numbers indicates that a whole, on-disk file system, or a virtual file system is mounted using that name.

The sentence '/home/abc/xyzdir1 is a directory" basically means that no on-disk file system is mounted using that name. If you do the same ls -lid command on a directory you get something like this:

 % ls -lid /home/bediger/src
3670039 drwxr-xr-x 29 bediger bediger 4096 May 17 19:57 /home/bediger/src/

Inode number 3670039 is just whatever inode got allocated from in the on-disk file system mounted (on my machine) at /home.

You could also find file systems by invoking the mount command. It lists all mounted file systems and where they are mounted.


At the risk of grossly oversimplifying,

  • A filesystem is like your car's engine and other internal systems,
  • A directory structure is like a map of the places where you drive.

Since I’ve been asked for an encore,

  • Filesystems are like the mechanics (implementation details) of audio/video signal distribution/propagation: analog RF broadcast, digital RF broadcast, cable, Internet, video tape, video disk, etc.
  • Directory structure is like the content of television programming, and the categorization thereof, e.g., into comedy, drama, news, documentaries, games shows, sports, etc.

If you want code, see the first half of this answer to How to determine whether a Linux filesystem belongs to a running system — the part that does validation checks on root_dir.  It’s just doing what Bruce said; verifying that it is a directory and checking whether its inode number is 1 or 2.


The way I see it, a filesystem, in the UNIX sense, is a way of implementing a directory tree (directory structure), or more precisely, a way of implementing the UNIX filesystem API. The root file system is backed by one particular implementation, and whenever you enter a mountpoint directory, you enter a subtree that's backed by something different.

The interface is always the same, but in one case, you have a particular disk partition at the back end, in another case, there will be a program that never even writes to a storage device. The proc filesystem will be backed by software that exposes kernel internals; an tmpfs will be backed up by software that writes to RAM, and other file systems might write to the network or elsewhere.

In the non-UNIXy sense of the word, a file system is a way of organizing data storage. ext4, btrfs, fat, and ntfs are file systems in this sense, but also in the UNIXy sense—they implement the filesystem API. proc wouldn't classify as a filesystem within this, more limited, paradigm as it doesn't organize data storage.

TL;DR:

  • directory structure/tree = front end
  • file system = back end