Theory Assignment 01
Theory Assignment 01
0
What is file System
Operating systems, the software that powers your computer, rely on a crucial element known as
the file system. Think of it as a virtual organizational tool that manages, stores, and retrieves your
data efficiently. In the Linux world, a diverse range of file systems has emerged, each crafted to
address specific needs and preferences. This article aims to simplify the intricacies of Linux file
systems, guiding beginners through their layers, characteristics, and implementations. By shedding
light on these nuances, we empower users to make informed choices in navigating the dynamic
landscape of Linux operating systems.
1
Metadata: for each file stored, the file system stores various information about that file’s
existence such as its data length, its access permissions, device type, modified date-time,
and other attributes. This is called metadata.
Utilities: file systems provide features for initializing, deleting, renaming, moving,
copying, backup, recovery, and control access of files and folders.
Design: due to their implementations, file systems have limitations on the amount of data
they can store.
2
1. ext (Extended File System):
Implemented in 1992, it is the first file system specifically designed for Linux. It is the first
member of the ext family of file systems.
2. ext2:
The second ext was developed in 1993. It is a non-journaling file system that is preferred to be
used with flash drives and SSDs. It solved the problems of separate timestamp for access, inode
modification and data modification. Due to not being journaled, it is slow to load at boot time.
3. Xiafs:
Also developed in 1993, this file system was less powerful and functional than ext2 and is no
longer in use anywhere.
4. ext3:
The third ext developed in 1999 is a journaling file system. It is reliable and unlike ext2, it prevents
long delays at system boot if the file system is in an inconsistent state after an unclean shutdown.
Other factors that make it better and different than ext2 are online file system growth and HTree
indexing for large directories.
5. JFS (Journaled File System):
First created by IBM in 1990, the original JFS was taken to open source to be implemented for
Linux in 1999. JFS performs well under different kinds of load but is not commonly used anymore
due to the release of ext4 in 2006 which gives better performance.
6. ReiserFS:
It is a journal file system developed in 2001. Despite its earlier issues, it has tail packing as a
scheme to reduce internal fragmentation. It uses a B+ Tree that gives less than linear time in
directory lookups and updates. It was the default file system in SUSE Linux till version 6.4, until
switching to ext3 in 2006 for version 10.2.
7. XFS:
XFS is a 64-bit journaling file system and was ported to Linux in 2001. It now acts as the default
file system for many Linux distributions. It provides features like snapshots, online
defragmentation, sparse files, variable block sizes, and excellent capacity. It also excels at parallel
I/O operations.
3
8. SquashFS:
Developed in 2002, this file system is read-only and is used only with embedded systems where
low overhead is needed.
9. Reiser4:
It is an incremental model to ReiserFS. It was developed in 2004. However, it is not widely adapted
or supported on many Linux distributions.
10. ext4:
The fourth ext developed in 2006, is a journaling file system. It has backward compatibility with
ext3 and ext2 and it provides several other features, some of which are persistent pre-allocation,
unlimited number of subdirectories, metadata checksumming and large file size. ext4 is the default
file system for many Linux distributions and also has compatibility with Windows and Macintosh.
11. btrfs (Better/Butter/B-tree FS):
It was developed in 2007. It provides many features such as snapshotting, drive pooling, data
scrubbing, self-healing and online defragmentation. It is the default file system for Fedora
Workstation.
12. bcachefs:
This is a copy-on-write file system that was first announced in 2015 with the goal of performing
better than btrfs and ext4. Its features include full filesystem encryption, native compression,
snapshots, and 64-bit check summing.
13. Others:
Linux also has support for file systems of operating systems such as NTFS and exFAT, but these
do not support standard Unix permission settings. They are mostly used for interoperability with
other operating systems.
4
considered to be files, according to the system. Linux operating systems use a hierarchical file
system, which means that it is organized from top to bottom (or above and below).
The starting point of the file system is called the root “/” directory, and all other directories stem
from it. Directories above others are called parents or parent directories, while directories below
are called children. Children of children are called grandchildren.
5
Process and Directories in the Linux File System Hierarchy
6
Directory Structure & File System Hierarchy
Primary hierarchy root and root directory of the entire file system
/
hierarchy.
Device
/dev
files (e.g., /dev/null , /dev/disk0 , /dev/sda1 , /dev/tty , /dev/random ).
/etc/sgml Configuration files, such as catalogs, for software that processes SGML.
/etc/xml Configuration files, such as catalogs, for software that processes XML.
/home Users' home directories, containing saved files, personal settings, etc.
7
/lib Libraries essential for the binaries in /bin and /sbin .
Run-time variable data: Information about the running system since last
boot, e.g., currently logged-in users and running daemons. Files under
/run this directory must be either removed or truncated at the beginning of the
boot process, but this is not necessary on systems that provide this
directory as a temporary filesystem (tmpfs).
Site-specific data served by this system, such as data and scripts for web
/srv servers, data offered by FTP servers, and repositories for version control
systems (appeared in FHS-2.3 in 2004).
8
Directory for temporary files (see also /var/tmp ). Often not preserved
/tmp
between system reboots and may be severely size-restricted.
Tertiary hierarchy for local data, specific to this host. Typically has
/usr/local further subdirectories (e.g., bin , lib , share ).
/usr/src Source code (e.g., the kernel source code with its header files).
9
Application cache data. Such data are locally generated as a result of time-
/var/cache consuming I/O or calculation. The application must be able to regenerate
or restore the data. The cached files can be deleted without loss of data.
/var/opt Variable data from add-on packages that are stored in /opt .
/var/run In FHS 3.0, /var/run is replaced by /run ; a system should either continue
Spool for tasks waiting to be processed (e.g., print queues and outgoing
/var/spool
mail queue).
10
Linux File Permission
No matter what you do in IT, even a basic understanding of Linux empowers you with a hidden
asset that can open doors
It's the engine behind so many technologies we use every day!
Let's break down file permissions in Linux, which might sound tricky, but once you know them,
they're super useful.
Here's a simple guide to each part:
11
𝗛𝗼𝘄 𝘁𝗼 𝗰𝗵𝗮𝗻𝗴𝗲 𝗳𝗶𝗹𝗲 𝗽𝗲𝗿𝗺𝗶𝘀𝘀𝗶𝗼𝗻𝘀
To change file permissions, you can use the 𝚌𝚑𝚖𝚘𝚍 command. For example, to change the
permission of the file 𝚖𝚢𝚏𝚒𝚕𝚎 to 755, you would run the following command:
chmod 755 myfile
You can also use the 𝚌𝚑𝚖𝚘𝚍 command to change specific permissions. For example, to add the
execute permission for everyone to the file 𝚖𝚢𝚏𝚒𝚕𝚎, you would run the following command:
chmod +x myfile
12