0% found this document useful (0 votes)
4 views43 pages

UNIT 4 - Introduction To System Administration

Uploaded by

Serpent
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views43 pages

UNIT 4 - Introduction To System Administration

Uploaded by

Serpent
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

UNIT 4: Introduction To

System Administration
Linux File System
A file system is a structured method of storing and managing data—including
files, directories, and metadata—on your machine. Think of it like a library. If
thousands of books were scattered around, finding one would be hard. But in
an organized structure, like labeled shelves, locating a book becomes easy.

What is the Linux File System


A Linux file system is a set of processes that controls how, where, and when data is stored or
retrieved from storage devices. It manages data systematically on disk drives or partitions, and
each partition in Linux has its own file system because Linux treats everything as a file, including
devices and applications.. Like Windows uses C: and D: drives, Linux uses mount points, but
everything appears under the root / directory. In Linux, everything is treated as a file, including
devices and applications.
Linux File System Structure
The architecture of a file system comprises three layers mentioned below.

1. Logical File System:

The Logical File System acts as the interface between the user applications and the file system itself. It
facilitates essential operations such as opening, reading, and closing files. Essentially, it serves as the
user-friendly front-end, ensuring that applications can interact with the file system in a way that aligns with
user expectations.

2. Virtual File System:

The Virtual File System (VFS) is a crucial layer that enables the concurrent operation of multiple instances
of physical file systems. It provides a standardized interface, allowing different file systems to coexist and
operate simultaneously. This layer abstracts the underlying complexities, ensuring compatibility and
cohesion between various file system implementations.
3. Physical File System:

The Physical File System is responsible for the tangible management and storage of physical memory
blocks on the disk. It handles the low-level details of storing and retrieving data, interacting directly with
the hardware components. This layer ensures the efficient allocation and utilization of physical storage
resources, contributing to the overall performance and reliability of the file system.

Together, these layers form a cohesive architecture, orchestrating the organized and efficient handling of
data in the Linux operating system.
Characteristics of a File System
A file system defines the rules and structures for how data is organized, stored, accessed, and managed
on a storage device.

● Space Management: How the data is stored on a storage device. Pertaining to the memory blocks
and fragmentation practices applied in it.
● Filename: A file system may have certain restrictions to file names such as the name length, the use
of special characters, and case sensitive-ness.
● Directory: The directories/folders may store files in a linear or hierarchical manner while maintaining
an index table of all the files contained in that directory or subdirectory.
● 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.
1) Journaling:
Journaling file systems keep a log called the journal, that keeps track of the changes made to a file
but not yet permanently committed to the disk so that in case of a system failure the lost changes
can be brought back. Journaling works like a checklist:

1. Log changes in the journal.


2. Apply changes to the disk.
3. Mark them as complete.

Journaling can be configured in three different modes, each offering a trade-off between reliability
and performance. The Journal mode is the most reliable as it logs both file data and metadata,
ensuring the highest level of data integrity. However, it is also the slowest mode due to the
extensive logging process. The Ordered mode, on the other hand, logs only the metadata, with the
file data being written before the metadata. This provides a balanced approach between data
safety and system performance. Lastly, the Writeback mode logs only metadata without enforcing
any order between file data and metadata writes. While it is the fastest journaling mode, it is also
the least safe, as it increases the risk of data corruption in the event of a crash.
2) Versioning:
Versioning file systems store previously saved versions of a file, i.e., the copies of a file are stored
based on previous commits to the disk in a minutely or hourly manner to create a backup.

3) Inode:
The index node is the representation of any file or directory based on the parameters - size,
permission, ownership, and location of the file and directory.

Now, we come to part where we discuss the various implementations of the file system in Linux for
disk storage devices.
What is Linux System Administration?
Linux System Administration involves managing the operations of a Linux-based computer
system. System administrators (or sysadmins) are the gatekeepers of the IT infrastructure,
ensuring that all related hardware and software work reliably and securely.

Who is a Linux System Administrator?

A Linux system administrator is someone responsible for maintaining, upgrading, and


managing Linux servers or desktops. Their duties can range from installing and
configuring software, managing user accounts, backing up data, ensuring system
security, and troubleshooting issues.
Key Responsibilities of a Linux System Administrator
These are some of the primary things that a Linux system administrator should know and understand:

