0% found this document useful (0 votes)
9 views44 pages

03 Bootdisk Virtual Box and Partition

This document provides an overview of Linux systems administration, focusing on package management, software compilation, and disk partitioning. It explains the differences between Red Hat and Debian package managers, the importance of software dependencies, and the types of partitions (MBR and GPT) used in storage management. Additionally, it covers file systems, mounting disks, and the advantages of compiling software from source code.
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)
9 views44 pages

03 Bootdisk Virtual Box and Partition

This document provides an overview of Linux systems administration, focusing on package management, software compilation, and disk partitioning. It explains the differences between Red Hat and Debian package managers, the importance of software dependencies, and the types of partitions (MBR and GPT) used in storage management. Additionally, it covers file systems, mounting disks, and the advantages of compiling software from source code.
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/ 44

Systems & Network Administration

CT106-3-2 (Version VE1)

Chapter 03
Introduction to Linux and Systems Administration

Bootdisk Virtual Box and Partition


Boot Disk
Package Management and Compiling Source Code

Package managers install,


maintain, and remove pre-
compiled software
• Easy to manage and works on most
hardware
Compiling software converts the
human-readable source code to
a machine-readable language
• Easy to understand and modify the
code making up an application

Module Code & Module Title Slide Title SLIDE 3


Software Lifecycle and Repositories

• Precompiled code
– Software is provided as ready-to-run binaries, eliminating the need for manual compilation.
• Complete application and supporting files
– Packages include all necessary components for the software to function properly.
• Includes documentation
– Manuals and guides are provided to help users install and use the software
• Assembled for specific package managers
– Software is packaged for compatibility with either Red Hat (RPM) or Debian-based (DEB) systems
• Stored in repositories
– Packages are kept in online storage locations, allowing secure and easy installation via package
managers

Module Code & Module Title Slide Title SLIDE 4


Linux Distributions (distro) Family
Package Managers
Red Hat Package Managers Debian Package Managers
– The Red Hat package manager is – Debian package manager is
called "RPM" (Red Hat Package primarily "dpkg" (Debian Package),
Manager), with the user-friendly interface
– RPM(.rpm) files is used for Red Hat being managed by "apt" (Advanced
distributions like Fedora and CentOS Package Tool) on Debian-based
– Red Hat primarily uses primary tools systems;
such as Yellow Dog Update manager – Dpkg(.deb) files is used for Debian
"yum" or Dandified YUM "dnf" on top and Ubuntu
of RPM for package management – Debian uses "apt" on top of dpkg.
– RPM often has a more centralized – Dpkg relies on external tools like
approach to managing dependencies apt for more complex dependency
within the package itself resolution.

Module Code & Module Title Slide Title SLIDE 6


Software Dependencies

• Some software requires other supporting software to function


• Package managers will alert you to missing dependencies
• Package managers may automatically install dependencies
along with the specified software
• Runtime: The environment and resources required for a
program to run, including libraries, configuration files, and
system resources. These are needed when the program is
executing.

• Package: A bundle of files containing the software, its


dependencies, and configurations. Packages are used for easy
installation, upgrading, or removal of software.

• Built Dependency: Compilers (gcc, g++, C++) Libraries (libssl-


dev, libcurl-dev) or build tools (make, cmake, autoconf) needed
to build (compile) a program from source code. These are
required during the compilation process but not needed once
the program is running.

Module Code & Module Title Slide Title SLIDE 7


Red Hat Package Managers

• Red Hat-based distributions use package managers to handle software


installation, updates, and removal. The main package managers for Red Hat
systems include:
– RPM (Red Hat Package Manager) – The core package management system that installs, updates,
and removes .rpm packages. It handles individual package files but does not resolve dependencies
automatically.
– YUM (Yellowdog Updater, Modified) – A higher-level package manager that works with RPM,
automatically resolving dependencies and managing repositories. Used in older Red Hat-based
systems like CentOS 7 and RHEL 7.
– DNF (Dandified YUM) – The modern replacement for YUM, offering better performance, improved
dependency resolution, and lower memory usage. It is the default package manager in RHEL 8,
CentOS 8, Fedora, and newer Red Hat-based distributions.

Module Code & Module Title Slide Title SLIDE 8


Reasons for Repositories

• Package storage location


• Referenced by package managers for
installing and updating software
• Administrators configure authorized
repositories

Module Code & Module Title Slide Title SLIDE 9


Why Compile Software?
Compiling from source code allows:
• Transparency of application features for security
• Enable or disable features
• Customization or further extension of application capabilities
GNU Compiler Collection (GCC) – common Linux compiler
Example, we have compiled a C program demo.c and saved it an executable called demo.

