How to understand disk management.


Disk management is a critical aspect of maintaining a Linux system, whether you’re a seasoned administrator or a beginner. Understanding how to manage disks effectively ensures optimal performance, data integrity, and efficient storage utilization. In this article, we’ll delve into Linux disk management, exploring essential commands and providing detailed examples.

  1. Viewing Disk Information:

The first step in disk management is obtaining information about your system’s disks. The lsblk command is a useful tool for displaying a tree-like overview of the block devices in your system, including information about their sizes, mount points, and file system types.

$ lsblk

This command provides a clear picture of your storage devices, aiding in subsequent management tasks.

  1. Partitioning Disks:

Partitioning involves dividing a disk into smaller, manageable sections. The fdisk command is a traditional tool for disk partitioning.

$ sudo fdisk /dev/sdX

Replace /dev/sdX with the appropriate disk identifier. Use commands like n for creating a new partition, d for deleting a partition, and w to save changes.

Alternatively, the parted command provides a more user-friendly interface:

$ sudo parted /dev/sdX

Follow on-screen instructions to create, delete, or resize partitions.

  1. Formatting Partitions:

Once a partition is created, it needs to be formatted with a file system. The mkfs command helps with this. For example, to create an ext4 file system:

$ sudo mkfs.ext4 /dev/sdXY

Replace /dev/sdXY with the actual partition identifier.

  1. Mounting and Unmounting File Systems:

Before using a file system, it needs to be mounted. The mount command is used for this purpose.

$ sudo mount /dev/sdXY /mnt

To unmount a file system:

$ sudo umount /mnt

Unmounting is crucial before performing tasks like resizing partitions.

  1. Checking Disk Usage:

The df command provides information about disk space usage on mounted file systems:

$ df -h

This command shows available space, used space, and the percentage of space used for each file system.

  1. Resizing Partitions:

To resize a partition, you can use tools like resize2fs for ext file systems or xfs_growfs for XFS file systems.

# Resize ext4 partition
$ sudo resize2fs /dev/sdXY

# Resize XFS partition
$ sudo xfs_growfs /dev/sdXY

Ensure the file system is unmounted before resizing.

  1. Monitoring Disk Performance:

For monitoring disk I/O performance, the iotop command is helpful:

$ sudo iotop

This tool provides real-time information about disk usage by processes.


Effectively managing disks in Linux is crucial for maintaining a stable and efficient system. With the commands and examples provided, you should have a solid foundation for disk management tasks. Always exercise caution when performing disk-related operations to avoid data loss, and consider backing up important data before making significant changes to your storage configuration.

Leave A Comment

What’s happening in your mind about this post !

Your email address will not be published. Required fields are marked *