loading...

Linux Storage Overview

Linux Storage Overview

Understanding the various storage options and configurations in Linux environments.

Storage Devices

Basic hardware that stores data.

Hard Disk Drives (HDDs)

Magnetic storage with large capacity and lower speed.

Solid State Drives (SSDs)

Faster than HDDs with no moving parts but more expensive.

USB Flash Drives

Portable storage devices with a USB interface.

Network Attached Storage (NAS)

Remotely accessible storage connected to a network.

Optical Drives

Devices that use lasers to read/write data on CDs, DVDs, etc.

File Systems

How data is logically organized and managed on storage devices.

ext4

A widely-used journaling file system in Linux.

XFS

High-performance file system optimized for large data transfers.

Btrfs

A modern file system with advanced features like snapshots.

NTFS

Common in Windows environments but can be mounted on Linux.

FAT32

Older file system with broad compatibility but size limitations.

Partitioning

Dividing storage devices into isolated sections.

MBR

The Master Boot Record, an older partitioning scheme.

GPT

The GUID Partition Table, a modern partitioning scheme.

SWAP

A dedicated partition for extending RAM virtually.

LVM

Logical Volume Management for flexible disk management.

Mounting

Attaching file systems to the directory tree.

/etc/fstab

A configuration file to automate filesystem mounting.

mount Command

A command to manually mount file systems.

umount Command

To unmount previously mounted file systems.

Mount Points

Directories where file systems are mounted.

Storage Management Tools

Software for configuring and monitoring storage.

fdisk

A command-line utility for disk partitioning.

gparted

A graphical tool for managing disk partitions.

dd

A command for low-level copying and conversion of raw data.

lsblk

Displays information about all available block devices.

LVM Tools

A suite of commands for managing logical volumes.

Network Storage Protocols

Methods for accessing storage over a network.

NFS

Network File System for sharing files over a network.

SAMBA/CIFS

Provides file and print services for various clients including Windows.

iSCSI

Internet Small Computer Systems Interface for linking data storage.

FTP/SFTP

File transfer protocols for moving files between systems.

SMB

Server Message Block, primarily used in Windows networks.

RAID Levels

RAID Components

RAID Benefits

RAID Drawbacks

mdadm

The Linux utility to create, manage, and monitor RAID devices

lsblk

Lists block devices along with their associated partitions and RAID membership

parted / fdisk

Partition table editors for preparing disks for RAID arrays

/proc/mdstat

File that contains the current status of RAID arrays and their components

Creating a RAID Array

mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1

Adding a New Disk to an Array

mdadm --add /dev/md0 /dev/sdc1

Removing a Disk from an Array

mdadm /dev/md0 --fail /dev/sdb1
mdadm /dev/md0 --remove /dev/sdb1

Monitoring a RAID Array

cat /proc/mdstat
mdadm --detail /dev/md0

Marking a Disk as Failed

mdadm --manage /dev/md0 --fail /dev/sdx

Removing a Failed Disk

mdadm --manage /dev/md0 --remove /dev/sdx

Adding a Replacement Disk

mdadm --manage /dev/md0 --add /dev/sdy

Initiating a RAID Rebuild

echo 'check' > /sys/block/md0/md/sync_action

Viewing RAID Configuration Details

mdadm --detail /dev/md0

Changing RAID Level

mdadm --grow /dev/md0 --level=5

Saving RAID Configuration

mdadm --detail --scan >> /etc/mdadm/mdadm.conf

RAID Array Backup

dd if=/dev/md0 of=/path/to/backup.img bs=512

Scanning for New Disks

rescan-scsi-bus.sh

Stopping an Active RAID Array

mdadm --stop /dev/md0

Assembling RAID Array Manually

mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1

Check and Repair RAID Array

fsck.ext4 -cDfty -C 0 /dev/md0

Tmux Overview

Tmux is a terminal multiplexer that enables a number of terminals to be created, accessed, and controlled from a single screen.

What is Tmux?

Tmux stands for "terminal multiplexer," allowing users to switch between several programs in one terminal, detach them, and reattach them to a different terminal.

Multiplexing Terminals

Allows multiple terminal sessions within a single window.

Detach and Reattach Sessions

Sessions can be detached from a terminal and continue running in the background, then later reattached.

Persistent Sessions

Sessions remain active even when the user disconnects from the system.

Core Features

Key functionalities that make tmux a powerful tool for developers and system administrators.

Session Management

Create, destroy, detach, switch between, and list sessions.

Window Management

Organize multiple windows within a session, with each window containing one or more panes.

Pane Management

Split windows into panes, resize and navigate between them.

Customization

Tmux is highly customizable through a config file, allowing users to define key bindings and appearance.

Scriptability

Allows automation of tasks by scripting tmux commands.

Getting Started with Tmux

Basic commands and actions to start using tmux.

Installation

Install tmux on various systems using package managers like apt, yum, or homebrew.

Starting a New Session

Create a new session using tmux new -s session_name.

Basic Navigation

Learn how to switch between panes and windows, and how to detach and reattach to sessions.

Default Key Bindings

Familiarize with default shortcuts, like 'Ctrl+b' prefix.

Best Practices

Guidelines and tips for using tmux effectively.

Naming Sessions

Naming sessions for easy identification and management.

Using Status Bar

Customize the status bar for better visibility of sessions, windows, and panes.

Session Restoration

Use tmux-resurrect and tmux-continuum for saving and restoring session state.

Learning Key Bindings

Understanding and using key bindings to increase productivity.

Advanced Usage

More sophisticated features and customization for power users.

Custom Key Bindings

Creating custom key bindings for frequent actions to improve workflow.

Hooks and Automation

Setting up hooks for triggering actions based on events within tmux.

Plugins

Installing plugins like tmux-resurrect and tmux-continuum to enhance tmux's capabilities.

Pane Synchronization

Synchronizing input across multiple panes.

login
signup