Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to check the available disk space on Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to check the available disk space on Linux. It is very detailed and has certain reference value. If you are interested, you must finish it.

The easiest way to find free disk space on Linux is to use the df command. The df command literally represents the free disk space disk free, and obviously it will show you the available disk space on the Linux system.

Df-h

Using the-h option, it displays disk space in human-readable formats (MB and GB).

Here is the output of the df command for my Dell XPS system, which uses an encrypted disk and only installs Linux:

Use the df command to check available disk space in Linux

If the above output confuses you, don't worry. I'll introduce something about checking available disk space in Linux. I will also show the GUI method for desktop Linux users.

Method 1: use the df command to check the available disk space in Linux (and understand its output)

When you use the df command to check disk space, it displays a set of "file systems", including their size, space used, and space available. Your actual disk should usually be one of the following lists:

/ dev/sda

/ dev/sdb

/ dev/nvme0n1p

This is not a hard standard, but it can give you an indication that you can easily tell the real disk from a pile of text.

Your Linux system may have some partitions on your disk for boot partition, EFI partition, root partition, swap partition, home directory, etc. In this case, these partitions are marked with a number at the end of the "disk name", such as / dev/sda1, / dev/nvme0n1p2, and so on.

You can tell which partition is used for what from their mount point. The root partition is mounted at /, the EFI partition is mounted at / boot/EFI, and so on.

In my case, I have used 41% of the disk space (232 GB) under the root partition. If you have 2 or 3 large partitions (such as root partition, home directory partition, etc.), you will have to calculate the disk space used here.

Understand df command output

Tmpfs:tmpfs (temporary file system) is used to keep files in virtual storage. You can ignore the virtual file system at will.

The udev:udev file system is used to store information about devices plugged into your system (such as USB, network cards, CD ROM, etc.). You can ignore it, too.

/ dev/loop: they are loopback devices. Because of the snap application, you will see a lot of these devices when you look at the disk in Ubuntu. Loopback devices are virtual devices that allow ordinary files to be accessed as block device files. Using loopback devices, snap applications perform sandboxie processing on their own virtual disks. Although they are under the root partition, you do not need to calculate the disk space they use separately.

Lost disk space? Check that you have mounted all disks and partitions

Remember, the df command displays only the disk space of the mounted file system. If you use multiple Linux distributions (or operating systems) on the same disk, or if you have multiple disks on your system, you need to mount them first to see the available disk space on those partitions and disks.

For example, my Intel NUC has two SSD disks and four or five Linux partitions on it. The df command shows more disks only when I explicitly mount them.

You can use the lsblk command to view all disks and partitions on your system.

After you have the disk partition name, you can mount it in this way:

Sudo mount / dev/sdb2 / mnt

I hope this approach will give you a good idea of checking hard drive space on Linux. Let's see how to do it under GUI.

Method 2: check the usage of available disks under GUI

It is easy to use the "Disk Usage Analyzer" tool in Ubuntu to check available disk space in GUI mode.

Disk Usage Analyzer tool

Here, you will see all the actual disks and partitions. You may need to click some partitions to mount them. It shows the disk usage of all mounted partitions.

Disk usage check

Use GNOME's Disks utility to check available disk space

In addition, GNOME's Disks utility is also a very easy to use tool.

GNOME's Disks tool

Start the tool and select the disk. Select a partition to view the available disk space. If the partition is not mounted, mount it first by clicking the "▶" icon.

Check the available disk space for the desktop version of Ubuntu

I think all the major desktop environments on Linux have some kind of graphical tool to check disk usage. You can search for it in the menu where you are a desktop Linux system.

The above is all the contents of the article "how to check available disk space on Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report