Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have used Windows since childhood, and when I hear the phrase "Windows filesystem" I think of directories (folders) within directories, a folder called SYSTEM, a folder called PROGRAM FILES etc. Is this what the system is? Just the layout of the folders?

And then I recently started using Linux, and my reference book says in the linux filesystem everything starts at root and branches off from there. How is that really different from Windows? I mean, it seems the linux system and the windows system are just two ways of setting up a directory tree. Is this what file system means?

share|improve this question
3  
Have you tried to read en.wikipedia.org/wiki/Filesystem ? –  choroba Dec 7 '11 at 15:34
2  
FYI, There is no "Linux filesystem". What the book meant to say is the linux directory tree. And, yes, the directory tree is just the layout of the folders. –  user606723 Dec 7 '11 at 17:47
2  
Linux lacks the concept of drives, such that everything is mounted under /. In Windows, this is not the case, as it lacks UNIX-style mounting (correct me if I'm wrong here), so everything is organized around drives. –  new123456 Dec 7 '11 at 21:30
1  
@new123456 Feel corrected. Windows supports mounting (since W2k or NT), although the feature is very rarely used. –  kubanczyk Dec 7 '11 at 23:03
1  
One difference is that the word "filesystem" has three different meanings. –  JdeBP Dec 7 '11 at 23:27

4 Answers 4

up vote 124 down vote accepted

Just the layout of the folders?

Sounds too good to be true...

Let's take the FAT32 file system as an example. I can install Windows XP on it, but I can also use it on a memory card. On a memory card, you don't have those folders that you sum up.

So... Don't confuse the directory layout of a family of operating systems with a file system.

Is this what a file system means?

No... It refers to the underlying bits and bytes that make your directory structure work.

The underlying bits and bytes? Show me FAT32!

Let's look at what FAT32 looks like, it has:

  • Some header sectors in the beginning, like Volume ID and Reserved Sectors
  • Two File Allocation Tables, allowing us to figure out where our files are.
  • Clusters containing all our directory and file data.
  • Some very small unused space that we can't use.

A FAT table consists of a lot of entries that look like this, allowing us to determine where the directory or file is stored in the clusters space, as well as some attributes and size.

A directory entry would point to a list of directory/file entries...

In the clusters space, we can now travel our clusters to find the data we need. A cluster essentially contains data and information where the next fragments are

enter image description here

Do other file systems differ? Show me NTFS!

I'm going to show you an image so you can notice the differences, the rest is homework for the reader: More information can be found on this blog archive or Google.

The main idea is that NTFS is a huge improvement over FAT32 that is more robust/efficient. Having a better idea of (un)used space by using a bitmap to further help against fragmentation. And so on...

http://thinkdifferent.typepad.com/photos/uncategorized/04ntfsfilesystem.png

What about the file systems on Linux? Show me ext2/3!

The idea is that ext2/ext3 use super blocks and inodes; this allows for soft and hardlinks, directories that are files, files with multiple names and so on. The main gist is abstracting away to allow the file system to be capable of doing more meta-ish stuff...

http://thinkdifferent.typepad.com/photos/uncategorized/03extfilesystem.png

share|improve this answer
11  
Great answer in layman's terms ! –  Shadok Dec 7 '11 at 17:04
    
@Shadok: I might improve the later sections later on, I'm quite busy these days though... Thanks. –  Tom Wijsman Dec 7 '11 at 18:45
    
+1 for pictures and diagrams –  Zeke Dec 7 '11 at 22:51
2  
I would +2 this if I could. Now why can't more document and specs look more like this!? –  greatwolf Dec 8 '11 at 1:26
    
Perhaps you should write a blog post about this @TomWijsman ;-) –  Ivo Flipse Dec 8 '11 at 12:37

You can think of file systems as different formats for storing files and folders, somewhat analogous to how MS Word and PDF are different formats for storing documents, or MP3 and WAV are different formats for storing audio.

Given a few files and folders, the file system is the format and the code that stores them to disk so they can be read back again.

And just like not all video players can play all video formats, not all operating systems can read all file systems. E.g. if you store a file from Linux on an ext3-formatted USB stick, Windows cannot read the file since it doesn't know how to handle the ext3 file system.

Common file systems include

  • FAT and NTFS (Windows, NTFS is standard on newer Windows versions)
  • ext3 and ext4 (Linux)
  • HFS plus (OS X)
  • ISO 9660 and UDF (CD, DVD and Blu-Ray)

See Wikipedia for a comparison of file systems.

share|improve this answer

The big difference between Linux and Windows, at least when it comes to their filesystems and directory trees is that in Linux "everything is a file", and everything descends from a single root. This also applies to almost all Unix-derived OSes such as BSD, OS X, Solaris, etc., but I'm going to just say "Linux" to be generic (if not entirely accurate).

But what does that mean in practice?

Windows allows for multiple named roots for their filesystems. You understand these as drive letters: C: D: E: and so on. Each one has a root (\), and a tree that descends from it. Recent versions of Windows allow for things like volume mountpoints, where a volume (what you'd consider a partition) can be mounted to an existing, empty folder. So instead of D:\ representing the root of, say, your optical (CD/DVD/BR) drive, you could mount it at C:\Optical instead. This is more similar to what Linux does. There's also an underlying, single-rooted, object namespace for everything in Windows similar to what Linux uses and is managed by the Object Manager, but most users rarely see it referenced since it's primarily for kernel use.

Linux has a single root: /. Everything descends from it, and it doesn't necessarily need to represent your hard drive. Hard Drives, Optical Drives, Memory Cards, Network Shares, Printers, Scanners, CPUs, RAM, Processes, ... everything is represented somewhere inside this single namespace, and can be access by any process with standard file management APIs, presuming you have a high enough level of access. Just because you can read or write from it doesn't mean it's a file on your hard drive in Linux. For example, devices are typically mounted into /dev, so accessing things in there often means you're talking to a device -- maybe it's the sound card, or a scanner, or a camera, etc. These are known as device files. Procfs is a special "filesystem" that's normally mounted to /proc and has a "directory" for every running process, with files in each directory relating to things like the command line used to invoke that process, memory maps, open files, etc. Sysfs is another special filesystem (mounted on /sys) used to expose a wealth of information about the running kernel objects and can also be used to fine-tune the running kernel by simply writing to a particular file.

share|improve this answer
2  
Please note that it is easy to confuse a file system with the directory lay-out from an user perspective. While the term file system is really meant to look to be about the internals of a file system; eg. the difference between FAT and NTFS, as well as the differences between ext2 and ext3... –  Tom Wijsman Dec 7 '11 at 16:43
4  
@Tom: It appears that the OP is really asking about the differences in the various object hierarchies between Linux and Windows rather than how bits are laid out on disk. udev, procfs, sysfs, tmpfs, etc. are filesystems just as much as ext2 or NTFS are in Linux, despite the fact they don't involve stuff on disk. –  afrazier Dec 7 '11 at 17:22
    
That's only part of his question "Is a file system just the layout of folders?", the way you answer the question only makes it more confusing and doesn't address that question. Hence I left a notice for readers... –  Tom Wijsman Dec 7 '11 at 17:30
    
+1 for "everything is a file" in Linux. This is THE big difference between Linux and Windows for me. –  Rabarberski Jan 3 '12 at 14:13

The filesystem is not only about how a directory tree is set up, but also how this information is encoded on the media, too. There are several filesystems for Linux: ext3, xfs, raiserfs, etc.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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