- 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.
- Different Types of Filesystem
- Disk filesystems – ext2, ext3, reiserfs, xfs, NTFS, etc.
- Flash filesystems – JFFS2, YAFFS, etc.
- Tape filesystems – LTFS
- Database filesystems
- Transactional filesystems
- Network filesystems – NFS, CIFS, etc.
- Shared disk filesystems – GFS, GPFS, etc.
- 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
- 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)
Partition Disk1 /dev/sda1
FileSystem type NTFS EXT3
Mounting Parameters DriveLetter MountPoint
C drive /
- How to mount any File System?
$ mount -t <filesystem type> <device name> <mount point>
$ mount -t ext3 /dev/sda3 /data
Here if you don’t have to manually give filesystem type. If the Filesystem’s module is loaded in RAM, then it will mount automatically.
- How to find which filesystems are mounted?
$ df -h
- In which file all mounted filesystems gets listed?
- Entries filesystems which will get mounted at boot time
- What is FileSystem Hierarchy?
The Filesystem Hierarchy Standard (FHS) defines the main directories and their contents in Linux operating system
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)
|– 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