Linux File System
Now lets co-relate the scenario with a computer. Instead of paper files, in a Computer System
the data or the information required for a program is stored in objects called Computer files or simply files. These files are stored in hard drives and should be made available to the programs when ever required. But who or rather what keeps track on these files? The answer is File System. All operating System whether it is Linux, Unix or Windows make use of a file system to organize files in a computer system. Since this is a Linux blog I am concentrating on Linux Filesystem.
In Linux, Filesystem can mean two things
- Hierarchy of directories used to organize files on a computer system
- Type of filesystem used by the storage media to organize files on an entire disk or a partition
The directory structure and the contents in Unix/*nix operating system are defined by a standard called Filsystem Hierarchy Standard (FHS). The above image represents how directories are arranged in a Unix/*nix operating system. Lets see what are the importance of each directories and what these directories hold.
Directory | Description |
/ | The Root Directory. Primary or first level of entire filesystem hierarchy |
/bin | Contains binary commands available all users (eg: ls, cp) |
/boot | Contains boot loader files required for system boot. (eg : initrd) |
/dev | Contains device files. (eg: /dev/sda, /dev/lp0) |
/etc | Contains host specific system-wide configuration files |
/home | Contains Home Directory of users except root user. A user's home directory contains all the user specific settings and saved files |
/lib | Contains all the library files required by the binary files |
/lost+found | Path where results of file recovery is available |
/media | Path for mounting removable medias like CD-ROM |
/mnt | Path for temporarily mounted filesystem |
/opt | Path for optional software installation.Somewhat similar to C:\Program Files\ in windows |
/proc | Contains run time system information. This is a virtual filesystem |
/root | Home directory of root user. |
/run | Contains information regarding the running system |
/sbin | Contains system binaries used for system maintenance and/or administrative tasks (eg: fdisk) |
/srv | Contains site specific data served by the system |
/sys | Contains plug and play (PnP) configuration files |
/sysroot | the root directory where headers and libraries are located during cross platform compilation |
/tmp | Contains files which are required temporarily. |
/usr | Contains all the user binaries, their documentation, libraries, header files |
/var | Contains variable files. i.e files whose contents are expected to change like log files, mail and printer spool |
For a more detailed understanding of Filesystem Hierarchy Standard go to http://www.pathname.com/fhs/pub/fhs-2.3.pdf
The second meaning refers to the type of filesystem used. Disk File System, Network File System, Shared DIsk File System, Database File System etc are some of the classifications of file system types.
Linux supports many different filesystems. We can configure multiple filesystems in a single linux machine. For example in a windows machine we can create two different partitions and format one partition in FAT32 and the other partition with NTFS. Similarly in Linux we can create two file systems in ext3 and xfs format and mount them under different directories. Filesystems are created at the time of OS installation. We can also make filesystems from inside the OS using mkfs command. Following are the most commonly used Linux Filesystems. Linux supports different filesystems. The most commonly used ones are
- ext2 - Second Extended File System. Simple and old with less features.Data contained in files are saved in blocks.
- ext3 - Third Extended File System. ext3 is ext2 + journaling. Jorunaling improves reliability and eliminates the need to check the file system after an unclean shutdown.
- reiserfs - Like ext3, reiserfs is a journaled filesystem. It is faster and efficient for both small and large files
- xfs - high performing, data consistent journaling filesystem with maximum file size support upto 8 exbibytes.
Comments
Post a Comment