1. Linux File Systems

A Linux system administrator should have a solid knowledge and understanding of the various Linux file
systems used by Linux like Ext2, Ext3, and Ext4. Understanding the difference between these file systems
is important so that one can easily perform tasks and partition disks or configure Linux file system
permissions.

2. File System Hierarchy

The Linux File System Hierarchy (FHS) tells us about the location and structure of directories and files on
a Linux system. It is important for managing system files effectively.
3. Managing Root/Super User

The root user is the most powerful user on a Linux System because it has access to all the system files
and directories. So, it is important for maintaining system security.

4. Basic Bash Command

The default shell of Linux is Bash, and it is used for executing commands on the command-line interface.
A Linux system administrator should have a basic understanding of the command of bash to perform
tasks.

5. Handling File, Directories, and Users

Managing files, directories and users is a critical part of Linux system administration. A system
administrator should be able to perform the basic file and directory management tasks.
A System Manager's primary function is to oversee the planning, implementation,
and maintenance of an organization's IT systems and infrastructure. This involves
ensuring systems operate efficiently, securely, and align with business goals. They
lead IT teams, manage budgets, and often play a crucial role in project
management, disaster recovery, and vendor relationships
What are System Calls?

System calls are interfaces provided by the kernel to allow user-space programs (like your C/C++ code)
to request services from the operating system. These services include things like interacting with files,
processes, memory, devices, etc.

You can think of system calls as doorways between your program and the protected area of the OS (the
kernel).
2. C Library Functions (glibc)
🧠 What are Library Functions?

C library functions are pre-written standard functions that make programming easier. They wrap
system calls or implement higher-level functionality. Provided by glibc (GNU C Library) in Linux.
3. Math Library (libm)
🧠 What is libm?

libm is the math library in C, providing advanced mathematical functions not part of the standard C
library. Functions like sqrt, pow, sin, etc., are defined in <math.h>.

These functions are not system calls. They are purely computational and don’t interact with the OS.

You must link the math library explicitly when compiling:


What is the Standard I/O Package?
The Standard I/O Package refers to the C library functionality provided by:

#include <stdio.h>

It includes buffered input/output functions for files, standard streams (stdin, stdout, stderr), and
formatted data handling.

✅ It's built on top of lower-level system calls like read() and write() but adds features like
buffering, formatted input/output, file handling, and error checking.
⚙ How Standard I/O Uses System Calls
While you use high-level functions like printf() or fopen(), under the hood:

● printf() → eventually calls write()

● fopen() → uses open()

● fread() → uses read() internally

Buffered I/O reduces direct system calls for efficiency.


What is the Linux–C Interface?
The Linux–C interface refers to the bridge between C programs and the Linux operating system.
C is the primary language used to develop the Linux kernel itself — and Linux provides a set of
system calls, APIs, and libraries that let C programs interact with the OS.

So, when you write a C program on Linux, you’re directly interacting with:

● the Linux kernel (via system calls),

● the GNU C Library (glibc) (standard library functions),

● and optionally POSIX APIs for portable system-level code.


The Three Main Layers of the Linux–C Interface
1. System Calls (Kernel Interface)

These are low-level functions that directly request services from the Linux kernel.

🛠 Examples:

● open(), read(), write() → File I/O

● fork(), exec() → Process control

● kill(), signal() → Signal handling

● mmap(), brk() → Memory management

These are declared in <unistd.h>, <sys/types.h>, and <sys/stat.h>, and defined in kernel space.
2. C Standard Library (glibc)

This is the wrapper around system calls and also contains buffered, safe, and higher-level functionality.

🧰 Examples:

● printf(), scanf() → Formatted I/O

● fopen(), fread() → File operations (buffered)

● malloc(), free() → Dynamic memory

● strcpy(), strlen() → String handling

These use system calls internally but are easier to use and portable.
3. POSIX API

Linux conforms to the POSIX standard, so many C functions follow POSIX rules — helping your code run
on other Unix-like OSes too (macOS, BSD, etc.)

🧩 POSIX APIs include:

● Threads (pthread_create, pthread_join)

● Semaphores and shared memory

● File descriptor handling

You might also like