LVM操作命令

LVM操作命令_第1张图片

1. 磁盘分区,修改分区的systemid

#创建分区
fdisk /dev/sdb
Command (m for help): n
Command action
	 e   extended//扩展分区,创
	 p   primary partition (1-4)//主分区,最多创建4个~~ 
	p
 Device Boot      Start         End      Blocks   Id  System
	/dev/sdb1               1        2610    20964793+   5  Extended
	/dev/sdb5               1        1306    10490382   83  Linux
	/dev/sdb6            1307        2610    10474348+  83  Linux~~ 
	#格式化分区为8e
	Command (m for help): t
	Partition number (1-5): 1  
	Hex code (type L to list codes): 8e
	Command (m for help):  w //写入磁盘,保存并退出
	partprobe //重新加载分区

2.新建pv,vg,lv

pvcreate /dev/sdb1
	pvdisplay
	vgcreate datavg /dev/sdb1 
	vgdisplay
	lvcreate -L 10G -n lvmysql datavg
	mkfs.ext3 /dev/datavg/lvmysql
	mkdir -p /home/mysql
	mount /dev/datavg/lvmysql /home/mysql
	echo '/dev/datavg/lvmysql /home/mysql ext3 defaults 0 0 ' > /etc/fstab

你可能感兴趣的:(智能运维,lvm)