How to Check Disk Space and Fix Storage Issues in Linux (Step-by-Step Guide)

 

Managing disk storage in Linux is not just a routine task for every Linux user and system administrator—it’s critical for system stability. When storage fills up, services fail, logs stop writing and servers can crash unexpectedly.

Whether you manage a personal Linux workstation or the production servers, to avoid unexpected issues, regularly monitor disk usage, check partitions and keep track of large files.

Linux provides many powerful commands that allow you to inspect the disks, analyze the storage usage, manage the partitions and mount the file systems efficiently.

Before working with the disk and storage commands in the Linux, it is important to understand the basics of the operating system. If you are new to the Linux read our complete guide on What is Linux? An Introduction to Linux and Its Popular Distributions.

In this guide, you’ll learn how to use essential Linux disk and storage commands with practical, real-world examples.

  •  Why disk and storage management is important in the Linux
  • Check disk space usage
  •     Identification of the storage devices and partitions
  •    Analyze directory sizes
  •    Manage disk partitions
  •    Mount and unmount storage devices
  •    Troubleshoot the disk related problems
By mastering these commands you can maintain the system stability and avoid the disk space issues.

Why Disk and Storage Management is Important in the Linux
The stability of a Linux system is directly related to disk management. When disk space runs out, critical services such as logging, databases and web servers can stop working without warning.

For example, if the root (/) partition becomes full:

  •  System logs will stop writing
  •  Applications may crash
  •  Package installations fail
  • The system can even become unresponsive
Monitoring disk usage is not optional it reaches capacity, services can fail, logs cease to be written and systems can become unstable. That’s why it’s a core responsibility for every Linux user and system administrator.

Effective disk management helps you:

  • Prevent unexpected disk space exhaustion before it impacts the services
  • Monitor storage usage across all the partitions and mounted file systems
  • Manage partitions and file systems based on the system requirements
  • Identify performance issues caused by disk bottlenecks
  • Maintain the overall system reliability in both personal and production environments
 Linux provides powerful built-in tools like df, du and lsblk that allow you to monitor and control disk usage in real time. When used correctly, these tools help you detect problems early and avoid downtime.    


Disk & Storage Commands

1. lsblk Command – List Block Devices
The lsblk command displays the information about all the available block devices such as hard drives, SSDs and partitions. It gives a clear tree like view of the storage devices and their mount points. This command is extremely useful when you want to identify all the disks, partitions and the mounted filesystems.

Basic Syntax

lsblk
lsblk command output showing the block devices, disks, partitions and the mount points in the Linux terminal

This output shows:
  •  Disk name
  •  Partition structure
  •  Mount points
  •  Disk size

1.2 Display file system information
This command is used to display the types of file system e.g. ext4, xfs or swap.

lsblk -f
lsblk command output showing block devices, disks, partitions, and mount points in Linux terminal

1.3 Display specific columns
This command is used to fetch the information about specific columns.

lsblk -o NAME, SIZE, FSTYPE, MOUNTPOINT
lsblk command output showing block devices, disks, partitions, and mount points in Linux terminal

This allows administrators to quickly identify a disk layout and mounted file systems.

The Disk and storage commands interact directly with file system in the Linux. To understand how the files and directories are organized in the Linux read our guide on Linux Directory Structure and File System – Beginners to Pro Guide.

2. df Command – Check Disk Space Usage
The df command gives the current statistics of the free and used disk space on the mounted file systems. It is one of the most commonly used commands for monitoring the usage of storage.

Basic Syntax

df
df command output showing the disk space usage, filesystem size, used and available the storage in the Linux terminal

This command shows the following information:
  • File system
  • 1K-blocks
  • Used blocks
  • Available blocks
  • Use Percent
  • Mount on

2.1 Human-Readable Output

df -h
df command output showing the disk space usage, filesystem size, used and available the storage in the Linux terminal

The output includes:
  • Total disk size
  • Used space
  • Available space
  • Percentage usage
      Shows total, used and available disk space and displays usage in human readable format like GB or MB.
     
       What to look for:
  •        If above 90% is used, your system is at risk
  •            If root (/) is full then system is in critical situation

2.2 Check Specific Directory

df -h /home
df command output showing the disk space usage, filesystem size, used and available the storage in the Linux terminal

this command shows the file system, size, used space, available space and mount point of the specific directory.

2.3 Show File System Type
This command is helpful during troubleshooting when you need to confirm the file system type on the mounted partitions such as ext4, xfs or btrfs. For example before resizing a partition or checking compatibility with certain tools.

df -T
df command output showing the disk space usage, filesystem size, used and available the storage in the Linux terminal

2.4 list Inode Information
This command shows inode usage instead of disk space usage. It is especially useful when your system cannot create new files due to not having free space, which usually indicates that the inode limit has been reached.

