Sunday, June 12, 2011

FileSystem Hierarchy Standards in Linux

Introduction to FileSystem

1. What is FileSystem?

A file system (sometimes written as filesystem) is a method of storing and organizing arbitrary collections of data, in a form that is human-readable.

2. Different Types of Filesystem

a. Disk filesystems ext2, ext3, reiserfs, xfs, NTFS, etc.

b. Flash filesystems JFFS2, YAFFS, etc.

c. Tape filesystems - LTFS

d. Database filesystems

e. Transactional filesystems

f. Network filesystems NFS, CIFS, etc.

g. Shared disk filesystems GFS, GPFS, etc.

h. Special purpose filesystems procfs, RTOS, etc.

We more concern about Disk filesystems in this section. From here onwards filesystem means Disk filesystem.

Linux kernel supports various types of Disk filesystems, such as Ext2, Ext3, Ext4, XFS, JFS, ReiserFS

3. Difference between Partition & FileSystem

A partition is a logical part of the disk (think of a cake as the entire disk, a slice of that cake would be a partition)
A filesystem is a method of storing / finding files on a hard disk (its on top of the cake so would be icing)

Windows Linux

Partition Disk1 /dev/sda1

FileSystem type NTFS EXT3

Mounting Parameters DriveLetter MountPoint

C drive /

4. How to mount any File System?

$ mount -t

$ mount t ext3 /dev/sda3 /data

Here if you dont have to manually give filesystem type. If the Filesystems module is loaded in RAM, then it will mount automatically.

5. How to find which filesystems are mounted?

$ df h

6. In which file all mounted filesystems gets listed?


7. Entries filesystems which will get mounted at boot time


8. What is FileSystem Hierarchy?

The Filesystem Hierarchy Standard (FHS) defines the main directories and their contents in operating systems

Below I have mentioned details about Linux FileSystem Hierarchy:

/ -> "/" or "slash" contains all the other dirs in linux.
| "Father of all directories".
|-- bin/ -> "/bin" contains compulsory binaries which all users
| can use and without which linux will not work well.
|-- sbin/ -> "/sbin" contains compulsory binaries which only super
| user can use and without which linux will not work.
|-- etc/ -> "/etc" contains all config files [ASCII/flat files]
|-- dev/ -> "/dev" contains all block and character special
| device drivers.
|-- lib/ -> "/lib" contains all shared objects (.so) files.
| Similar to (.dll) files in Windows.
|-- mnt/ -> "/mnt" contains dummpy dirs for mounting removable
| | devices.
| |
| |-- cdrom/ -> "/mnt/cdrom" is the mount point for CD-ROM drive.
| |
| `-- floppy/ -> "/mnt/floppy" is the mount point for floppy drive.
|-- opt/ -> "/opt" contains optional third party softwares.
|-- root/ -> "/root" is the home directory of super user.
|-- boot/ -> "/boot" contains all bootable files and the linux
| kernel.
|-- home/ -> "/home" contains home directories of all users.
|-- proc/ -> "/proc" contains virtual file system i.e the linux
| kernel in RAM
|-- tmp/ -> "/tmp" contains temporary files and directories.
| It is like the scratch pad of the system.
| Running apps use this for their temp files
|-- var/ -> "/var" contains variable files. eg. mail boxes of
| users, log files.
`-- usr/ -> "/usr" contains all installation files of linux.
|-- bin/ -> "/usr/bin" contains optional binaries which all users
| can use [3rd party binaries]
|-- sbin/ -> "/usr/sbin" contains optional binaries which only su-
| per user can use [3rd party binaries]
|-- local/ Program Files folder in Windows.
| |
| |-- bin/ -> "/usr/local/bin" contains third party binaries inst-
| | alled after installation, which all users can use.
| |
| `-- sbin/ -> "/usr/local/sbin" contains third party binaries inst-
| alled after installation, which only super user can
| use.
|-- include/ -> "/usr/include" - Mostly C header files, Assembler
|-- src/ -> "/usr/src" contains the source code of the linux
| kernel in a sub directory (linux-2.4.20-8) under it.
|-- lib/ -> "/usr/lib" contains all optional shared objects (.so)
`-- share/
|-- info/ -> "/usr/share/info" contains the Linux manual in HTML
|-- doc/ -> "/usr/share/doc/" contains the Linux Documentation
`-- man/ -> "/usr/share/man" contains the Linux Manual
`-- man1/
`-- man2/
`-- man3/
`-- man4/
`-- man5/
`-- man6/
`-- man7/
`-- man8/
`-- man9/

source :

No comments:

Post a Comment