Chinaunix首页 | 论坛 | 博客
  • 博客访问: 85859
  • 博文数量: 20
  • 博客积分: 1926
  • 博客等级: 上尉
  • 技术积分: 210
  • 用 户 组: 普通用户
  • 注册时间: 2009-08-16 17:21
文章分类
文章存档

2011年(1)

2009年(19)

分类: LINUX

2009-08-16 17:24:57

How to Create LV in Specifying Ranges

23:59 08/15/2009

Author: Jaylin Zhou

Test Environment:

RedHat Enterprise Linux 5.3

Symptom:

The allocation of LV is different from what is expected.

Solution:

Now there are two PVs:

# pvscan

  PV /dev/sdb5   VG myvg   lvm2 [192.00 MB / 192.00 MB free]

  PV /dev/sdb6   VG myvg   lvm2 [192.00 MB / 192.00 MB free]

  Total: 2 [384.00 MB] / in use: 2 [384.00 MB] / in no VG: 0 [0   ]

Each of them has 48 PEs, and every PE is 4M.

A VG named "myvg" consists of sdb5 and sdb6

Now create LVs with 

Example One:

Create a LV of 50 PEs specifying sdb5:0- and sdb6:0-

# lvcreate -l 50 /dev/myvg -n mylv /dev/sdb5:0- /dev/sdb6:0-

  Logical volume "mylv" created

Example Two:

Create a LV of 50 PEs specifying sdb5:0-10 and sdb6:0-45

# lvcreate -l 50 /dev/myvg -n mylv /dev/sdb5:0-10 /dev/sdb6:0-45

  Logical volume "mylv" created

Example Three:

Create a LV of 40 PEs specifying sdb5:0-40 and sdb6:0-20

# lvcreate -l 40 /dev/myvg -n mylv /dev/sdb5:0-40 /dev/sdb6:0-20

  Logical volume "mylv" created

Example Four:

Create a LV of 40 PEs specifying sdb5:0-20 and sdb6:0-40

# lvcreate -l 40 /dev/myvg -n mylv /dev/sdb5:0-20 /dev/sdb6:0-40

  Logical volume "mylv" created

Example Five:

Create a LV of 20 PEs specifying sdb5:0-30 and sdb6:0-40

# lvcreate -l 40 /dev/myvg -n mylv /dev/sdb5:0-30 /dev/sdb6:0-40

  Logical volume "mylv" created

Example Six:

Create a LV of 20 PEs specifying sdb5:0-30 and sdb6:0-29

# lvcreate -l 40 /dev/myvg -n mylv /dev/sdb5:0-30 /dev/sdb6:0-29

  Logical volume "mylv" created

Example Seven:

Create a LV of 20 PEs specifying sdb5:0-30 and sdb6:0-30

# lvcreate -l 20 /dev/myvg -n mylv /dev/sdb5:0-30 /dev/sdb6:0-30

  Logical volume "mylv" created

Example Eight:

Create a LV of 60 PEs without specifying PVs

# lvcreate -l 60 /dev/myvg -n mylv 

  Logical volume "mylv" created

Summary:

From the experiments above, there are some rules of how to create an LV by specifying PV ranges:

Rule One: OS gives the priority to the PV of bigger range.

Rule Two: If without specifying the range, OS gives the priority to the former one.

Rule Three: If the two ranges are equal, OS gives the priority to the former one.

阅读(1526) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:Splitting a Volume Group

给主人留下些什么吧!~~