Centos根分区快接近100%,如果根分区是逻辑卷,那么可以增加额外的磁盘,通过逻辑卷扩容的方式增加到根分区空间。
1.检查当前根分区大小
df -Th
2.检查额外的磁盘
3.把磁盘格式化为lvm类型的文件分区。
[root@localhost ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xd430b089.Command (m for help): n
Partition type:p primary (0 primary, 0 extended, 4 free)e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-209715199, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199):
Using default value 209715199
Partition 1 of type Linux and of size 100 GiB is setCommand (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): w
The partition table has been altered!Calling ioctl() to re-read partition table.
Syncing disks.
4.重载分区表
partprobe /dev/sdb
5.创建物理卷
pvcreate /dev/sdb1
6.检查根分区所在卷组,把新建的物理卷加入到根分区的卷组
7.扩展根分区,并扩展文件系统
8.验证扩容后的根分区
根分区扩容结束。