Monday, April 21, 2014

Linux File System



The term filesystem has two somewhat different meanings, both of which are commonly used. This can be confusing to novices, but after a while the meaning is usually clear from the context.

  • One meaning is the entire hierarchy of directories (also referred to as the directory tree) that is used to organize files on a computer system. On Linux and Unix, the directories start with the root directory (designated by a forward slash), which contains a series of subdirectories, each of which, in turn, contains further subdirectories, etc. A variant of this definition is the part of the entire hierarchy of directories or of the directory tree that is located on a single partition or disk. (A partition is a section of a hard disk that contains a single type of filesystem.) 

An example of a sentence using the word filesystem in the first sense is: "Alice installed Linux with the filesystem spread over two hard disks rather than on a single hard disk." This refers to the fact that [the entire hierarchy of directories of] Linux can be installed on a single disk or spread over multiple disks, including disks on different computers (or even disks on computers at different locations).

  • The second meaning is the type of filesystem, that is, how the storage of data (i.e., files, folders, etc.) is organized on a computer disk (hard disk, floppy disk, CDROM, etc.) or on a partition on a hard disk. Each type of filesystem has its own set of rules for controlling the allocation of disk space to files and for associating data about each file (referred to as meta data) with that file, such as its filename, the directory in which it is located, its permissions and its creation date.


An example of a sentence using the second meaning is: "Bob installed Linux using only the ext3 filesystem instead of using both the ext2 and ext3 filesystems." This refers to the fact that a single Linux installation can contain one or multiple types of filesystems. One hard disk can contain one or multiple types of filesystems (each on at least one separate partition), and a filesystem of a single type can be spread across multiple hard disks.

This article is concerned primarily with filesystems in the first sense. 

Filesystem Structure

The Linux file system is usually thought of in a tree structure. On a standard Linux system you will find the layout generally follows the scheme presented below.



Linux File System

This is a layout from a RedHat system. Depending on the system admin, the operating system and the mission of the UNIX machine, the structure may vary, and directories may be left out or added at will. The names are not even required; they are only a convention.

The tree of the file system starts at the trunk or slash, indicated by a forward slash (/). This directory, containing all underlying directories and files, is also called the root directory or "the root" of the file system.

Directories that are only one level below the root directory are often preceded by a slash, to indicate their position and prevent confusion with other directories that could have the same name. When starting with a new system, it is always a good idea to take a look in the root directory. Let's see what you could run into:


Subdirectories of the root directory:

 Directory
                                                    Content
/bin
Common programs, shared by the system, the system administrator and the users.
/boot
The startup files and the kernel, vmlinuz. In some recent distributions also grub data. Grub is the GRand Unified Boot loader and is an attempt to get rid of the many different boot-loaders we know today.
/dev
Contains references to all the CPU peripheral hardware, which are represented as files with special properties.
/etc
Most important system configuration files are in /etc, this directory contains data similar to those in the Control Panel in Windows
/home
Home directories of the common users.
/initrd
(on some distributions) Information for booting. Do not remove!
/lib
Library files, includes files for all kinds of programs needed by the system and the users.
/lost+found
Every partition has a lost+found in its upper directory. Files that were saved during failures are here.
/misc
For miscellaneous purposes.
/mnt
Standard mount point for external file systems, e.g. a CD-ROM or a digital camera.
/net
Standard mount point for entire remote file systems
/opt
Typically contains extra and third party software.
/proc
A virtual file system containing information about system resources. More information about the meaning of the files in proc is obtained by entering the command man proc in a terminal window. The fileproc.txt discusses the virtual file system in detail.
/root
The administrative user's home directory. Mind the difference between /, the root directory and /root, the home directory of the root user.
/sbin
Programs for use by the system and the system administrator.
/tmp
Temporary space for use by the system, cleaned upon reboot, so don't use this for saving any work!
/usr
Programs, libraries, documentation etc. for all user-related programs.
/var
Storage for all variable files and temporary files created by users, such as log files, the mail queue, the print spooler area, space for temporary storage of files downloaded from the Internet, or to keep an image of a CD before burning it

This is all about linux file system.



1 comment:

  1. Hi friends, This is Chandrika from Chennai. I did Unix certification course in Chennai at Fita academy. This is really useful for me to make a bright career. Suppose if anyone interested to learn Unix Training in Chennai please visit Fita academy located at Chennai.

    ReplyDelete