Skip to content

Instantly share code, notes, and snippets.

View therayyanawaz's full-sized avatar
🕵️‍♂️
Working on Secret Project

Md Rayyan Nawaz therayyanawaz

🕵️‍♂️
Working on Secret Project
View GitHub Profile
@therayyanawaz
therayyanawaz / Linux Disk Setup.md
Last active March 28, 2025 06:01
This guide covers installing LVM tools, partitioning a disk, preparing it as an LVM physical volume, troubleshooting usage issues, and extending an existing LVM logical volume with filesystem resizing.

Comprehensive Guide to Disk Configuration, LVM Setup, and Resizing

Prerequisites

Before starting, ensure the following:

  1. Root Privileges: You’ll need sudo or root access to execute these commands.
  2. Identify the Disk: Know the target disk/partition (e.g., /dev/sdb or /dev/sdb1). Use lsblk or fdisk -l to confirm.
  3. Backup Data: Back up any critical data on the disk, as partitioning or wiping signatures will erase existing content.
  4. Volume Group Space: For extending a logical volume (e.g., /dev/my_vg/my_lv), ensure the volume group (VG) has enough free space (check with vgdisplay).
  5. Correct Device Names: Replace placeholders like /dev/diskname and /dev/my_vg/my_lv with your actual device paths and LVM names (use lvs to list logical volumes).
  6. Filesystem Tools: If resizing a filesystem, ensure the appropriate tool is installed (e.g., resize2fs for ext2/3/4, included in e2fsprogs; xfsprogs for XFS).