Learning Linux 2
Understanding Partitioning: GPT vs. MBR
GPT (GUID Partition Table):
- Protective MBR: GPT disks include a protective MBR to ensure compatibility with older systems.
- Data Integrity: GPT scatters copies of its partition table across the disk to prevent data loss in case of corruption.
- Unlimited Disk Space: Supports disks larger than 2TB.
MBR (Master Boot Record):
- Limited Disk Space: Only supports disks up to 2TB.
- Partition Information: The MBR holds details about how the disk is partitioned.
Linux File System Basics
File System Mount Points:
- Root Directory:
/ - Second Drive:
/mnt - Remote NFS/Samba:
/home/ - USB Drive:
/media/ - Virtual Environment:
/proc,/sys
Creating Partitions:
- Tools:
lsblk: Displays the partition tree.cat /proc/partitions: Shows partition details.parted/gparted: GUI (gparted) and CLI (parted) tools for partition management.fdisk: CLI tool for managing partitions, withmfor help.
Formatting and Mounting File Systems
File System Types:
- Linux:
- ext: Extensible file system.
- XFS: High-performance file system.
- Btrfs: Advanced file system with features like snapshots and self-healing.
- Windows:
- NTFS: Default for Windows.
- VFAT/FAT32: Older file systems for compatibility.
Steps to Format and Mount:
- Partition the Disk.
- Format: Use
mkfs.<filesystem>on the partition. - Mount: Use
mount/umountto attach the partition to the file system tree. /etc/fstab: Manage persistent mounts, useblkidto find UUIDs.- Scan File Systems: Use
fsckto check and repair; requires unmounting.
Automated FS Scanning:
/etc/fstab: Configure thepassattribute to control automatic file system checks.tune2fs: Use-lto list and-cto change the maximum mount count.
LVM (Logical Volume Manager)
Components:
- Physical Volume (PV): Combines storage into a single pool.
- Volume Group (VG): A bucket of storage, divided into logical volumes.
- Logical Volume (LV): The slice of storage that is formatted and mounted.
Creating an LVM:
pvcreate: Initialize physical volumes.vgcreate: Create volume groups.lvcreate: Create logical volumes.
RAID (Redundant Array of Independent Disks)
RAID Levels:
- RAID 0: Striping without redundancy, faster but risky.
- RAID 1: Mirroring, provides redundancy at the cost of storage efficiency.
- RAID 5: Striping with parity, requires a minimum of 3 disks, balances redundancy and storage efficiency.
Configuring RAID:
- Configuration File:
/etc/mdadm/mdadm.conf. - Monitor: Use
/proc/mdstatto check RAID status.
Package Management in Linux
Installing Tarball Files:
- Extract: Use
tar -zxvf. - Compile: Configure with
./configureand compile withmake. - Install: Use
make installor move the binary to/usr/local/bin.
Managing .deb Files:
- Tools:
apt,apt-get,aptitude. - DPKG: Underlying tool, does not handle dependencies, hence
aptis preferred.
RPM (Red Hat Package Manager):
- Tools:
YUM,DNF,RPM. - Configuring Repos: Edit
/etc/apt/sources.listfor Debian/Ubuntu, and/etc/yum.conffor CentOS.
Other Package Managers:
- Zypper: For openSUSE.
- Pacman: For Arch Linux.
Comments
Post a Comment