Check hard disk size on Linux (Centos)

Check hard disk size in Linux

Usedf command: df command can be used to display the disk usage of the file system, including the disk space size and usage of each mount point Condition. To view the hard drive size, you can run the following command:

df -h

This will display the file system's disk size in human-readable terms, in GB or MB.

The following is the parameter description of the df -h command output:

  1. Filesystem: The name or mount point of the file system. This is the location of the disk space or the name of the mount point.
  2. Size: The total capacity of the file system. This is the total size of the file system on the hard drive, expressed in human-readable terms such as GB, MB, etc.
  3. Used: The capacity used by the file system. Represents the disk space already occupied by files and data, also expressed in human-readable terms.
  4. Avail: The capacity available to the file system. Represents the unused free space in the file system, again in human-readable form.
  5. Use%: Indicates the percentage of used space in the file system. The calculation method is (Used / Size) * 100.
  6. Mounted on: The mount point of the file system. This is the directory path to which the file system is mounted, that is, the file system can be accessed through this path.
[root@dsms-dev ~]# df -h
文件系统        容量  已用  可用 已用% 挂载点
devtmpfs        9.8G     0  9.8G    0% /dev
tmpfs           9.8G     0  9.8G    0% /dev/shm
tmpfs           9.8G  1.7M  9.8G    1% /run
tmpfs           9.8G     0  9.8G    0% /sys/fs/cgroup
/dev/vda2       246G  191G   56G   78% /
overlay         246G  191G   56G   78% /var/lib/docker/overlay2/486f44031c88ec5e44a9d9c56747e91f5169dd9082622773f6857aa9d2db1613/merged
overlay         246G  191G   56G   78% /var/lib/docker/overlay2/775d2bb53038c60daf0a240621e9370da7554342c0fd13bb377bb55e078d57b9/merged
overlay         246G  191G   56G   78% /var/lib/docker/overlay2/b4e4ba11e9a0b487879d38f064ef64267e4154520150e8838cd0cd695e5b7c07/merged
overlay         246G  191G   56G   78% /var/lib/docker/overlay2/6043111cc6f31fad6bf5cb85f0e45cf77d60cc44cfe3e9f7ed34eef4041bc294/merged
overlay         246G  191G   56G   78% /var/lib/docker/overlay2/b0b18bf214512415408f279adc9159d7145dde9d2b9c3d118dfc3b90f916a8a5/merged
overlay         246G  191G   56G   78% /var/lib/docker/overlay2/fe7afb1e1d781aa745b391cc22044e0c6f45eb517266c062c58d75c3b3dfd3ca/merged
overlay         246G  191G   56G   78% /var/lib/docker/overlay2/52c7d59bc4c89dfa8290c2f0240f6337d41aa130586be5e3263d811e786adfcc/merged
overlay         246G  191G   56G   78% /var/lib/docker/overlay2/5773140f014d3abd32e7a8ee9a882ed159d128b71ff30c039f8d9e5966ad5b6a/merged
overlay         246G  191G   56G   78% /var/lib/docker/overlay2/7c83aef691c6286cc0383dc1b847ef0b2d4f5b6d603c7086d9f6f97214302aa3/merged
overlay         246G  191G   56G   78% /var/lib/docker/overlay2/0998118d6d6eb8649df6d87454777ca5b90f67e4131308a12f629465dbf5328e/merged
overlay         246G  191G   56G   78% /var/lib/docker/overlay2/3a6d40968843d6c280528fe4752a27c41f8f720deafe6302c3c1550aa640cfe3/merged
overlay         246G  191G   56G   78% /var/lib/docker/overlay2/6a6b46cd4392e9c5132c47a3f99ecec6c22b706bc93ba3d3705e25138b823c6c/merged
overlay         246G  191G   56G   78% /var/lib/docker/overlay2/38c27c8ed7a4ccd64b43104fd1df4c0173480c03c8bb24c605b5edc4d82cb3ed/merged
overlay         246G  191G   56G   78% /var/lib/docker/overlay2/13b438b5c20a76f01ef35cda91e5364ffb965f9c8c06960ac6e4b03d351e00be/merged
shm              64M     0   64M    0% /var/lib/docker/containers/53621d4c631dc6a6e729869d0c869e781200904e6a9a5a33a8a5c083c5a81807/mounts/shm
shm              64M     0   64M    0% /var/lib/docker/containers/47d92b4e1989c49a50e0adcd77a0f7dd0ade49559c890c6e79556d1530e78e97/mounts/shm
shm              64M     0   64M    0% /var/lib/docker/containers/ef2380262f573b691dca067ccdfca2068aa69869dc06165ce53edbc12ddc6dcb/mounts/shm
shm              64M     0   64M    0% /var/lib/docker/containers/6a67f0ce26c4e30e9825e5a70d0bd78b0d87ddfa81d29fae4c990963f45a8b7f/mounts/shm
shm              64M     0   64M    0% /var/lib/docker/containers/32a93e6b7c4f915027d30e6702c6a0f00ee008f4368faa89f7c7fc9c76b006e7/mounts/shm
shm              64M     0   64M    0% /var/lib/docker/containers/27825000a774b5d12d732afd03fcee26aeb229326fd0bc0d85f44d16d16f74f8/mounts/shm
shm              64M     0   64M    0% /var/lib/docker/containers/03027f983566945683a7b80366318b82a8f5c46a9b597c79865efee4805dd786/mounts/shm
shm              64M     0   64M    0% /var/lib/docker/containers/df22783aa002dfa1d406494628ff9dd3b53aa9b77555d7cee0cf955002fc1300/mounts/shm
shm              64M     0   64M    0% /var/lib/docker/containers/4512805a5c3093f2ef00e637ede0992628b888a76a66ee20767b5efa340481e7/mounts/shm
shm              64M     0   64M    0% /var/lib/docker/containers/731a716d4e4e37e1c90677b74f4212d0246319cb37a2d86dc98ac52b88f4e782/mounts/shm
shm              64M     0   64M    0% /var/lib/docker/containers/9a1cb3b3115d59b7a61a0bdf1e218e3377396864af738b09b9c278560491dc10/mounts/shm
shm              64M     0   64M    0% /var/lib/docker/containers/88c9006e8d5f9bac3295e6c52a97c9ab8c5e3ed50d83bf7d14abb870cf11b868/mounts/shm
shm              64M     0   64M    0% /var/lib/docker/containers/f3c298f44121322e4eea017aee349f00ab3d6faa2c37991a1dd4903a2fb6e676/mounts/shm
shm              64M     0   64M    0% /var/lib/docker/containers/1c477609cc40ddaf40c37b1a19cd9c0756241c98f0ee1a92bf6ee0a3bbab574e/mounts/shm
tmpfs           2.0G     0  2.0G    0% /run/user/0
overlay         246G  191G   56G   78% /var/lib/docker/overlay2/e9720ddd9221768dcdfd32d7b1e6bdb873338d4968e383e3217dbe28c53823da/merged
shm              64M     0   64M    0% /var/lib/docker/containers/93b1704d85df40a4f7094b7ab4b0d30af35f5af94f627e280fcd0b087c191435/mounts/shm
overlay         246G  191G   56G   78% /var/lib/docker/overlay2/f670e11a9a5664c0679984f938313b0add58d72652d63f1e287cb1a3bed0334a/merged
shm              64M     0   64M    0% /var/lib/docker/containers/553fda60b26001202226ea16fb294c99c40a874eba1667aa49b7e2a9bb6d859c/mounts/shm
overlay         246G  191G   56G   78% /var/lib/docker/overlay2/6fdc3a451b3a234be4b568a9ec0ac526113aad4e922b2a601aea14f4e5a4a045/merged
shm              64M     0   64M    0% /var/lib/docker/containers/8ef3135f1b463ec24a9140b9969016a5745da29ac769a4028b3974cbc20a6197/mounts/shm