Module Code & Module Title Slide Title SLIDE 10


The Process of Compiling Software
tar is the command used to extract the
contents.
1. Unpack the download with tar -x tells tar to extract the files.
-v stands for verbose mode, which
• tar -xvf wget-1.21.1.tar.gz shows the files being extracted.
-f specifies the filename of the archive
2. Change to the created directory you want to unpack.

• cd wget-1.21.1
3. Run ./configure to create the makefile
• ./configure
4. Run make to execute the instructions in the makefile
• make
5. Run make install to install the software
• sudo make install

Module Code & Module Title Slide Title SLIDE 11


Understand Storage

• Hard disk drive(HDD) -spinning magnetic disks,


usually inexpensive, large, and relatively slow
• Solid-state disk (SSD) - Flash memory storage,
usually expensive, fast, small, less long-lived
• Optical Drive (CD/DVD) - Hardware device that
reads and writes data to and from optical discs
• Universal Serial Bus (USB) - Connection
protocol for various external devices, including
storages devices
• Thumb drive - Removeable storage media,
usually connects via USB
• External - removable storage disk, usually
connects via USB

Module Code & Module Title Slide Title SLIDE 12


Module Code & Module Title Slide Title SLIDE 13
Storage Interfaces
• SATA (Serial ATA): Common in desktops and laptops; connects hard drives and SSDs.
Speeds up to 6 Gb/s.
• SCSI (Small Computer System Interface): Connects devices for high-speed data transfer,
evolving from parallel to serial for better performance. Speeds vary by version, ranging
from 5 MB/s in older parallel SCSI to 128 Gb/s in modern Fiber Channel and SAS
interfaces
• SAS (Serial Attached SCSI): Used in enterprise storage, offering higher performance and
scalability than SATA. Speeds range from 3 Gb/s to 12 Gb/s.
• IDE/PATA (Parallel ATA): Older interface, largely replaced by SATA, with speeds up to
133 MB/s.
• USB (Universal Serial Bus): Used for external storage devices like flash drives and
external SSDs. Speeds range from 480 Mbps (USB 2.0) to 40 Gb/s (USB 4.0).
• eSATA: External SATA for external storage, with speeds up to 6 Gb/s, but lacks power
delivery.
Module Code & Module Title Slide Title SLIDE 14
What is Partitioning

Module Code & Module Title Slide Title SLIDE 15


Disk Partition

• A partition separates a disk into


logical “drives”
• A “DOS” (32-bit OS) partition
can be one of two types:
– Primary : can hold information
regarding the operating system
which is required for booting.
– Extended: only for data files

Module Code & Module Title Slide Title SLIDE 16


Types of Partitions
Features MBR(Master Boot Record) GPT(GUID Partition Table)
System It supports ROM-BIOS(Basic Input-Output It supports UEFI(Unified Extensible Firmware
Architecture System). Interface)
Maximum Size It allows 2.2TB of partition size. It has no such limit for Partition, can be
extended to 2^64 logical blocks in length, and
logical blocks could be 512 bytes or 4K in size.
Partition It is limited to 4 partitions, which includes The limit for GPT depends upon operating
3 primary and 1 extended partition system whereas, Windows allows up-to 128
partitions in GPT.

Data In MBR, no backup formed to retrieve data. In this, it is automatically repaired through
Redundancy Any data redundancy cannot be altered. CRC (Cyclic Redundancy Check).
Versions All the operating system versions support All versions of operating systems support GPT,
support MBR. but their 64 -bit versions should allow booting
from GPT disk when UEFI mode is enabled.

Module Code & Module Title Slide Title SLIDE 17


Types of Partitions

Module Code & Module Title Slide Title SLIDE 18


Installation and Associated Commands

Module Code & Module Title Slide Title SLIDE 19


Installation and Associated Commands

Module Code & Module Title Slide Title SLIDE 20


Installation and Associated Commands

Module Code & Module Title Slide Title SLIDE 21


Disk partitioning

Module Code & Module Title Slide Title SLIDE 22


File Systems
File File Size Partition
• Structures disk area for addressable access System Limit Size Limit Key Features
– “like painting car spaces in a carpark” ext 2 GB 2 GB Basic file system, obsolete
No journaling, widely used
ext2 2 TB 2 TB early
• Usually unique to OS
Journaling, backward
windows: FAT, FAT32, NTFS ext3 16 TB 16 TB compatible with ext2
linux: ext, ext2, ext3, ext4, Faster, larger file support,
linux is one huge computer science project! ext4 16 TB 1 Exabyte extents, delayed allocation

