逻辑卷扩展根目录

[root@localhost ~]# fdisk /dev/sda
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。


命令(输入 m 获取帮助):n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
分区号 (3,4,默认 3):
起始 扇区 (104857600-1048575999,默认为 104857600):
将使用默认值 104857600
Last 扇区, +扇区 or +size{K,M,G} (104857600-1048575999,默认为 1048575999):
将使用默认值 1048575999
分区 3 已设置为 Linux 类型,大小设为 450 GiB

命令(输入 m 获取帮助):w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
正在同步磁盘。
[root@localhost ~]# partprobe
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 500G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 49G 0 part
│ ├─centos-root 253:0 0 45.1G 0 lvm /
│ └─centos-swap 253:1 0 3.9G 0 lvm [SWAP]
└─sda3 8:3 0 450G 0 part
sr0 11:0 1 1024M 0 rom
[root@localhost ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created.
[root@localhost ~]# vgextend centos /dev/sda3
Volume group "centos" successfully extended
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 2 2 0 wz--n- 498.99g 450.00g
[root@localhost ~]# lvextend -L +448G /dev/centos/root
Size of logical volume centos/root changed from <45.12 GiB (11550 extents) to <493.12 GiB (126238 extents).
Logical volume centos/root successfully resized.
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root centos -wi-ao---- <493.12g
swap centos -wi-ao---- <3.88g
[root@localhost ~]# xfs_growfs /dev/centos/root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=2956800 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=11827200, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=5775, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 11827200 to 129267712
[root@localhost ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 9.8M 7.8G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/centos-root 494G 5.7G 488G 2% /
/dev/sda1 1014M 184M 831M 19% /boot
tmpfs 1.6G 4.0K 1.6G 1% /run/user/42
tmpfs 1.6G 40K 1.6G 1% /run/user/0
[root@localhost ~]#

posted @ 2020-02-21 10:14  不算很酷  阅读(321)  评论(0编辑  收藏  举报