This is the output of the df -h command, showing the different file systems and their disk usage. Here's an explanation of each line:

  1. devtmpfs: This is a virtual file system used to manage device files, usually mounted on /dev. It has a total capacity of 9.8GB, 0 used space, 9.8GB free space, and 0% usage. This file system is mainly used to manage device files and usually does not occupy disk space.

  2. tmpfs: This is a virtual memory file system commonly used to store temporary files and data. Here, it is mounted at /dev/shm, /run, and /sys/fs/cgroup. They both have a total capacity of 9.8GB, a small amount of used space (usually temporary data), a large amount of free space, and a usage rate of 0%. These file systems typically do not occupy actual disk space, but instead occupy system memory.

  3. /dev/vda2: This is a real hard drive partition with a total capacity of 246GB, 191GB used, 56GB free, and 78% usage. This is the root file system ("/"), which means that the operating system and applications are typically stored on this partition.

  4. overlay: This is the storage driver of the Docker container, used to manage the file system layer of the container. Multiple containers may share the same underlying image and therefore see multiple overlay file systems with the same capacity and usage. The total capacity of these file systems is 246GB, 191GB used, 56GB free, and 78% utilized.

  5. shm: This is a shared memory file system, typically used for shared memory in Docker containers. Each container has an independent shared memory space. The total capacity of these file systems is 64MB, 0 used, 64MB free, 0% used.

  6. tmpfs (located at /run/user/0): This is a virtual memory file system used to store user-specific temporary files and data. Here, the total capacity is 2.0GB, 0 used, and 2.0GB free, 0% used.

Summary:df -h outputs the disk usage of each file system in the system, including hard disk partitions, virtual file systems (such as devtmpfs and tmpfs) and the file system of the Docker container. You can use this information to monitor your system's storage usage and container storage.

Guess you like

Origin blog.csdn.net/u011019141/article/details/132853861