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, with m for 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:

  1. Partition the Disk.
  2. Format: Use mkfs.<filesystem> on the partition.
  3. Mount: Use mount/umount to attach the partition to the file system tree.
  4. /etc/fstab: Manage persistent mounts, use blkid to find UUIDs.
  5. Scan File Systems: Use fsck to check and repair; requires unmounting.

Automated FS Scanning:

  • /etc/fstab: Configure the pass attribute to control automatic file system checks.
  • tune2fs: Use -l to list and -c to 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/mdstat to check RAID status.

Package Management in Linux

Installing Tarball Files:

  • Extract: Use tar -zxvf.
  • Compile: Configure with ./configure and compile with make.
  • Install: Use make install or move the binary to /usr/local/bin.

Managing .deb Files:

  • Tools: apt, apt-get, aptitude.
  • DPKG: Underlying tool, does not handle dependencies, hence apt is preferred.

RPM (Red Hat Package Manager):

  • Tools: YUM, DNF, RPM.
  • Configuring Repos: Edit /etc/apt/sources.list for Debian/Ubuntu, and /etc/yum.conf for CentOS.

Other Package Managers:

  • Zypper: For openSUSE.
  • Pacman: For Arch Linux.

Comments

Popular posts from this blog

Learning About Linux Server

Exploring Event Handling in JavaScript: From Basics to Async Projects

learning linux 3