Chinaunix首页 | 论坛 | 博客
  • 博客访问: 481866
  • 博文数量: 82
  • 博客积分: 3003
  • 博客等级: 中校
  • 技术积分: 1285
  • 用 户 组: 普通用户
  • 注册时间: 2007-09-11 15:27
文章分类

全部博文(82)

文章存档

2011年(1)

2010年(5)

2009年(63)

2008年(13)

我的朋友

分类:

2009-10-09 23:50:46

 

How it works

To remove unused physical volumes from a volume group, use the vgreduce command. The vgreduce command shrinks a volume group's capacity by removing one or more empty physical volumes. This frees those physical volumes to be used in different volume groups or to be removed from the system.

1.Before removing a physical volume from a volume group, you can make sure that the physical volume is not used by any logical volumes by using the pvdisplay command.

2.If the physical volume is still being used you will have to migrate the data to another physical volume using the pvmove command. You can move data while the system is in use with the pvmove command.The pvmove command breaks up the data to be moved into sections and creates a temporary mirror to move each section.

3.Then use the vgreduce command to remove the physical volume.

Environment:

Red Hat Enterprise Linux 5U3

Procedure:

Step1:Create a volume group of 3 physical volumes

#fdisk /dev/sda %create /dev/sda8 /dev/sda9 /dev/sda10 each

%100M;partition ID is 8e

#fdisk -l     %find that boot partition is on /dev/sda1

#pvcreate /dev/sda8 /dev/sda9 /dev/sda10

#vgcreate vg0 /dev/sda8 /dev/sda9 /dev/sda10

#pvdisplay

Step2:Mount the logical volume and write datas on it

#mkfs.ext3 /dev/vg0/lv1

#df %check the available mount point

#mount /dev/vg0/lv1 /mnt

#dd if=/dev/zero of=/mnt/test.img bs=1M count=150

Step3:Create another physical volume and add to vg0

#fdisk /dev/sda

#partprobe

#pvcreate /dev/sda11

#vgextend vg0 /dev/sda11

Step4:Migrate data from /dev/sda8 to /dev/sda11

#pvmove /dev/sda8 /dev/sda11

Step5Reduce the physical volume from vg0 and check the changes

#vgreduce vg0 /dev/sda8

#ll /mnt

#vgs -o +devices %you may see 3 devices named /dev/sda11 /dev/sda9 /dev/sda10

 


 

阅读(593) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~