0% found this document useful (0 votes)
75 views28 pages

Welcome To: Disk Management and Run Levels

This document discusses Linux system run levels, the Linux boot process, customizing the message of the day, disk partitioning, logical volume management (LVM), RAID, file system checks, system backups using the dd command, and network file system (NFS). It provides information on the different run levels like 0, 1, 6 and their purposes. It explains the newer Linux boot process using systemd and the roles of BIOS, POST, MBR, GRUB2, kernel, and systemd. Steps are provided for customizing the message of the day, adding disks and creating partitions, using LVM for storage management, different RAID types, and performing file system checks. Methods for system backup using dd and

Uploaded by

pandas
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)
75 views28 pages

Welcome To: Disk Management and Run Levels

This document discusses Linux system run levels, the Linux boot process, customizing the message of the day, disk partitioning, logical volume management (LVM), RAID, file system checks, system backups using the dd command, and network file system (NFS). It provides information on the different run levels like 0, 1, 6 and their purposes. It explains the newer Linux boot process using systemd and the roles of BIOS, POST, MBR, GRUB2, kernel, and systemd. Steps are provided for customizing the message of the day, adding disks and creating partitions, using LVM for storage management, different RAID types, and performing file system checks. Methods for system backup using dd and

Uploaded by

pandas
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/ 28

Welcome To:

Module 8

Disk Management and


Run Levels
System Run Level
• System Run Levels

Main Run level


• 0 Shut down (or halt) the system
• 1 Single-user mode; usually aliased as s or S
• 6 Reboot the system

Other Run levels


• 2 Multiuser mode without networking
• 3 Multiuser mode with networking
• 5 Multiuser mode with networking and GUI.
Linux Boot Process
Linux Boot Process (Newer Versions)

• The boot sequence changes in CentOS/Redhat 7 and above

• systemd is the new service manager in CentOS/RHEL 7 that manages the boot
sequence

• It is backward compatible with SysV init scripts used by previous versions of


RedHat Linux including RHEL 6

• Every system administrator needs to understand the boot process of an OS in


order to troubleshoot effectively
Linux Boot Process (Newer Versions)
BIOS = Basic Input and Output Setting (firmware
interface)
POST = Power-On Self-Test started
MBR = Master Boot Record
Information saved in the first sector of a hard disk that indicates where
the GRUB2 is located so it can be loaded in computer RAM

GRUB2 = Grand Unified Boot Loader v2


Loads Linux kernel
/boot/grub2/grub.cfg

Kernel = Core of Operating System


Loads required drivers from initrd.img
Starts the first OS process (systemd)