df -i
df command output showing the disk space usage, filesystem size, used and available the storage in the Linux terminal

2. du Command – Check the Disk Usage
The du command estimates the disk space used by files and directories. It is especially useful during disk space issues as it helps to identify large directories that are consuming most of the storage.

Basic Syntax
du

2.1 Check Folder Size
This command shows the total size of a specific directory, such as /var, which is commonly used to store logs. It is useful when troubleshooting disk space issues caused by large log files.

du -sh /var
du command output showing the disk usage of the directories and the files in the Linux terminal

The total size of the /var directory is 4.6 GB.

2.2 Check All Directories
This command displays the disk usage of files and directories in a human-readable format (KB, MB, GB), making it easier to quickly analyze storage consumption during disk space troubleshooting.

du -h                                                                                                                                                             du command output showing the disk usage of the directories and the files in the Linux terminal

2.3 Find Largest Directories
This command displays the sizes of top-level directories in the root (/) file system, making it easier to quickly identify which locations are consuming the most disk space during troubleshooting.

du -h --max-depth=1
du command output showing the disk usage of the directories and the files in the Linux terminal

2.4 Find Largest Files in the System
To go deeper and find the exact files consuming space, use:

du -ah / | sort -rh | head -20

What this Shows:

·       List of largest files and directories
·       Helps to identify space consumption quickly

Use cases:

·       Log files growing too large
·       Backup files are consuming space

3. blkid Command- File system and UUID
The blkid command displays information about block devices, including the file system type and UUID. It is especially useful when configuring persistent mounts in the /etc/fstab as UUIDs provide a stable way to identify disks even if device names change after a reboot.

Basic Syntax

blkid
Linux blkid command output is showing the block devices with UUID, the file system type and the partition information

It displays:
  • Device name
  • File system type
  • Unique UUID identifier
Why this matters:

·       UUID is used in the /etc/fstab
·       Prevents issues when device names change after reboot

The UUID system is also better because the device names may change during a reboot, and the UUID system does not lose stability.

Commands like df, du and blk are part of everyday command-line usage of the Linux. The more important commands you want to learn then check our guide on 10 Linux Basic Commands Every Beginner Should Know.

4. fdisk Command - disk partitions
This command lists all available disks and their partitions including details such as disk size and partition layout. It is commonly used to identify available storage devices before performing disk operations of partitioning or formatting.

4.1 List Available Disks

sudo fdisk -l
fdisk -l command output is showing the disk partitions, sizes and the partition table details in the Linux terminal

This command displays:
  •  All connected disks
  •  Partition tables
  •  Disk sizes
  •  File system types

4.2 Manage a Disk

sudo fdisk /dev/sda
fdisk -l command output is showing the disk partitions, sizes and the partition table details in the Linux terminal

After running this command an interactive interface appears:
  •  Create partitions
  •  Delete partitions
  •  Modify partition types
  •  Write changes to disk

4.3 Create Partition
Caution: This may erase the data in case it is done improperly. Always take backup and verify the disk name before the proceeding.

4.3.1 List Available Disks
First, identify your disk (e.g., /dev/sdb).

sudo fdisk -l
fdisk -l command output is showing the disk partitions, sizes and the partition table details in the Linux terminal

Look for:
  • Disk name (/dev/sdb, /dev/sdc)
  • Disk size
  • Existing partitions

4.3.2 Open Disk in fdisk
Here disk name is /dev/sdb. You have to change the name of the disk accordingly. Check the disk name with fdisk -l command as shown above.

sudo fdisk /dev/sdb
fdisk -l command output is showing the disk partitions, sizes and the partition table details in the Linux terminal

This command brings you into an interactive interface for the creation of partition.

4.3.3 See the Current Partitions Table (Optional)

Press p
fdisk -l command output is showing the disk partitions, sizes and the partition table details in the Linux terminal

So that we can see the current partition table.

4.3.4 Create New Partition

To create new a partition press n
fdisk -l command output is showing the disk partitions, sizes and the partition table details in the Linux terminal

You will be prompted for:

Choose partition type
  • p for  primary
  • e for extended

Press Enter (default primary).

4.3.5 Select Partition Number

Press Enter for the default option.
fdisk -l command output is showing the disk partitions, sizes and the partition table details in the Linux terminal

4.3.6 Set First Sector

Press Enter for the default option.
fdisk -l command output is showing the disk partitions, sizes and the partition table details in the Linux terminal

4.3.7 Set Last Sector (Size)
fdisk -l command output is showing the disk partitions, sizes and the partition table details in the Linux terminal

  • +5G to create 5GB partition
  • +500M to create 500MB partition
  • Press enter to use full disk

Full disk option is selected to create this partition.

Disk usage and storage performance can affect the overall system performance. To monitor the CPU, memory and the real time system activities read our guide on Monitor Linux System Performance with top and htop.

