Table of Contents generated with DocToc
df -Th
...
/dev/mapper/openeuler_host--10--190--13--37-root ext4 46G 6.1G 38G 14% /
fdisk -l |grep /dev/vda
Disk /dev/vda: 200 GiB, 107374182400 bytes, 209715200 sectors
/dev/vda1 * 2048 2099199 2097152 1G 83 Linux
/dev/vda2 2099200 104857599 102758400 49G 8e Linux LVM
fdisk /dev/vda
[root@ecs-xinxzx-sspywgznl-0023 ~]# fdisk /dev/vda
Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
Partition type
p primary (2 primary, 0 extended, 2 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (3,4, default 3):
First sector (104857600-209715199, default 104857600):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (104857600-209715199, default 209715199):
Created a new partition 3 of type 'Linux' and of size 50 GiB.
Command (m for help): w
The partition table has been altered.
Syncing disks.
pvdisplay
--- Physical volume ---
PV Name /dev/vda2
VG Name openeuler_host-10-190-13-37
PV Size <49.00 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 12543
Free PE 0
Allocated PE 12543
PV UUID MuXBcG-J5qS-442s-xzFO-Nnp5-MCqN-qVecGO
pvcreate /dev/vda3 # 上面是/dev/vda2,这儿一般叫/dev/vda3,类推
Physical volume "/dev/vda3" successfully created.
vgscan
Reading volume groups from cache.
Found volume group "openeuler_host-10-190-13-37" using metadata type lvm2
vgextend openeuler_host-10-190-13-37 /dev/vda3
Volume group "openeuler_host-10-190-13-37" successfully extended
# 根据 df -Th 得到mapper和格式
# 加上需要扩展的大小,一般偏小一点点(约1G),
lvextend -L +149G /dev/mapper/openeuler_host--10--190--13--37-root
lvextend -L +249G /dev/mapper/openeuler_host--10--190--13--37-root
# 根据 df -Th 得到mapper和格式
# ext4 使用
resize2fs /dev/mapper/openeuler_host--10--190--13--37-root
# xfs 使用
# xfs_growfs /dev/mapper/centos-root
df -h
/dev/mapper/openeuler_host--10--190--13--37-root ext4 193G 6.1G 179G 4% /
# 1、获取根目录挂载类型 xfs
df -Th
umount /home
lvremove /dev/mapper/centos-home
lvextend -l +100%FREE /dev/centos/root
xfs_growfs /dev/mapper/centos-root
# 2、修改 /etc/fstab 挂载点
fdisk /dev/vda
[root@ecs-xinxzx-sspywgznl-0023 ~]# fdisk /dev/vda
Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
Partition type
p primary (2 primary, 0 extended, 2 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (3,4, default 3):
First sector (104857600-209715199, default 104857600):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (104857600-209715199, default 209715199):
Created a new partition 3 of type 'Linux' and of size 50 GiB.
Command (m for help): w
The partition table has been altered.
Syncing disks.
-L 指定逻辑卷的大小,单位为“kKmMgGtT”字节
# 例子
lvextend -L +100M /dev/myvg/mylv # 如果不知道块设备需要先把pv挂上去 vgextend openeuler_host-10-190-13-37 /dev/vda3
lvextend -L +100 /dev/myvg/mylv /dev/sdb1
lvextend -l +100%FREE /dev/centos/root
xfs_growfs /dev/mapper/centos-root
根路径挂载点 mapper
resize2fs /dev/mapper/openeuler_host--10--190--13--37-root
根路径挂载点 mapper