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.
3
Have you tried to read http://en.wikipedia.org/wiki/Filesystem ?
– choroba – 2011-12-07T15:34:08.573yes, but unfortunately I still don't get it. I mean, I understand the words, but I am missing the general idea. – P_Q – 2011-12-07T15:40:49.950
2FYI, 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 – 2011-12-07T17:47:52.987
2Linux 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 – 2011-12-07T21:30:51.5531@new123456 Feel corrected. Windows supports mounting (since W2k or NT), although the feature is very rarely used. – kubanczyk – 2011-12-07T23:03:29.290
1
One difference is that the word "filesystem" has three different meanings.
– JdeBP – 2011-12-07T23:27:50.083You pretty much got it! Here is the Webopedia explanation.
– CharlieRB – 2011-12-07T15:33:16.9201In a nutshell: "filesystem" is the arrangement of bits on the hard drive to store files. "Directory tree" is the collection of folders and files that is the aspect of a filesystem that you see. – tylerl – 2011-12-08T07:00:21.973
@new123456: Furthermore, at the Windows kernel level, everything is mounted under /, not just drives. Drive letters are just shortcuts into the object namespace, as is
COM1:
(shortcut to the first serial port, not a drive) – MSalters – 2011-12-09T09:38:30.170@MSalters Nice to know. I'm assuming its virtual, so one couldn't do much (e.g. create a directory) if one were to manage to get there in the first place? That's what I mean by organized around drives. – new123456 – 2011-12-09T12:35:48.517
@new123456: Oh, you can do pretty much the same with those names. Have a peek in the Registry,
\HKEY_LOCAL_MACHINES\SYSTEM\CurrentControlSet\MountedDevices\
. It will list both the "raw" names (starting with\??\
) and the dos names (\DosDevices\C:\
) – MSalters – 2011-12-09T12:39:20.980Want to see this question blogged? Help by answering or voting at Meta. – Tamara Wijsman – 2011-12-12T01:10:38.643