Files
Work-configuration-file/系统硬盘扩容.md
2025-12-01 22:11:40 +08:00

53 lines
940 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

- **确认系统识别到了新容量**
```bash
lsblk
```
> 查看磁盘(如 `/dev/vda`)已扩到目标大小(例如 200G但分区 `/dev/vda1` 仍保持旧大小(例如 100G
>
- **扩展分区**
- 若未安装 `growpart`,先安装:
```bash
# CentOS/Alma/Rocky
yum install -y cloud-utils-growpart
# Ubuntu/Debian
apt-get update && apt-get install -y cloud-guest-utils
```
- 执行扩分区:
```bash
growpart /dev/vda 1
```
> 将 `/dev/vda1` 从旧大小扩展到整块磁盘。
>
- **确认根分区文件系统类型**
```bash
df -T /
```
记住 `Type` 列(`ext4` 或 `xfs`)。
- **扩展文件系统**
- **如果是 ext4**
```bash
resize2fs /dev/vda1
```
- **如果是 XFS**
```bash
xfs_growfs /
```
> 在线扩容,无需卸载或重启。
>
- **验证扩容结果**
```bash
df -h
```