Linux File System

Understanding Linux file system for Windows users

The file system is integral to an Operating System to store and organize data. It can be fixed (e.g. internal Hard Disk Drive) or removable (e.g. Optical Drive or Flash Drive) media devices.

Partition is a virtual division of the physical device, so that the OS interprets it as multiple hard drives. For the discussion here, a partition is
simply another media device.


Linux Windows
Filenames are case sensitive Filenames are not case sensitive
Path separator is  /  (forward slash) Path separator is  \  (back slash)
No drive letter for devices Devices denoted by drive letters
File system has a main root directory No common root directory

Concept

Windows users are familiar with disk letters to access the different file systems. Each storage device is given a “drive letter” and disjoint from each other. So each drive is accessed from its own root directory.

Linux does it differently. It makes the file system seamless across the different storage devices. Other device file systems are accessible at arbitrary directories under the root directory. The root directory can be considered as the main directory and is denoted by / (single forward slash). In other words, you mount (connect) the file systems and they appear as just another sub-directory at the mount points.

This concept may seem strange, but it actually makes life easy for you when you want to add more space. For example, let’s say you run out of space on the drive. Well, since a partition can be mounted to any directory, you can simply go to the store and pick up a new hard drive and mount it to a directory. You’ve now grafted on some more space to your system, and all without having to move many things around. It’s kind of like an ever-expanding hard disk.

Structure

The structural layout is best explained with an example. Let’s say we have 4 storage devices.
Device1 – Internal HDD where the OS is installed
Device2 – Internal HDD which is used to store data
Device3 – Optical CD/DVD drive
Device4 – External flash drive

On Linux it could be made to appear as shown below. You simply create a “standard” directory structure and mount the various devices at those end points (called mount points). Then just like on Windows you could add sub-directories and files under the mount points.

/ Device1
|__ some
|     |__ nested
|           |__ directory
|                  |__foo2 Device2
|__ foo3 Device3
|__ media
      |__ foo4 Device4

So you would access these file systems differently on Linux and Windows.

Linux Windows
Device1 / C:
Device2 /some/nested/directory/foo2 D:
Device3 /foo3 E:
Device4 /media/foo4 F:

A good example to see how Windows drive letters can be emulated on Linux is to have a look at Cygwin. It creates an intermediate cygdrive directory for organizing but could be done without it. Directories c, d and e are created to which the devices are mounted.
/cygdrive/
/cygdrive/c
/cygdrive/d
/cygdrive/e

Conclusion

Users from a Windows background might find the mounting of devices a bit odd. But once you understand the underlying design, it’s a powerful and flexible concept.