Checking Disk Usage
Before making any changes to storage, understand how your current space is being used.- Filesystem usage (df)
- Directory size (du)
df reports usage at the filesystem level — it tells you how much space is available on each mounted volume.Listing Block Devices
Get a clear picture of the physical disks and partitions attached to your system before making any changes.lsblk gives a clean tree view that shows how partitions, LVM volumes, and RAID arrays relate to one another. blkid is the quickest way to find a partition’s UUID, which you’ll need for /etc/fstab entries.
Partitioning with fdisk
fdisk is an interactive tool for creating and managing partitions on MBR-style disks. Identify your target disk with lsblk first.
No changes are written to disk until you press
w. If you make a mistake, press q to quit without saving and start over.Formatting Filesystems
After partitioning, format each partition with a filesystem before you can store data on it.ext4
The default filesystem for most Linux distributions. Reliable, well-supported, and a safe choice for general-purpose data storage.
XFS
Performs well at large scale and with large files. Common on RHEL/CentOS and used heavily in enterprise environments.
Mounting Drives
Mount a formatted partition to a directory to make it accessible.mount do not persist across reboots. To make a mount permanent, add it to /etc/fstab. Use the partition’s UUID rather than its device path, as device paths like /dev/sdb1 can change between reboots.
blkid /dev/sdb1. After editing /etc/fstab, run sudo mount -a to verify the entry is valid before rebooting.
LVM: Logical Volume Management
LVM adds a flexible abstraction layer between physical disks and filesystems, letting you resize volumes, add disks to a pool, and take snapshots without downtime.Create a volume group
Group one or more physical volumes into a single storage pool called a volume group:
Create logical volumes
Carve logical volumes out of the volume group. Each logical volume behaves like a partition that you can format and mount:
For GPT partition tables — required for disks larger than 2 TB — use
parted instead of fdisk. The parted command supports GPT natively and can also resize partitions non-destructively in some cases.