lvm创建及LVM相关管理命令

相关构架

    PE:物理块  默认4M大小
	PV:物理卷
	VG:卷组
	LV:逻辑卷
	LE:可被寻址的基本单位,在同一个卷组中,LE的大小和PE是相同的,并且一一对应

在这里插入图片描述

LVM相关管理命令

1.pv命令

     pvcreate:创建PV
	pvcreate  device
	pvdisplay:查看命令
	pvs:查看
	pvscan:扫描物理卷
	pvremove 移除物理卷
	pvmove:将pv中的数据挪移到其他pv中

2.vg命令

    vgcreate
		vgcreate vgname  /dev/sd....(divce)
			-s: 用来指定PE大小
		
	vgextend:扩容
	vgreduce:删除
	vgremove:删除卷组
	vgs:查看
	vgdisplay:查看命令
	vgrename

3.lv命令:

      lvcreate:
		-n:指定逻辑卷名称
		-L:指定逻辑卷大小   #绝对容量  +# 增量
		-l:指定逻辑卷大小  指定使用PE个数
		-s:创建快照
		-p:设置属性  r
		lvextend
		lvreduce
	lvrename
	lvs
	lvdisplay
	lvremove
	lvconvert:拍照
	
	lv缩减:
	1、卸载逻辑卷
		2、强制检测磁盘剩余空间
		3、使用resize2fs缩减文件系统
		4、再使用lvreduce命令缩减逻辑卷
		5、再挂载使用
		文件系统大小需要和逻辑卷大小一致
		
删除逻辑卷
		1、卸载逻辑卷
		2、lvremove删除逻辑卷,删除之前一定要删除掉/etc/fstab中记录的挂载信息
		3、vgremove删除卷组
		4、pvremove删除物理卷

lvm创建

新建分区(在这里我建了四个分区:sdb1,sdb2,sdb3,sdb4 100M)

[root@localhost ~]# fdisk -l /dev/sdb

Disk /dev/sdb: 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

[root@localhost ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xb05ef01e.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won’t be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to
switch off the mode (command ‘c’) and change display units to
sectors (command ‘u’).

Command (m for help): n
Command action
e e

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值