Understanding the Linux file system – The root partition

Posted by OS Tricks Blog

In this guide I am going to show you how the Linux file system is laid out and show it’s difference compared to a Windows filesystem. I am writing this assuming you primary come from a Windows background. The Mac OSX file is called Darwin and is based off of Unix the same as Linux is. The filesystems are so close in operation from Mac to Linux that it should feel like a natural fit. I will be showing the GUI file manager instead of the command line because Windows people will have experience with Explorer.

One of the first thing you should understand is the root of the filesystem. In Linux the root of the filesystem is written as / and under root is everything installed on the file system including all hard drives. In Windows there are multiple roots, each hard disk usually will have its own root filesystem written as C:\ or D:\. The C:\ in Windows is the root of hard drive used by default to install all the operating system files and programs installed on Windows. In Linux the root filesystem where everything gets installed is /. The differences are how the disk are mounted. In Linux the disk is mounted to a folder under the / filesystem. In Windows, disk get their own independent file system.

A default install of Linux has a filesystem under root that looks like this.

This is a default Windows root.


So when you reference file or folder location in Windows it would look like this:
C:\Program Files\Internet Explorer\iexplore.exe

When you reference file or folder location in Linux it would look like:
/etc/httpd/conf/httpd.conf

Both of these start at a root partition and then move through a directory structure until a file is reached. The root partitions are different and one uses back slash while the other uses forward slash. It is essentially two different ways to write a path to a file or folder.

You will notice that the Linux filesystem has more default folders then what Windows has at default. The Linux system in general does not try to hide the complexities of an operating system like Windows or Mac OSX.

In Windows under root the following directories exist:

C:\
PerfLogs – Performance metrics log
Program Files – Install directory for x64 software
Program Files (x86) – Install directory for x32 software
         Users – Location for users personal data
         Windows – Core operating system files

In Linux under root the following directories exist:

/
boot – Files needed by the boot loader
dev – Devices attached to the system
etc – System configuration files
home – Location for users personal data
media – Mount folder for removable device (USB Flash Drives)
mnt – User defined mount directory
opt – Optional packages directory
proc – Process information directory. This is the running kernel parameters. Similar to Windows Registry
root – Home directory for root user
run – Runtime variables
srv – Services directory
sys – system files
tmp – Temporary files (flashed on reboot)
usr – User applications
var – Variable files

You may notice that I left a few out like /bin but if you look at the icon you can a little down arrow.

Another difference that needs to be looked at is how other disk or partitions are organized.

In Windows most disk will get their on drive letter with a root filesystem, although it is possible to mount a disk as a folder on an exist filesystem. With Linux you will not see multiple filesystems on a single computer. Lets look at an example of inserting an USB flash drive on both systems and look how they go about mounting it.

Windows


Linux


When using Linux you have the throw the whole concept of drive letters out the window and understand that everything will happen in the / root filesystem.

Post a Comment