Sys Admin
Linux Boot Process
• BIOS
• Boot Loaders
• LILO
• GRUB
• initrd
• /boot
• vmlinux or vmlinuz
Booting
• dmesg or /var/log/dmesg
• runlevels and targets
• telinit (init)
• Systemctl(systemd)
• shutdowwn, reboot, poweroff
System Logging
• The syslog standard
• Facilities
• Severities
• Emergency
• Alert
• Critical
• Error
• Warning
• Notice
• Info
System Logging
• Syslog server
• Syslogd
• Rsyslog
• Syslog-ng
• Use logger to generate your own log messages
• Use logrotate to automatically prune messages
Disk Management -
Partitions
• Partitions
• Partition tables
• MBR – Master Boot Record
• GPT GUID Partition Table
• Mount Points
• /- “slash” or the root of the directory tree
• fdisk, gdisk, parted
Disk Management -
Partitions
• mkfs
• mkfs -t TYPE DEVICE
• mkfs -t ext4 /dev/sdb3
• mount
• mount DEVICE MOUNT_POINT
• mount /dev.sdb3 /opt
• df
• umount
• umount /opt OR umount /dev/sdb3
Disk Management – File
System Table
• /etc/fstab
• View UUIDs and labels
• lsblk –f
• blkid
• Creating
• e2label
Managing Users and
Groups
• Account information is stored in
• /etc/passwd and /etc/shadow
• Accounts have the following attributes
• username
• UID
• GID (default group)
• Comment
• home directory
• shell
Managing Users and
Groups
• Create accounts with useradd
• Delete accounts with userdel
• Modify accounts with usermod
Managing Users and
Groups
• Group information is stored in /etc/group
• Create groups with groupadd
• Delete groups with groupdel
• Modify groups with groupmod
• To view group memberships use groups
• groups [ACCOUNT]
• groups
• groups jason
Switching users and sudo
• Use su to switch users
• The whoami command displays your account
name
• The sudo command allows you to run programs as
others
• To switch users with sudo, use sudo –s or sudo
su
• Use visudo to edit the sudoers file
TCP/IP Networking
• TCP/IP
• IP address
• [Link](Example. [Link])
• [Link] -> [Link]
• Subnet mask
• Broadcast address
TCP/IP networking
• Subnet masks
• Class A: [Link]
• Class B: [Link]
• Class C: [Link]
• CIDR – Classless Interdomain Routing
• Private Address Space
• [Link] – [Link]
• [Link] – [Link]
• [Link] -> [Link]
Linux Networking
• Determining your IP address
• ip address
• ifconfig
• Hostnames
• hostname
• hostname -f
• uname -n
Linux Networking
• DNS and name resolution
• host
• dig
• /etc/hosts
• /etc/[Link]
Linux Networking
• DNS and name resolution
• host
• dig
• /etc/hosts
• /etc/[Link]
Linux Networking
• Network ports
• well-know /privileged (1->1023)
• unprivileged (1024->65535)
• DHCP
• Static IP address
• Configuring network interfaces
• RHEL - /etc/sysconfig/network-script/ifcfg-DEVICE
• Ubuntu -/etc/network/interfaces
Linux Network
• ip/ifconfig
• ifup/ifdown
• GUI/TUI tools
• RHEL – nmtui
• Older RHEL - system-config-network
• SUSE - YaST
Jobs and Processes
• ps
• Ctrl-c
• Ctrl-Z
• pg
• fg
• jobs
• kill
Scheduling Jobs with Cron
• The cron service runs scheduled jobs
• Use the crontab command to schedule jobs
Managing Software
• Package
• Package Manager
• RPM
• yum
• rpm
• DEB
• apk
• dpkg
RAID
• RAID (Redundant Array of Independent Disks) is a
technology used to combine multiple physical disks
into a single logical unit for data storage.
• RAID systems offer various levels of redundancy,
performance, and capacity, providing increased
reliability and performance compared to individual
disks.
RAID system
administration
• RAID Levels:
• RAID systems support different RAID levels, each
offering a unique combination of data protection,
performance, and storage capacity.
• Common RAID levels include RAID 0, RAID 1, RAID 5,
RAID 6, RAID 10, and RAID 50, each with its own
advantages and trade-offs.
• RAID administrators need to understand the
characteristics and requirements of each RAID level to
choose the appropriate level for their specific use case.
RAID system
administration
• RAID Configuration:
• RAID configuration involves setting up and managing the
RAID arrays, including selecting the appropriate RAID
level, configuring disk redundancy (if applicable), and
allocating storage capacity.
• RAID configuration tools provided by the operating
system or RAID controller hardware allow administrators
to create, modify, and delete RAID arrays.
• Administrators need to carefully plan and design the
RAID configuration to ensure optimal performance,
reliability, and scalability.
RAID system
administration
• Monitoring and Maintenance:
• RAID administrators are responsible for monitoring the
health and performance of RAID arrays to detect and
prevent potential issues such as disk failures, data
corruption, and performance degradation.
• Monitoring tools provide insights into disk usage, array
status, disk health, and performance metrics, allowing
administrators to proactively address any issues.
• Regular maintenance tasks, such as firmware updates,
disk replacements, and array expansion, help ensure the
reliability and longevity of the RAID system.
RAID system
administration
• Fault Tolerance and Data Recovery:
• RAID systems provide fault tolerance by using
redundancy mechanisms such as mirroring (RAID 1),
parity (RAID 5, RAID 6), or a combination of both (RAID
10) to protect against disk failures.
• RAID administrators need to be prepared to handle disk
failures and data loss scenarios by implementing
appropriate backup and recovery strategies, such as hot
spares, cold spares, or offsite backups.
• In the event of disk failures, administrators must replace
the failed disks promptly and initiate data recovery
procedures to restore data integrity and availability.
RAID system
administration
• Performance Optimization:
• RAID administrators can optimize RAID performance by
fine-tuning various parameters such as stripe size, cache
settings, read/write policies, and I/O scheduling.
• Performance monitoring tools help identify performance
bottlenecks and optimize RAID configurations to
improve throughput, latency, and overall system
performance.
RAID system
administration
• Capacity Planning and Expansion:
• RAID administrators need to plan for future storage
requirements by estimating storage capacity needs,
evaluating disk usage trends, and anticipating data
growth.
• RAID systems support capacity expansion through
techniques such as adding additional disks to existing
arrays, migrating to higher-capacity disks, or creating
new RAID arrays.
• Capacity planning ensures that the RAID system can
accommodate growing data volumes while maintaining
performance and reliability.
Creating RAID in Ubuntu
• Install mdadm utility
• sudo apt-get update
• sudo apt-get install mdadm
• Identify disks
• lsblk
• Partition the disks of the same size
• fdisk or parted
• Create disk array (e.g. of two disks using mdadm)
• sudo mdadm --create /dev/md0 --level
=mirror --raid-device=2 /dev/sdb1
/dev/sdc1
Creating RAID in Ubuntu
• mirror raid array; check the status of RAID
• cat /proc/mdstat
• Format and mount the RAID array
• sudo mkfs.ext4 /dev/md0
• sudo mkdir /mnt/raid
• sudo mount /dev/md0 /mnt/raid
• Automount RAID Array
• /dev/md0 /mnt/raid ext4 defaults 0
2
• Done!!!
Logical Volume Manager
(LVM)
• LVM (Logical Volume Manager) is a disk
management system that allows you to manage
disk drives flexibly and dynamically in Linux.
• It provides features such as creating logical
volumes, resizing them, and moving data between
them without disrupting services
Physical Volumes (PVs)
• Physical volumes are individual storage devices or
partitions that you can add to the LVM system.
• Commands:
• To create a physical volume:
• pvcreate /dev/sdx
• To display information about physical volumes:
• pvdisplay
Volume Groups (VGs)
• Volume groups are created by combining one or
more physical volumes.
• They serve as pools of storage from which logical
volumes are allocated.
• Commands:
• To create a volume group:
• vgcreate vg_name /dev/sdx /dev/sdy
• To display information about volume groups:
• vgdisplay
Logical Volumes (LVs)
• Logical volumes are the partitions that you use like
physical disk partitions.
• They are created from space allocated from volume
groups.
• Commands:
• To create a logical volume:
• lvcreate -L size -n lv_name vg_name
• To display information about logical volumes:
• lvdisplay
Resizing Logical Volumes
• You can resize logical volumes to increase or
decrease their size.
• Commands:
• To extend a logical volume: lvextend -L
+size /dev/vg_name/lv_name
• To shrink a logical volume: lvreduce -L -size
/dev/vg_name/lv_name
Mounting Logical Volumes
• After creating and resizing logical volumes, you can
mount them to access the filesystems stored on
them.
• Commands:
• To format a logical volume:
• mkfs.ext4 /dev/vg_name/lv_name
• To mount a logical volume:
• mount /dev/vg_name/lv_name
/mnt/mount_point
Snapshot Volumes
• LVM allows you to create snapshots of logical
volumes, which are read-only copies of the original
volume.
• They are useful for creating backups or for testing
purposes.
• Commands:
• To create a snapshot:
• lvcreate -L size -s -n snapshot_name
/dev/vg_name/lv_name
• To remove a snapshot:
• lvremove /dev/vg_name/snapshot_name