4.3.8 Verify Partition

Press p so that you can check that new partition is created.
fdisk -l command output is showing the disk partitions, sizes and the partition table details in the Linux terminal

4.3.9 Write Changes to the Disk

This saves changes and exits fdisk.
fdisk -l command output is showing the disk partitions, sizes and the partition table details in the Linux terminal

4.4 Format Disk
Formatting is the process of setup of a file system on a disk or a partition that Linux can use to store and manipulate the information on it. This is one of most important command for system administrators because they use this on daily basis.

4.4.1 Identify the Partition

Before formatting identify the right partition. Use lsblk command
lsblk command output showing the block devices, disks, partitions and the mount points in the Linux terminal

4.4.2 Format Using mkfs
The mkfs command is used to create a file system on a disk or partition. It is typically used after creating a new partition to prepare it for storing data and making it usable by the operating system.

mkfs.ext4 /dev/sdb1
mkfs command output is showing the disk formatting process and the file system creation in the Linux terminal

You can replace ext4 with:
  •  xfs
  • ntfs
  • fat32

5. mount Command – Mount File System
The mount command attaches a file system to the Linux directory tree for the convenience of the system to access it. Without the mounting, the operating system cannot read or write the data on the disk.

5.1 Show Mounted File systems
This command is used to show all the mounted storage devices.

Mount
mount command output is showing the mounted file systems and the disk partitions in the Linux terminal

5.2 Mount a Disk
This command is used to mount the partitions or external drive such as /dev/sdb1 to a mount point directory /mnt. Upon mounting, users can access files in the disk.

sudo mkdir /mnt/mydisk
sudo mount /dev/sdb1 /mnt/mydisk
mount command output is showing the mounted file systems and the disk partitions in the Linux terminal

5.3 umount Command – Unattach the File Systems
Umount command is a safe way of unattaching a mounted file system. It is important to ensure that you unmount a device prior to removal so as to avoid the corruption of data.

sudo umount /mnt/mydisk                                                                                               mount command output is showing the mounted file systems and the disk partitions in the Linux terminal

This command is used to unattach the mounted disk contents from the directory. In case the device is busy, Linux cannot unmount it until all the running processes are shut down.

Troubleshooting Workflow of the Disk

Step 1 – Check Disk Usage

df -h

This command is used to show that which file system is full.

Step 2 – Find Large Directories

du -h --max-depth=1 /

This helps to locate the directories which are consuming the most space.

Step 3 – Check Disk Devices

lsblk

This helps to verify the disks and mount points. These commands together allow the administrators to quickly diagnose the storage issues.

Managing disk usage is closely related to the controlling running processes that consume the system resources. Learn how to manage the processes in the Linux in our tutorial on Linux Process Management for Beginners – Complete Guide 2025.

Common Disk Issues and Quick Fixes

  •  Disk full but space not visible - use lsof | grep deleted
  •  High usage in /var - clean logs
  •  Inode full - check with df -i
  •  Unknown disk - verify using lsblk

Best Practices for Disk Management in the Linux

The below storage management practices are used to preserve a healthy Linux system.

  •  Monitor disk usage regularly
  •  Clean unnecessary files and logs
  •  Use UUIDs in /etc/fstab
  •  Create proper partition layouts
  •  Monitor storage growth on servers

Implementing these practices prevent the unexpected storage failures.

Frequently Asked Questions (FAQs)

1.How do I check disk space in Linux?

Use the following command:

df -h

It displays disk usage in a human readable format.

2.How to check the directory size in the Linux?

Use the du command:

du -sh directory_name

3.How do I list disks in Linux?

Use the lsblk command:

lsblk

4.How do I find disk UUID in Linux?

Use:

blkid

This is the command that is used to show the file system information and UUID.

📚 Related Articles

Conclusion

A critical skill in Linux disk and storage management is to ensure that systems remain stable and to avoid unplanned failures. A full disk can stop services, interrupt logging and impact overall system performance.

By using commands like df, du, lsblk, blkid, and fdisk, you can monitor disk usage, identify storage issues, and manage partitions effectively. These are the tools required not only in the day-to-day system administration, but also in troubleshooting real-world problems.

If you regularly work with Linux systems, understanding how to analyze and manage disk space will help you prevent downtime, resolve issues faster and maintain a reliable environment.

 The most recent Linux guides and tutorials can be found on the SeekLinux. You are welcome to give us your feedback and suggestions.

Author: Aqeel Anwar


SeekLinux Author
SeekLinux Team
Linux Engineers | DevOps | Security Enthusiasts

SeekLinux Team shares practical Linux tutorials, SSL/TLS certificate guides, commands and DevOps solutions. Our goal is to simplify system administration and help you master real-world server and security tasks.

Learn more about us →

Post a Comment

Previous Post Next Post