linux lvm 扩容

简介: 一把/data01扩容5G二把datavg扩容16G(1)查看vg[root@localhost ~]# vgsVG #PV #LV #SN Attr VSize VFreedatavg 4 2 0 wz--n- 63.

一把/data01扩容5G

二把datavg扩容16G

(1)查看vg

[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
datavg 4 2 0 wz--n- 63.97g 28.97g
datavg02 1 1 0 wz--n- 31.97g 21.97g
(2)查看目录大小
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 45G 1004M 42G 3% /
tmpfs 939M 0 939M 0% /dev/shm
/dev/sda1 772M 35M 698M 5% /boot
/dev/mapper/datavg-lvdata01
15G 141M 14G 1% /data01
/dev/mapper/datavg-lvdata02
20G 44M 19G 1% /data02
/dev/mapper/datavg02-lvdatavg0201
9.8G 23M 9.2G 1% /datavg
(3)查看lv
[root@localhost ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lvdata01 datavg -wi-ao---- 15.00g
lvdata02 datavg -wi-ao---- 20.00g
lvdatavg0201 datavg02 -wi-ao---- 10.00g
[root@localhost ~]# lvdisplay
\ --- Logical volume ---
LV Path /dev/datavg/lvdata01
LV Name lvdata01
VG Name datavg
LV UUID nYmHDL-uorm-h2P1-z2by-q0q7-cD41-hgJMJy
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2017-06-20 23:58:06 +0800
LV Status available

open 1

LV Size 15.00 GiB
Current LE 3840
Segments 3
Allocation inherit
Read ahead sectors auto

  • currently set to 256
    Block device 253:0

--- Logical volume ---
LV Path /dev/datavg/lvdata02
LV Name lvdata02
VG Name datavg
LV UUID ObJwel-aF2L-P6bR-SqCw-4gog-GKeR-Mdn0Py
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2017-06-21 00:03:21 +0800
LV Status available

open 1

LV Size 20.00 GiB
Current LE 5120
Segments 2
Allocation inherit
Read ahead sectors auto

  • currently set to 256
    Block device 253:1

--- Logical volume ---
LV Path /dev/datavg02/lvdatavg0201
LV Name lvdatavg0201
VG Name datavg02
LV UUID y2B8VI-DsSX-bTh1-C3PQ-ikJZ-TBzh-B14Ww3
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2017-06-21 21:25:45 +0800
LV Status available

open 1

LV Size 10.00 GiB
Current LE 2560
Segments 1
Allocation inherit
Read ahead sectors auto

  • currently set to 4096
    Block device 253:2
    (4)因vg里还有剩余空间,所以从vg里拿空间扩容lv
    [root@localhost ~]# lvextend -L +5G /dev/datavg/lvdata01
    Size of logical volume datavg/lvdata01 changed from 15.00 GiB (3840 extents) to 20.00 GiB (5120 extents).
    Logical volume lvdata01 successfully resized.
    (5)扩容完lv,vg里剩余的空间
    [root@localhost ~]# vgs
    VG #PV #LV #SN Attr VSize VFree
    datavg 4 2 0 wz--n- 63.97g 23.97g
    datavg02 1 1 0 wz--n- 31.97g 21.97g
    (6)resize2fs命令是增大或者收缩未加载的ext2/ext3/ext4文件的大小,如果文件处于mount状态下只能扩容,前提
    条件是内核支持在线resize.linux 2.6内核支持在线扩容

[root@localhost ~]# resize2fs /dev/datavg/lvdata01
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/datavg/lvdata01 is mounted on /data01; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/datavg/lvdata01 to 5242880 (4k) blocks.
The filesystem on /dev/datavg/lvdata01 is now 5242880 blocks long.
(7)扩容后/data01增加5G
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 45G 1004M 42G 3% /
tmpfs 939M 0 939M 0% /dev/shm
/dev/sda1 772M 35M 698M 5% /boot
/dev/mapper/datavg-lvdata01
20G 142M 19G 1% /data01
/dev/mapper/datavg-lvdata02
20G 44M 19G 1% /data02
/dev/mapper/datavg02-lvdatavg0201
9.8G 23M 9.2G 1% /datavg0201
(8)扩容vg查看添加的磁盘

[root@localhost ~]# fdisk -l

Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0001f40a

Device Boot Start End Blocks Id System
/dev/sda1 * 1 103 819200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 103 613 4096000 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 613 6528 47512576 83 Linux

Disk /dev/sdb: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x60e635c5

Device Boot Start End Blocks Id System
/dev/sdb1 1 2088 16771828+ 8e Linux LVM

Disk /dev/sdc: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd80d43e7

Device Boot Start End Blocks Id System
/dev/sdc1 1 2088 16771828+ 8e Linux LVM

Disk /dev/sde: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdd: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd6f8ce31

Device Boot Start End Blocks Id System
/dev/sdd1 1 2088 16771828+ 8e Linux LVM

Disk /dev/sdh: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdj: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xca12e5a0

Device Boot Start End Blocks Id System
/dev/sdj1 1 2088 16771828+ 83 Linux

Disk /dev/sdg: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xac719a1e

Device Boot Start End Blocks Id System
/dev/sdg1 1 2088 16771828+ 83 Linux

Disk /dev/sdi: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd4b19d46

Device Boot Start End Blocks Id System
/dev/sdi1 1 2088 16771828+ 83 Linux

Disk /dev/sdk: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x32d5562b

Device Boot Start End Blocks Id System
/dev/sdk1 1 2088 16771828+ 83 Linux

Disk /dev/sdf: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/datavg-lvdata01: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/datavg-lvdata02: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdl: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/md5: 34.3 GB, 34331426816 bytes
2 heads, 4 sectors/track, 8381696 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 524288 bytes / 1048576 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/datavg02-lvdatavg0201: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 524288 bytes / 1048576 bytes
Disk identifier: 0x00000000

(9)创建pv
[root@localhost ~]# pvcreate /dev/sdl
Physical volume "/dev/sdl" successfully created
[root@localhost ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/md5 datavg02 lvm2 a--u 31.97g 21.97g
/dev/sdb1 datavg lvm2 a--u 15.99g 0
/dev/sdc1 datavg lvm2 a--u 15.99g 0
/dev/sdd1 datavg lvm2 a--u 15.99g 7.98g
/dev/sdh datavg lvm2 a--u 16.00g 16.00g
/dev/sdl lvm2 ---- 16.00g 16.00g
(10)查看vg
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
datavg 4 2 0 wz--n- 63.97g 23.97g
datavg02 1 1 0 wz--n- 31.97g 21.97g
(11)扩容datavg
[root@localhost ~]# vgextend datavg /dev/sdl
Volume group "datavg" successfully extended
[root@localhost ~]#
datavg增加了16G
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
datavg 5 2 0 wz--n- 79.97g 39.97g
datavg02 1 1 0 wz--n- 31.97g 21.97g
[root@localhost ~]#


作者:make_zhf
来源:CSDN
原文:https://blog.csdn.net/make_zhf/article/details/73606066
版权声明:本文为博主原创文章,转载请附上博文链接!

相关实践学习
基于Hologres轻松玩转一站式实时仓库
本场景介绍如何利用阿里云MaxCompute、实时计算Flink和交互式分析服务Hologres开发离线、实时数据融合分析的数据大屏应用。
阿里云实时数仓实战 - 项目介绍及架构设计
课程简介 1)学习搭建一个数据仓库的过程,理解数据在整个数仓架构的从采集、存储、计算、输出、展示的整个业务流程。 2)整个数仓体系完全搭建在阿里云架构上,理解并学会运用各个服务组件,了解各个组件之间如何配合联动。 3 )前置知识要求   课程大纲 第一章 了解数据仓库概念 初步了解数据仓库是干什么的 第二章 按照企业开发的标准去搭建一个数据仓库 数据仓库的需求是什么 架构 怎么选型怎么购买服务器 第三章 数据生成模块 用户形成数据的一个准备 按照企业的标准,准备了十一张用户行为表 方便使用 第四章 采集模块的搭建 购买阿里云服务器 安装 JDK 安装 Flume 第五章 用户行为数据仓库 严格按照企业的标准开发 第六章 搭建业务数仓理论基础和对表的分类同步 第七章 业务数仓的搭建  业务行为数仓效果图  
目录
相关文章
|
6月前
|
Linux
生产环境Linux服务器磁盘分区、无损扩容根分区以及挂载磁盘到目录实战
生产环境Linux服务器磁盘分区、无损扩容根分区以及挂载磁盘到目录实战
207 0
|
3月前
|
弹性计算 Linux Shell
阿里云ecs linux系统如何进行系统盘的扩容
【1月更文挑战第25天】【1月更文挑战第122篇】阿里云ecs linux系统如何进行系统盘的扩容
206 1
|
4月前
|
运维 Linux 虚拟化
linux|磁盘管理工作|lvm逻辑管理卷的创建和使用总结(包括扩容,根目录扩容演示)
linux|磁盘管理工作|lvm逻辑管理卷的创建和使用总结(包括扩容,根目录扩容演示)
115 0
|
9天前
|
Linux 虚拟化
linux 虚拟机扩容--直接扩容到根目录
linux 虚拟机扩容--直接扩容到根目录
23 1
|
6月前
|
Linux 虚拟化
VMware虚拟机中Linux系统磁盘空间扩容实战
VMware虚拟机中Linux系统磁盘空间扩容实战
290 0
|
2月前
|
存储 监控 固态存储
Linux扩容要注意哪些事项,Linux 磁盘扩容具体操作
Linux扩容要注意哪些事项,Linux 磁盘扩容具体操作
|
4月前
|
存储 机器学习/深度学习 安全
Linux加强篇007-使用RAID与LVM磁盘阵列技术
山重水复疑无路,柳暗花明又一村
230 0
Linux加强篇007-使用RAID与LVM磁盘阵列技术
|
5月前
|
Linux
Linux——系统扩容根目录磁盘空间、磁盘扩容的操作方法
Linux根目录磁盘空间不够用了,当修改了虚拟机模版增加磁盘大小或者插入了一块新硬盘,但是发现系统里的大小还是没改变。 产生的原因是没有给磁盘格式化,没有增加分区。
247 0
|
7月前
|
Linux
14.3.6 【Linux】LVM 相关指令汇整与 LVM 的关闭
14.3.6 【Linux】LVM 相关指令汇整与 LVM 的关闭
44 0
|
7月前
|
Linux
14.3.4 【Linux】使用 LVM thin Volume 让 LVM 动态自动调整磁盘使用率
14.3.4 【Linux】使用 LVM thin Volume 让 LVM 动态自动调整磁盘使用率
68 0