• Physical sectors grouped into allocation units


called blocks in Unix and clusters in Windows

• Building File System - mkfs or format


boot sector, data area, free list

FAT- file allocation table


NTFS - New Technology File System
EXT - Extended File System

Module Code & Module Title Slide Title SLIDE 23


Windows File Systems
FAT32 NTFS
Maximum file size 4 GB Supports Exabyte size files
Max partition size 2 TB and partitions
Provides only Folder-level File-level and Folder-level
security security
3 permissions: Read, 6 standard plus “advanced”
Change, Full Control permission combinations
Data compression support
FAT32 is Encrypted File System support
common on Disk quota management New Technology File System is a proprietary
USB drives journaling file system developed by Microsoft. Starting
with Windows NT 3.1, it is the default file system of
the Windows NT family. It superseded File Allocation
Table as the preferred filesystem on Windows and is
supported in Linux and BSD as well.

Module Code & Module Title Slide Title SLIDE 24


Linux File Systems

Allowable
Maximum Maximum
File characters in Maximum Maximum
filename MBR pathname
system directory file size volume size
length length
entries

Any byte
No limit
ext3 255 bytes 0x83 except NUL 2 TB 32 TB
defined
and /

Any byte
No limit
ext4 255 bytes 0x83 except NUL 16 TB 1 EB
defined
and /

• Most of the Linux is using ext* family

Module Code & Module Title Slide Title SLIDE 25


Mounting Disks / Partitions

• Naming conventions for devices


– Disk:/dev/sda /dev/sda1 …
(usb will be recognised as this)
– CD/USB: /dev/sr0 …
• Sudo mount /dev/sda1 /mnt/sda1
access everything on the drive through the directory instructions in /etc/fstab
– Linux system's filesystem table, aka fstab , is a configuration table designed to ease the burden
of mounting and unmounting file systems
• Sudo umount /mnt/hostshare
– cannot unmount a busy filesystem
– show open files on a filesystem: lsof
• Lsof, or "list open files", is a command in Linux and other Unix-like
systems that lists open files and the processes that are using them.

Module Code & Module Title Slide Title SLIDE 26


Mounting Disks / Partitions

Module Code & Module Title Slide Title SLIDE 27


Mounting Disks / Partitions

Module Code & Module Title Slide Title SLIDE 28


What is Master Boot Record?

• The MBR partitioning scheme has a long


history dating back to the early 1980s. It
was introduced as the standard partitioning
method for IBM-compatible PCs.
• MBR became widely adopted due to its
simplicity and compatibility with various
operating systems, including Windows,
Linux, and macOS.
• It stores essential partitioning information
in a single 512-byte sector at the beginning
of the storage drive.
• The MBR partition table consists of four
primary or three primary and one extended
partition that can be further divided into
logical ones.

Module Code & Module Title Slide Title SLIDE 29


MBR

Module Code & Module Title Slide Title SLIDE 30


What is GUID Partition Table?

• A globally unique identifier (GUID) is a 128-bit identifier that is globally unique


and generated using an algorithm. It's a string of characters that distinguishes one
entity from another. In the realm of technology and computing, GUIDs find
extensive use, especially in scenarios where a unique identifier is crucial.
• The GUID Partition Table (GPT) partitioning scheme emerged in the late 1990s as
a modern alternative to the MBR.
• It was developed as part of the Unified Extensible Firmware Interface (UEFI)
specification. It utilizes a 64-bit partitioning scheme and stores partition
information in a series of data structures spread across the storage drive.
• GPT includes a protective MBR for compatibility with older systems, but the main
partitioning information resides in the GPT data structures.

Module Code & Module Title Slide Title SLIDE 31


MBR vs GPT

Module Code & Module Title Slide Title SLIDE 32


BIOS vs UEFI

Module Code & Module Title Slide Title SLIDE 33


BIOS vs UEFI

• Old PC uses MBR partitioning to boot up windows. • Now modern Operating system use GPT partition which is lot
• This sector contains a boot loader for the installed operating more faster than traditional MBR partition.
system and information about the drive’s logical partitions. • GPT uses UEFI (UNIFIED EXTENDED FIRMWARE INTERFACE)
• The boot loader is a small bit of code that generally loads the to boot up windows. On an MBR disk, the partitioning and
larger boot loader from another partition on a drive. If you boot data is stored in one place. If this data is overwritten or
have Windows installed, the initial bits of the Windows boot corrupted, you’re in trouble. In contrast, GPT stores multiple
loader reside here—that’s why you may have to repair your copies of this data across the disk, so it’s much more robust
MBR if it’s overwritten and Windows won’t start. If you have and can recover if the data is corrupted.
Linux installed, the GRUB boot loader will typically be located
in the MBR. GPT also stores cyclic redundancy check (CRC) values to
check that its data is intact. If the data is corrupted, GPT can
Limitation: notice the problem and attempt to recover the damaged data
MBR only works with disks up to 2 TB in size. MBR also only from another location on the disk. MBR had no way of
supports up to four primary partitions—if you want more, you knowing if its data was corrupted—you’d only see there was
have to make one of your primary partitions an “extended a problem when the boot process failed or your drive’s
partition” and create logical partitions inside it. partitions vanished

