in Technology

Filesystem & file organization in Linux

Let’s hope that our earlier article — Which Linux distro is right for you? — helped you decide a distro suitable for you. With the assembly of a complete Linux machine, it’s time now to look into the architectural design of the operating system and look how robust Linux is with an efficient file management system it has. We shall now dive in to understand the file system and the file hierarchy of a Linux system.

A common description of the UNIX system, which also holds good for a Linux operating system says,
On a UNIX system, everything is a file; if something is not a file, it is a process.
This statement holds good because there are special kind of files that are more than – just files, say – pipes and sockets, for that matter. But, saying that everything is a file is an acceptable generalization, just for simplicity. A Linux system, just like any *NIX based system doesn’t differentiate between a file and a directory, since a directory is just another file which contains names of other files. Applications, programs, documents, services, images and just about everything else on a Linux operating system is a file! Even the input and output devices are considered as files, according to the Linux system.

In order to manage all these files in an organized and orderly fashion, we think of them in a tree-like structure on the hard disk. We shall now continue to use this image of the directory while we shall peep into the roles of each leaf of the tree. The picture below says it all.

Linux Filesystem Basics

Image from Linux Config

Linux Filesystem BasicsIn Linux, everything is a file.

The file system where a Linux distro is probably installed is either ext2 or ext3 and is referred to as data partition. The other important partition is known as the swap partition which works as an extended physical memory. It is generally advisable for the swap partition to be 1.5 times the amount of physical memory installed on the system.

That was a picture of the file organization in a Linux operating system. Linux also has a remarkable support for a large number of file systems – ext, ext2, minix, umsdos, msdos, vfat, proc, xia, smb, ncp, sysv, iso9660, hpfs, affs, ufs, etc. The file system, as we saw, is represented hierarchically with ‘/’ (root) being the top most level. Each new file system is added into a single file system tree as and when it is mounted.

All the file systems are mounted onto a directory and the files of the mounted file system form the existing contents of that directory. This directory is called the mount directory or mount point. When the file system is unmounted, the mount directory’s own files are once again revealed. This great feature of Linux systems to enable on-the-fly mounting and un-mounting of various file systems without the need of fetching different drivers, makes them stand apart. This also gives the users and developers freedom to choose from a variety of file systems to handle their files.

The kind of organization Linux has for the files is a good reason in making Linux systems more secure. The estimate of how strong this architecture is can be made by the fact that there has hardly been any noticeable change in this design over the past decade. So, this means we’re running a system which has deep underlying roots!

12 Comments

  1. Good explanation, though I wish it went more into advanced details.

    Stumbled and submitting to Digg, hope atleast this one clears the gauntlet.

  2. Good explanation, though I wish it went more into advanced details.

    Stumbled and submitting to Digg, hope atleast this one clears the gauntlet.

  3. Just wanted to say that I'm looking forward to you Linux articles.
    I installed Ubuntu on an old machine about 4 months ago when I found out there was a FlexBuilder alpha. I have only used it about 4 times ever since, mostly because because I can't get wireless to work and I can get my head around file permissions and the "sudo". I've never been interested in computers and knowing how they work. I'm willing to keep trying though, I'm sure your articles will help me in my path to enlightment.

    Thanks!

  4. Just wanted to say that I'm looking forward to you Linux articles.
    I installed Ubuntu on an old machine about 4 months ago when I found out there was a FlexBuilder alpha. I have only used it about 4 times ever since, mostly because because I can't get wireless to work and I can get my head around file permissions and the "sudo". I've never been interested in computers and knowing how they work. I'm willing to keep trying though, I'm sure your articles will help me in my path to enlightment.

    Thanks!

  5. @Sumesh: Thanks for your words! We shall slowly graduate to advanced Linux discussions and topics. But we'll make sure that the newbies do not lose their interest.

    @asinomasimple: Great to see you learning Linux and we're happy that we could be some help to you, through these articles. Thank you!

  6. @Sumesh: Thanks for your words! We shall slowly graduate to advanced Linux discussions and topics. But we'll make sure that the newbies do not lose their interest.

    @asinomasimple: Great to see you learning Linux and we're happy that we could be some help to you, through these articles. Thank you!

  7. hello praval sir,
    i found all ur tutorials on linux are so good. i m newbie to linux and want some suggestions from u. i m interested in linux administration and so i m doing RHCE course. and i want to know what types of career opportunities for me in linux based companies ? i also want to do some more advanced certifications in linux, so what would be more appropriate according to newer demands in tecnology.

    plz do reply, as i m finding noone to guide me in this context.

  8. hello praval sir,
    i found all ur tutorials on linux are so good. i m newbie to linux and want some suggestions from u. i m interested in linux administration and so i m doing RHCE course. and i want to know what types of career opportunities for me in linux based companies ? i also want to do some more advanced certifications in linux, so what would be more appropriate according to newer demands in tecnology.

    plz do reply, as i m finding noone to guide me in this context.

  9. Hi Praval,

    Greetings from San Jose, CA!

    Thank you so much for your very clear and highly understandable explanation of the Linux file system and organization... and especially for the file system diagram. I'm new to Linux and just getting comfortable with the CLI. Your explanation of the conventions used in Linux - "Everything's a file" - is worth its weight in gold. I'd never looked at it that way before and doing so clears up a lot of misgivings. Your hierarchical diagram gives me a good starting point to snoop around in the system and get comfortable with navigating the tree. Great stuff!

    Incidentally, I found your post by searching Google Images for "Linux file system". What you've done here on this topic is way better than anything I could find in the Linux or Ubuntu docs! Good job!

    All the best to you!

    Jack

  10. Nice post, I just heard that everything is file in linux, didn't know the reason. Now I have got it. Thanks.

  11.  I can't get wireless to work and I can get my head around file permissions and the "sudo". I've never been interested in computers and knowing how they work.

Comments are closed.

Webmentions

  • The power of ‘root’ in Linux - Brajeshwar Apr 14, 2012

    [...] our previous recitation — Filesystem and File Organization in Linux — we hope the picture of the complete Linux file system would be resident in your minds. We [...]