红帽linux目录扩容,RedHat/CentOS根目录扩容

下面以redhat为例,介绍如何扩容系统根目录,CentOS也是一样的。

1. 登录到系统中,查看硬盘情况。 /dev/sdb就是增加的硬盘。

[root@test ~]# fdisk -l

2. 操作/dev/sdb,进行分区,格式化。

[root@test ~]# fdisk /dev/sdb

Command (m for help): n

Partition type:

p primary (0 primary, 0 extended, 4 free)

e extended

Select (default p): p

Command (m for help): w //提交分区

3. 修改硬盘类型,修改为linux LVM,代码8e。此步骤也可以在分区步骤中直接完成。

Command (m for help): t

Selected partition 1

Hex code (type L to list all codes): 8e

Changed type of partition 'Linux' to 'Linux LVM'

Command (m for help): p

Command (m for help): w

4. 创建 PV。

[root@test ~]# pvcreate /dev/sdb1

5. 查看VG.

[root@test ~]# vgs

6. 扩展 VG。

[root@test ~]# vgextend rhel /dev/sdb1 //rhel为安装完redhat系统后,系统自动创建的卷组。

7. 扩展 LV /dev/mapper/rhel-root 根目录。 ///dev/mapper/rhel-root为系统自动创建的逻辑卷

[root@test ~]# lvextend -L +70G /dev/mapper/rhel-root /dev/sdb1

8. 扩展生效。

[root@test ~]# xfs_growfs /dev/mapper/rhel-root

你可能感兴趣的:(红帽linux目录扩容)