Command
Description
df -h
Show disk usage of all mounted filesystems in human-readable format.
df -T
Show filesystem types along with usage.
lsblk
Display information about all block devices (disks and partitions).
blkid
Show block device UUIDs and filesystem types.
du -sh <directory>
Show total size of a directory.
du -ah <directory>
Show size of all files and subdirectories.
Command
Description
fdisk -l
List partition tables of all disks (requires sudo).
sudo fdisk /dev/sdX
Open interactive partition manager for disk /dev/sdX.
parted /dev/sdX
Modern tool to create, resize, and manage partitions.
lsblk -f
Show partitions with filesystem types and labels.
Tip:
Backup data before modifying partitions.
Command
Description
mkfs.ext4 /dev/sdX1
Create an ext4 filesystem on partition /dev/sdX1.
mkfs.xfs /dev/sdX1
Create an XFS filesystem on partition /dev/sdX1.
mount /dev/sdX1 /mnt
Mount a partition to a directory.
umount /mnt
Unmount a mounted partition.
lsblk -f
Verify mounted partitions and filesystem types.
4. LVM (Logical Volume Management)
LVM allows flexible disk management by abstracting physical disks into Volume Groups (VGs) and Logical Volumes (LVs) .
Command
Description
pvcreate /dev/sdX
Initialize a physical disk for LVM.
vgcreate <vg_name> /dev/sdX
Create a volume group with one or more physical volumes.
lvcreate -L 10G -n <lv_name> <vg_name>
Create a logical volume of 10GB.
lvextend -L +5G /dev/<vg_name>/<lv_name>
Extend an existing logical volume by 5GB.
lvreduce -L -5G /dev/<vg_name>/<lv_name>
Reduce a logical volume (use with caution!).
lvdisplay
Show logical volume details.
vgdisplay
Show volume group details.
pvdisplay
Show physical volume details.
mkfs.ext4 /dev/< vg_name> /< lv_name> # Format LV
mount /dev/< vg_name> /< lv_name> /mnt # Mount LV
The /etc/fstab file is used to configure automatic mounting of partitions, disks, and logical volumes at boot.