码迷,mamicode.com
首页 > 系统相关 > 详细

Linux LVM扩容和缩容

时间:2019-01-20 18:47:43      阅读:769      评论:0      收藏:0      [点我收藏+]

标签:asc   end   intern   执行   ber   支持   logic   use   eal   

将原硬盘上的LVM分区/dev/mapper/RHEL-Data由原来的60G扩展到80G

Step1:将LVData扩容+20G,如下图:

[root@esc data]# lvextend -L +20G /dev/RHEL/Data
Size of logical volume RHEL/Data changed from 60.00 GiB (15360 extents) to 80.00 GiB (20480 extents).
Logical volume RHEL/Data successfully resized.
[root@esc data]#

Step2:检查LV,如下图:

[root@esc data]# e2fsck -f /dev/RHEL/Data
e2fsck 1.42.9 (28-Dec-2013)
/dev/RHEL/Data is mounted.
e2fsck: Cannot continue, aborting.

[root@esc data]#

Step3:重新定义分区大小,如下图:

[root@esc ~]# resize2fs /dev/RHEL/Data
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/RHEL/Data    //EXT4的扩容使用 resize2fs 
Couldn‘t find valid filesystem superblock.
[root@esc ~]#

[root@esc ~]# xfs_growfs /dev/RHEL/Data                                                               //XFS扩容使用xfs_growfs
meta-data=/dev/mapper/RHEL-Data isize=256 agcount=4, agsize=3932160 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=15728640, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=7680, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 15728640 to 20971520
[root@esc ~]#

Step4:查看扩容后的分区容量,如下图:

[root@esc ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 2.0G 8.5M 2.0G 1% /run
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/mapper/centos-root 45G 3.5G 41G 8% /
/dev/sda1 497M 164M 333M 33% /boot
/dev/mapper/centos-home 22G 33M 22G 1% /home
tmpfs 393M 0 393M 0% /run/user/1000
/dev/mapper/RHEL-Data 80G 21G 60G 26% /data                 //从原来60G扩展到了80G 

将原硬盘上的LVM分区/dev/mapper/RHEL-Data由原来的80G扩展到60G

e2fsck -f /dev/RHEL/Data  #检查磁盘错误 (针对ext4执行)

resize2fs /dev/RHEL/Data  60G #更新逻辑卷信息(针对ext4执行)

lvresize -L 20G /dev/RHEL/Data  #重新设定大小

注意:XFS文件系统不支持缩容。

 

Linux LVM扩容和缩容

标签:asc   end   intern   执行   ber   支持   logic   use   eal   

原文地址:https://www.cnblogs.com/networking/p/10295641.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!