# 磁盘空间不够问题解决

### df

df 以磁盘分区为单位查看文件系统，可以获取硬盘被占用了多少空间，目前还剩下多少空间等信息。

例如，我们使用**df -h**命令来查看磁盘信息， **-h** 选项为根据大小适当显示：

![img](https://raw.githubusercontent.com/qkd90/figureBed/main/202303090956265.jpeg)

显示内容参数说明：

* **Filesystem**：文件系统
* **Size**： 分区大小
* **Used**： 已使用容量
* **Avail**： 还可以使用的容量
* **Use%**： 已用百分比
* **Mounted on**： 挂载点　

**相关命令：**

* **df -hl**：查看磁盘剩余空间
* **df -h**：查看每个根路径的分区大小
* **du -sh \[目录名]**：返回该目录的大小
* **du -sm \[文件夹]**：返回该文件夹总M数
* **du -h \[目录名]**：查看指定文件夹下的所有文件大小（包含子文件夹）

Tmpfs**是一个将所有文件都保存在虚拟内存中的文件系统**。 tmpfs中的所有内容都是临时的，也就是说没有任何文件会在硬盘上创建。 如果卸载tmpfs实例，所有保存在其中的文件都会丢失。 tmpfs将所有文件保存在内核缓存中，随着文件内容增长或缩小可以将不需要的页面swap出去。

### 磁盘分区

![image-20230404174545924](https://raw.githubusercontent.com/qkd90/figureBed/main/202304041745996.png)

tmpfs/devtmpfs是属于临时文件系统

/dev/shm是表示内存（大小是物理内存的一变）

/dev/mapper/centos-root 是系统的主要文件夹，目录为/

/dev/sda1 是系统一个文件夹，目录为/boot


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://qiangrens-organization.gitbook.io/qkd90/fu-wu-qi-yun-wei-he-ce-shi/linux-fu-wu-qi/ci-pan-kong-jian-bu-gou-wen-ti-jie-jue.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
