Files
chill_notes/Linux/CentOS/CentOS调整分区大小.md
2026-04-21 20:24:09 +08:00

88 lines
1.2 KiB
Markdown
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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.
**CentOS 7 调整 home分区 扩大 root分区**
2. 查看分区
`df -h (centos-home`**和**`centos-root`**每人的名字可能不一样**
```
```
) vgdisplay (
```
```
**查看空闲磁盘大小)**``
4. 备份home分区文件
```
```
tar cvf /tmp/home.tar /home
```
```
6. 卸载/home如果无法卸载先终止使用/home文件系统的进程
`umount /home` **(卸载)**
```
```
fuser -km /home/
```
```
**(终止)**``
8. 删除/home所在的lv
```
```
lvremove /dev/mapper/centos-home
```
```
10. 扩展/root所在的lv
```
```
lvextend -L +50G /dev/mapper/centos-root
```
```
12. 扩展/root文件系统
```
```
xfs_growfs /dev/mapper/centos-root
```
```
14. 重新创建home lv
```
```
lvcreate -L 50G -n /dev/mapper/centos-home
```
```
16. 创建文件系统
```
```
mkfs.xfs /dev/mapper/centos-home
```
```
18. 挂载home
```
```
mount /dev/mapper/centos-home
```
```
20. home文件恢复
`tar xvf /tmp/home.tar -C /home/`
> 来自 <[https://www.jianshu.com/p/27c87f390175](https://www.jianshu.com/p/27c87f390175)>
> 来自 <[https://www.jianshu.com/p/27c87f390175](https://www.jianshu.com/p/27c87f390175)>