#!/bin/bash

#create physical volume
if [ $# -eq 2 ]; then
	str=$2
	dev=${str:0:8}
	num=${str:8}
#	echo "dev: ${dev}"
	parted $dev set $num lvm on
	pvcreate $2
	pvs
	pvdisplay
#extern volume group
	vgextend LVM $2
	vgdisplay
#pvmove
	pvmove $1 $2
#vgreduce 	
	vgreduce LVM $1
#pvremove
	pvremove $1
#logic volumn	
	lvextend  -l +100%FREE  /dev/LVM/lvdisk
#take effect	
	resize2fs  /dev/LVM/lvdisk
else
	echo "Usage:saturn-lvm-replace.sh /dev/sdx1(remove) /dev/sdx1(replace)"
fi






 