Systemd = System Daemon (PID # 1)


It then starts all the required processes
Reads = /etc/systemd/system/default.target to bring the system to the
run-level
Total of 7 run-levels (0 thru 6)
Message of the Day

• Message of the day file location


• /etc/motd

By: Imran Afzal


Customize Message of the Day

• Once again, message of the day is the first


message users will see when they login to the
Linux machine

• Steps:
• Create a new file in /etc/profile.d/motd.sh
• Add desired commands in motd.sh file
• Modify the /etc/ssh/sshd_config file to edit
#PrintMotd yes to PrintMotd no
• Restart sshd service
• systemctl restart sshd.service

By: Imran Afzal


Disk Partition

• Commands for disk partition


• df
• fdisk

By: Imran Afzal


Adding Disk and Creating Partition

• Purpose? = Out of Space, Additional Apps etc.

• Commands for disk partition


• df
• fdisk

By: Imran Afzal


Storage

• Local Storage
• SAN (Storage Area Network)
• NAS (Network Attached Storage)

By: Imran Afzal


Logical Volume Management (LVM)

• LVM allows disks to be combined together

C:
D:
E:

By: Imran Afzal


LVM Configuration During Install

• Install Linux CentOS with LVM configuration

By: Imran Afzal


Add Disk and Create LVM Partition

By: Imran Afzal


Add and Extend Disk using LVM

/oracle = 1.0G
/oracle = Full

Few Options:
• Delete older files to free up disk space
• Add new physical disk mount to /oracle2
• Create a new virtual disk and mount to /oracle2
• Or extend /oracle through LVM.

By: Imran Afzal


Add/Extend Swap Space
• What is swap? – CentOS.org
Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs
more memory resources and the RAM is full, inactive pages in memory are moved to the swap
space. While swap space can help machines with a small amount of RAM, it should not be
considered a replacement for more RAM. Swap space is located on hard drives, which have a
slower access time than physical memory

• Recommended swap size = Twice the size of RAM


M = Amount of RAM in GB, and S = Amount of swap in GB, then

If M < 2
then S = M *2
Else S=M+2

• Commands
• dd
• mkswap
• swapon or swapoff By: Imran Afzal
RAID
• RAID (Redundant Array of Independent Disks)

• Type of RAID
• RAID0
• RAID1
• RAID5

5 5 5 5 5 5 5
+ 5+5=10G = 5,5=5G + + 5+5+5=12G
= =

RAID0 RAID1 RAID5


By: Imran Afzal
File System Check (fsck and xfs_repair)

• Linux fsck utility is used to check and repair Linux


filesystems (ext2, ext3, ext4, etc.)
• Linux xfs_repair utility is used to check and repair Linux
filesystems for xfs filesystem type
• Depending on when was the last time a file system was
checked, the system runs the fsck during boot time to
check whether the filesystem is in consistent state
• System administrator could also run it manually when
there is a problem with the filesystems
• Make sure to execute the fsck on an unmounted file
systems to avoid any data corruption issues.
By: Imran Afzal
File System Check (fsck and xfs_repair)…
• Force a filesystem check even if it’s clean using option –f
• Attempt to fix detected problems automatically using option -y
• The xfs_repair utility is highly scalable and is designed to repair even
very large file systems with many inodes efficiently. Unlike other Linux
file systems, xfs_repair does not run at boot time
• The following are the possible exit codes for fsck command

By: Imran Afzal


System Backup (dd Command)
5 Different Types of Backups
1. System backup (entire image using tools such as acronis, Veeam, Commvault
etc.)
2. Application backup (3rd party application backup solution)
3. Database backup (Oracle dataguard, SQL backup etc.)
4. Filesystem backup (tar, gzip directoris etc.)
5. Disk backup or disk cloning (dd command)

• dd is a command-line utility for Unix and Unix-like operating systems whose primary
purpose is to convert and copy files
• As a result, dd can be used for tasks such as backing up the boot sector of a hard
drive, and obtaining a fixed amount of random data
• Please note the source and destination disk should be the same size
By: Imran Afzal
System Backup (dd Command)…
• To backup or clone an entire hard disk to another hard disk connected to the
same system, execute the dd command as shown

# dd if=<source file name> of=<target file name> [Options]


# dd if=/dev/sda of=/dev/sdb

• To backup/copy the disk partition


# dd if =/dev/sda1 of=/root/sda1.img

• Restoring this image file to other machine after copying the .img
# dd if=/root/sda1.img of=/dev/sdb3

By: Imran Afzal


Network File System (NFS)
• NFS stands for Network File System, a file system developed by Sun
Microsystems, Inc.
• It is a client/server system that allows users to access files across a network and
treat them as if they resided in a local file directory
• For example, if you were using a computer linked to a second computer via
NFS, you could access files on the second computer as if they resided in a
directory on the first computer. This is accomplished through the processes of
exporting (the process by which an NFS server provides remote clients with
access to its files) and mounting (the process by which client map NFS shared
filesystem)
Approved

NFS Request
Server Client
Network File System (NFS)…
Steps for NFS Server Configuration

• Install NFS packages


# yum install nfs-utils libnfsidmap (most likely they are installed)
• Once the packages are installed, enable and start NFS services
# systemctl enable rpcbind
# systemctl enable nfs-server
# systemctl start rpcbind, nfs-server, rpc-statd, nfs-idmapd
• Create NFS share directory and assign permissions
# mkdir /mypretzels Read/write all changes to the according filesystem are
immediately flushed to disk; the respective
# chmod a+rwx /mypretzels write operations are being waited for
• Modify /etc/exports file to add new shared filesystem
# /mypretzels 192.168.12.7(rw,sync,no_root_squash) = for only 1 host

# /mypretzels *(rw,sync,no_root_squash) = for everyone


• Export the NFS filesystem root on the client machine will have the same
NFS share IP address of level of access to the files on the system as root
# exportfs -rv client machine on the server.
Network File System (NFS)…
Steps for NFS Client Configuration
• Install NFS packages
# yum install nfs-utils rpcbind
• Once the packages are installed enable and start rpcbind service
# systemctl rpcbind start
• Make sure firewalld or iptables stopped (if running)
# ps –ef | egrep “firewall|iptable”
• Show mount from the NFS server
# showmount -e 192.168.1.5 (NFS Server IP)
• Create a mount point
# mkdir /mnt/kramer
• Mount the NFS filesystem
# mount 192.168.1.5:/mypretzels /mnt/kramer
• Verify mounted filesystem
# df –h
• To unmount
# umount /mnt/kramer
Samba
• Samba is a Linux tool or utility that allows sharing for Linux resources such as
files and printers to with other operating systems

• It works exactly like NFS but the difference is NFS shares within Linux or Unix
like system whereas Samba shares with other OS (e.g. Windows, MAC etc.)

• For example, computer “A” shares its filesystem with computer “B” using Samba
then computer “B” will see that shared filesystem as if it is mounted as the local
filesystem
Approved

mount request
Server Client
Samba (smb vs. CIFS)
• Samba shares its filesystem through a protocol called SMB (Server Message
Block) which was invented by IBM

• Another protocol used to share Samba is through CIFS (Common Internet File
System) invented by Microsoft and NMB (NetBios Named Server)

• CIFS became the extension of SMB and now Microsoft has introduced newer
version of SMB v2 and v3 that are mostly used in the industry

• In simple term, most people, when they use either SMB or CIFS, are talking
about the same exact thing
Samba Installation and Configuration
• Take snapshot of your VM
• Install samba packages
• Enable samba to be allowed through firewall (Only if you have firewall running)
• Disable firewall
• Create Samba share directory and assign permissions
• Also change the SELinux security context for the samba shared directory
• Or disable SELinux
• Modify /etc/samba/smb.conf file to add new shared filesystem
• Verify the setting
• Once the packages are installed, enable and start Samba services (smb and nmb)
• Mount Samba share on Windows client
• Mount Samba share on Linux client
• Additional instructions on creating secure Samba share.
Difference Between CentOS/RHEL 7 and 8
• Red Hat Enterprise Linux 8 (RHEL 8) is now available for production use with lots of
developer-friendly capabilities
• RHEL 8 official release by Red Hat Inc, was announced on May 7, 2019
• I will cover only what is changed and what you should in terms of my Linux course

RHEL 8 RHEL 7
General Availability Date 14-Nov-18 10-Jun-14
Code Name Ootpa Maipo
Kernel Version 4.18 3.10.0-123
End of Support May-2029 30-Jun-2024
Last Minor Release 8.x 7.7
Network Time Synchronization Only Chrony Chrony and ntpd
GUI Interface (Desktop) Gnome 3.28 Gnome 3
MySQL 8.0, MariaDB 10.3,
Default Database PostgreSQL 10 and 9.6, and MariaDB
Redis 5.0
Difference Between CentOS/RHEL 7 and 8

RHEL 8 RHEL 7
Firewalld, it uses nftables Firewalld, it uses Iptables
Default Firewall
framework in the backend framework in the backend

Max Supported (Individual)


XFS= 1024TB XFS= 500TB
File & Filesystem Size

By default only YUM and


By default both are installed,
Package Management DNF can be installed from
YUM symbolic link to DNF
the Extra repo
24 TB on x86_64 12 TB on x86_64
Max. RAM Supported
architecture architecture

You might also like