linux之 LVM扩容

简介:

1、 查看本机现在磁盘的情况
[root@oralce10g ~]# df 
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_oralce10g-LogVol03 9591312 4765404 4338692 53% /
tmpfs 883132 72 883060 1% /dev/shm
/dev/sda1 198337 29991 158106 16% /boot
/dev/mapper/vg_oralce10g-LogVol01 4031680 73636 3753244 2% /tmp
/dev/mapper/vg_oralce10g-LogVol02 15118728 14334340 16388 100% /u01


[root@oralce10g ~]# fdisk -l

Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 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: 0x00085d3a

Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 26 3917 31251456 8e Linux LVM

Disk /dev/sdb: 21.5 GB, 21474836480 bytes    ##找 doesn't contain a valid partition table 
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/vg_oralce10g-LogVol00: 2097 MB, 2097152000 bytes
255 heads, 63 sectors/track, 254 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/vg_oralce10g-LogVol03: 9978 MB, 9978249216 bytes
255 heads, 63 sectors/track, 1213 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/vg_oralce10g-LogVol01: 4194 MB, 4194304000 bytes
255 heads, 63 sectors/track, 509 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/vg_oralce10g-LogVol02: 15.7 GB, 15728640000 bytes
255 heads, 63 sectors/track, 1912 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


2、 创建物理卷
[root@oralce10g ~]# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created

3、“pvdisplay”命令查看物理卷情况
[root@oralce10g ~]# pvdisplay 
--- Physical volume ---
PV Name /dev/sda2
VG Name vg_oralce10g
PV Size 29.80 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 7629
Free PE 0
Allocated PE 7629
PV UUID lRqQzT-LRSi-xUS0-wO54-OBw1-pVan-kCKWIb

"/dev/sdb" is a new physical volume of "20.00 GiB" ###新建的物理卷
--- NEW Physical volume ---
PV Name /dev/sdb
VG Name 
PV Size 20.00 GiB
Allocatable NO
PE Size 0 
Total PE 0
Free PE 0
Allocated PE 0
PV UUID 5nHvN3-xTgI-uYNO-245u-arM0-1M8H-CeR1Tp

4、 将新添的物理卷加入到已有的逻辑卷组中
[root@oralce10g ~]# vgextend vg_oralce10g /dev/sdb 
Volume group "vg_oralce10g" successfully extended

5、查看卷组的空间
[root@oralce10g ~]# vgdisplay
--- Volume group ---
VG Name vg_oralce10g ##VG名称
System ID 
Format lvm2
Metadata Areas 2
Metadata Sequence No 6
VG Access read/write ##VG 访问权限
VG Status resizable
MAX LV 0
Cur LV 4
Open LV 4
Max PV 0
Cur PV 2
Act PV 2
VG Size 49.80 GiB 
PE Size 4.00 MiB
Total PE 12748 ##总的PE个数
Alloc PE / Size 7629 / 29.80 GiB ##已经分配的PE
Free PE / Size 5119 / 20.00 GiB ##自由PE数量和大小
VG UUID uSfeH7-09v9-dMRE-E6ex-IQlB-C4QM-3clpUm

6、 扩展已有卷的容量 (若有 29.9G为剩余可用容量,则可< -L +29.9G > ,在原有空间上扩容 )
[root@oralce10g ~]# lvextend -L 34G -n /dev/mapper/vg_oralce10g-LogVol02 /dev/sdb 
Extending logical volume LogVol02 to 34.00 GiB
Logical volume LogVol02 successfully resized

7、 以上配置完卷扩容,执行以下命令重新分配磁盘:
[root@oralce10g ~]# resize2fs /dev/mapper/vg_oralce10g-LogVol02 
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/vg_oralce10g-LogVol02 is mounted on /u01; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 3
Performing an on-line resize of /dev/mapper/vg_oralce10g-LogVol02 to 8912896 (4k) blocks.
The filesystem on /dev/mapper/vg_oralce10g-LogVol02 is now 8912896 blocks long.

[root@oralce10g ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_oralce10g-LogVol03 9.2G 4.6G 4.2G 53% /
tmpfs 863M 72K 863M 1% /dev/shm
/dev/sda1 194M 30M 155M 16% /boot
/dev/mapper/vg_oralce10g-LogVol01 3.9G 72M 3.6G 2% /tmp
/dev/mapper/vg_oralce10g-LogVol02 34G 14G 19G 44% /u01 >lvm已经扩大

文章可以转载,必须以链接形式标明出处。

本文转自 张冲andy 博客园博客,原文链接:   http://www.cnblogs.com/andy6/p/7574304.html ,如需转载请自行联系原作者
相关文章
|
4天前
|
Linux
Linux(1)arm64根目录扩容
Linux(1)arm64根目录扩容
9 0
|
6月前
|
Linux
生产环境Linux服务器磁盘分区、无损扩容根分区以及挂载磁盘到目录实战
生产环境Linux服务器磁盘分区、无损扩容根分区以及挂载磁盘到目录实战
218 0
|
3月前
|
弹性计算 Linux Shell
阿里云ecs linux系统如何进行系统盘的扩容
【1月更文挑战第25天】【1月更文挑战第122篇】阿里云ecs linux系统如何进行系统盘的扩容
211 1
|
4月前
|
运维 Linux 虚拟化
linux|磁盘管理工作|lvm逻辑管理卷的创建和使用总结(包括扩容,根目录扩容演示)
linux|磁盘管理工作|lvm逻辑管理卷的创建和使用总结(包括扩容,根目录扩容演示)
128 0
|
17天前
|
Linux 虚拟化
linux 虚拟机扩容--直接扩容到根目录
linux 虚拟机扩容--直接扩容到根目录
27 1
|
6月前
|
Linux 虚拟化
VMware虚拟机中Linux系统磁盘空间扩容实战
VMware虚拟机中Linux系统磁盘空间扩容实战
306 0
|
2月前
|
存储 监控 固态存储
Linux扩容要注意哪些事项,Linux 磁盘扩容具体操作
Linux扩容要注意哪些事项,Linux 磁盘扩容具体操作
|
4月前
|
存储 机器学习/深度学习 安全
Linux加强篇007-使用RAID与LVM磁盘阵列技术
山重水复疑无路,柳暗花明又一村
231 0
Linux加强篇007-使用RAID与LVM磁盘阵列技术
|
5月前
|
Linux
Linux——系统扩容根目录磁盘空间、磁盘扩容的操作方法
Linux根目录磁盘空间不够用了,当修改了虚拟机模版增加磁盘大小或者插入了一块新硬盘,但是发现系统里的大小还是没改变。 产生的原因是没有给磁盘格式化,没有增加分区。
271 0
|
7月前
|
Linux
14.3.6 【Linux】LVM 相关指令汇整与 LVM 的关闭
14.3.6 【Linux】LVM 相关指令汇整与 LVM 的关闭
46 0