
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
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
1.3
Display specific columns
This command is used to fetch the information about specific columns.
lsblk -o NAME, SIZE, FSTYPE, MOUNTPOINT
This allows administrators to quickly identify a
disk layout and mounted file systems.
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
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
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
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
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
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
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 
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
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
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.
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
This command displays:
- All
connected disks
- Partition
tables
- Disk
sizes
- File
system types
4.2 Manage a Disk
sudo fdisk /dev/sda
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
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
This command brings you into an interactive interface for the creation
of partition.
4.3.3 See the Current
Partitions Table (Optional)
Press p
So that we can see the current partition table.
4.3.4 Create New
Partition
To create new a partition press n
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.
4.3.6 Set First
Sector
Press Enter for the default option.
4.3.7 Set Last Sector
(Size)
- +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.
4.3.8 Verify
Partition
Press p so that you can check that new partition is created.
4.3.9 Write Changes
to the Disk
This saves changes and exits fdisk.
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
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
You can replace
ext4 with:
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
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
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 
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 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