Module Code & Module Title Slide Title SLIDE 34


Virtual Memory and Swap Space

Module Code & Module Title Slide Title SLIDE 35


Swap Space

Module Code & Module Title Slide Title SLIDE 36


Manage the Linux Kernel

Module Code & Module Title Slide Title SLIDE 37


What are Kernel Modules?

• A Linux Kernel module is a code segment that can be loaded and unloaded into
the Linux kernel to extend its functionality. Modules are used to add support for
new filesystems, hardware, and system calls.
• Extends kernel functionality
• Dynamically or manually loaded and unloaded
• Reduce the burden on the kernel because otherwise all of the modules’
functionality would have to be added directly to the kernel.
• Dynamic loading of kernel modules facilitates lower memory consumption.
• Avoid having to rebuild and reboot the system when new functionality is
required.

Module Code & Module Title Slide Title SLIDE 38


Kernel Module Commands

Module Code & Module Title Slide Title SLIDE 39


What is a Kernel Panic?

Module Code & Module Title Slide Title SLIDE 40


GRUB (GRand Unified Bootloader)

• GRUB (GRand Unified Bootloader) is a boot loader package developed to support multiple operating
systems and allow the user to select among them during boot-up.
• GRUB versions
• GRUB was created by Erich Stefan Boleyn and has been further developed under the GNU project as GNU
GRUB. The original package is still available for download but no longer being developed.
• GRUB2 has replaced what was formerly known as GRUB (i.e. version 0.9x), which has, in turn, become GRUB
Legacy. Enhancements to GRUB2 are still being made, but the current released versions are quite usable for
normal operation.
• How does GRUB work?
• When a computer boots, the BIOS transfers control to the first boot device, which can be a hard disk, a
floppy disk, a CD-ROM, or any other BIOS-recognized device.

Module Code & Module Title Slide Title SLIDE 41


The Boot Process Summarized
In Linux systems, initrd (initial ramdisk) is a scheme for loading a temporary root
file system into memory, to be used as part of the Linux startup process. initrd and
initramfs (from INITial RAM File System) refer to two different methods of
• The boot process is repeated each achieving this.

time your computer starts by


loading the operating system
from a storage device. It involves
a series of sequential steps,
including: BIOS/UEFI
initialization, boot loader, kernel
and initrd/initramfs initialization,
and boot scripts. The following is
an example boot process that
uses an initrd image.

Module Code & Module Title Slide Title SLIDE 42


Continue
1. The processor checks for the BIOS/UEFI firmware and executes it. 7. The kernel mounts the main root partition and releases unused
2. BIOS/UEFI checks for bootable media from internal storage memory. The systemd program runs to set up the user environment.
devices or peripherals like USB flash drives and DVD-ROMs. It It becomes process ID 1.
locates a valid device to boot the system. 8. The systemd program searches for the default.target file, which
3. BIOS/UEFI loads the primary boot loader (probably GRUB2) from contains details about the services to start. It mounts the file
the MBR/GPT partition into memory. It also loads the partition table system based on the /etc/fstab file or .mount files and begins the
along with it. process of starting services. On most systems, the selection is either
4. GRUB2 prompts the user to select an operating system to boot. If multi-user.target or graphical.target.
the user does not respond, then the default operating system is 9. If graphical mode is selected, then a display manager starts and
booted. the login window is displayed on the screen.
5. The boot loader determines the kernel and locates the 10. The user enters a user name and password to log in to the
corresponding kernel binary. It then uploads the respective initrd system.
image into memory and transfers control of the boot process to the 11. The system authenticates the user. If the user is valid, then
kernel. various profile files are executed.
6. The kernel configures the available hardware drivers, including 12. The shell starts, and the system is ready for the user.
processors, I/O subsystems, and storage devices. It decompresses
the initrd image and mounts it to load the necessary drivers. If the
system implemented any virtual devices, such as LVM or software
RAID, then they are initialized.

Module Code & Module Title Slide Title SLIDE 43


Thank you

Module Code & Module Title Slide Title SLIDE 44

You might also like