How to Check Disk Space in Linux?


Checking disk space in Linux is a crucial task for maintaining the health of your system. Disk space is limited, and running out of it can lead to system failure, data loss, and reduced performance.

It is essential to know how much disk space you have available and how much you are using at any given time. Luckily, checking disk space in Linux is a simple process that can be accomplished through the command line interface or the graphical user interface.

Checking Disk Space Using Command Line Interface

The Power of the df Command and Its Options

The df command is a powerful Linux command-line utility that allows you to check the disk usage and available space on file systems. When you run the command, it prints information about file systems that are currently in use, including their total size, used space, free space, and mount points.

The df command has several options that allow you to customize its output. For example, using the "-h" option will print sizes in a human-readable format, so instead of showing sizes in bytes or kilobytes, it will display them in gigabytes or terabytes.

A Step-by-Step Guide on How to Use the df Command to Check Disk Space

Here's a step-by-step guide on how to use the df command to check disk space −

  • Open a terminal window − The first step is to open a terminal window on your Linux system.

You can do this by pressing "Ctrl + Alt + T" or by searching for "Terminal" in your application launcher.

  • Type "df -h" and press enter: Once you have opened the terminal window, type "df -h" (without quotes) and press enter.

This will run the df command with the "-h" option and display information about all mounted filesystems in human-readable format.

satish@db:~$ df -h
Filesystem                    Size  Used Avail Use% Mounted on
tmpfs                          18G  1.5M   18G   1% /run
/dev/mapper/ubuntu--vg-lv--0  933G  757G  129G  86% /
tmpfs                          89G     0   89G   0% /dev/shm
tmpfs                         5.0M     0  5.0M   0% /run/lock
/dev/sda2                     2.0G  250M  1.6G  14% /boot
tmpfs                          18G  4.0K   18G   1% /run/user/1000
  • Interpretation of the Output: The output of df consists of several columns that provide information about each mounted filesystems such as Filesystem name/label, Size of partition/file system (total), Used Space (used), Available free space (available), Percentage usage (%used) and mount point.

For example −

Filesystem Size Used Avail Use% Mounted on 
/dev/sda1 20G 10G 9.8G 50% / /dev/sdb1 50G 30G 20G 60% /data  

In the above output example, we can see two mounted file systems "/dev/sda1" and "/dev/sdb1". The first line shows that the root ("/") directory uses a total of 20GB of disk space, it has used up to half of the disk space (10GB) and there is still an available free space of around 9.8GB.

The second line shows that the "/data" directory uses a total of 50GB, it has used up to about three-fifths (30GB), and there is still around 20GB available free space. By understanding how to use the df command, you can easily check your Linux system’s disk usage and ensure that you have enough free space for your applications and data.

Checking Disk Space Using Graphical User Interface (GUI)

Explanation of GUI Tools for checking Disk space in Linux

In addition to command line interface, Linux provides graphical user interface (GUI) tools for checking disk space. These tools are user-friendly, making it easier for beginners to check their disk space usage. Some popular GUI tools include GNOME Disks utility, KDE Partition Manager, and GParted.

Step-by-step Guide on how to use GNOME Disks Utility to Check Disk Space

GNOME Disks utility is a pre-installed tool that allows you to view and manage your disks and partitions with ease. To open GNOME Disks utility, follow these steps −

  • Click on the Applications menu in the taskbar.

  • In the search bar, type "Disks" or "GNOME Disks".

  • Select the GNOME Disks icon from the search results. Once you have opened GNOME Disks utility, follow these steps to check your disk space −

    • Select the drive you want to check from the list of available drives on the left-hand side of the window.

    • The available free space will be shown under "Free Space" on this screen.

Selecting The Drive You Want To Check

It is important that you select the correct drive when checking its free space using GNOME Disks utility as it can display information about all connected devices including external hard drives and USB storage devices.

Interpretation of The Output

The output provided by GNOME Disks utility gives detailed information about your disks and partitions including file system format, mount points used by Linux operating system files and directories as well as partition size information displayed in bytes or GBs. It is important that you understand what each piece of information means so that you can accurately interpret your results. Once you have successfully interpreted your disk space usage, you can take steps to manage it better if necessary.

Advanced Disk Space Management Techniques

The Importance of Advanced Techniques for Managing Disk Space in Linux

For those with more demanding disk space needs, basic disk space management techniques may not be sufficient. Advanced techniques allow you to better organize and manage your disk space, allocate resources more effectively, and simplify the processes of adding or removing storage devices. This section will cover Logical Volume Management (LVM), a powerful tool used to manage disk space on Linux systems.

What is LVM?

Logical Volume Management is a technique for abstracting physical storage devices into logical volumes that can be easily managed and allocated as needed. LVM provides several benefits, including the ability to resize file systems while they are still mounted and running, the ability to add disks without rebooting the system, and improved backup and restore functionality.

How Does LVM Work?

LVM operates by layering a virtualization layer between physical storage devices (such as hard drives) and file systems. The virtual layer is made up of several components: physical volumes (PVs), volume groups (VGs), and logical volumes (LVs).

PVs are the physical hard drives or partitions that provide raw storage for LVM. VGs are groups of PVs that create a pool of available storage.

LVs are then created within VGs as formatted file systems that can be mounted like any other partition. To use LVM effectively, one should have an understanding of PVs, VGs, LVs, and their interrelationships.

Step-by-Step Guide on How to Use LVM

To use LVM effectively requires some setup work beforehand −

  • Install the lvm2 package using your distribution's package manager.

  • Create Physical Volumes by initializing partition(s)/drive(s) into an LVM Physical Volume.

  • Create a Volume Group from one or more Physical Volumes.

  • Create a Logical Volume within the Volume Group with the desired size and file system type.

  • Format the Logical Volume with a supported file system.

  • Mount the Logical Volume.


Logical Volume Management is a powerful tool for managing disk space in Linux systems, providing flexibility, scalability, and ease of use. By abstracting physical storage devices into logical volumes, LVM simplifies the process of allocating resources as needed and allows for easy expansion or removal of storage devices without downtime or data loss. With an understanding of LVM's components and functions, users will be well equipped to take full advantage of this advanced disk space management technique to efficiently manage their Linux systems' disk space needs.

Updated on: 31-Aug-2023


Kickstart Your Career

Get certified by completing the course

Get Started