Chinaunix首页 | 论坛 | 博客
  • 博客访问: 21949
  • 博文数量: 10
  • 博客积分: 440
  • 博客等级: 下士
  • 技术积分: 120
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-10 08:59
文章分类

全部博文(10)

文章存档

2011年(1)

2009年(9)

我的朋友
最近访客

分类: 服务器与存储

2009-05-10 10:15:15

调整VG大小
 
使用lvdisplay发现有一个逻辑分区划分得太小了,需要40G但只划了20G,究其原因是PV划得太小,见如下信息:
 

as1:~ # lvdisplay
  --- Logical volume ---
  LV Name                /dev/vgscparch1/lv_arch
  VG Name                vgscparch1
  LV UUID                PYdv11-CTOu-Lfz9-FtuE-T1md-gVfS-Qo0yvR
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                20.00 GB
  Current LE             5120
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:0

as1:~ # vgdisplay
  --- Volume group ---
  VG Name               vgscparch1
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               22.00 GB
  PE Size               4.00 MB
  Total PE              5631
  Alloc PE / Size       5120 / 20.00 GB
  Free  PE / Size       511 / 2.00 GB
  VG UUID               pJ43QV-x99D-bpYK-OAPo-Yyng-uzFS-ZcNDlb

as1:~ # pvdisplay
  --- Physical volume ---
  PV Name               /dev/sdi
  VG Name               vgscparch1
  PV Size               22.00 GB / not usable 4.00 MB
  Allocatable           yes
  PE Size (KByte)       4096
  Total PE              5631
  Free PE               511
  Allocated PE          5120
  PV UUID               N1u9Aj-ciHr-kT2y-XrsB-o3nP-WLcI-sVPzi0
 
调整步骤如下,先开始resize pv,注意,前提是该LUN有足够的剩余空间大小:
 

as1:~ # pvresize --setphysicalvolumesize 42G /dev/sdi
  Physical volume "/dev/sdi" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized


as1:~ # pvdisplay
  --- Physical volume ---
  PV Name               /dev/sdi
  VG Name               vgscparch1
  PV Size               42.00 GB / not usable 3.81 MB
  Allocatable           yes
  PE Size (KByte)       4096
  Total PE              10751
  Free PE               5631
  Allocated PE          5120
  PV UUID               N1u9Aj-ciHr-kT2y-XrsB-o3nP-WLcI-sVPzi0

as1:~ # vgdisplay
  --- Volume group ---
  VG Name               vgscparch1
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               42.00 GB
  PE Size               4.00 MB
  Total PE              10751
  Alloc PE / Size       5120 / 20.00 GB
  Free  PE / Size       5631 / 22.00 GB

  VG UUID               pJ43QV-x99D-bpYK-OAPo-Yyng-uzFS-ZcNDlb

as1:~ # lvdisplay
  --- Logical volume ---
  LV Name                /dev/vgscparch1/lv_arch
  VG Name                vgscparch1
  LV UUID                PYdv11-CTOu-Lfz9-FtuE-T1md-gVfS-Qo0yvR
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                20.00 GB
  Current LE             5120
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:0
 
调整PV后,现在VG已经拥有充足的剩余空间,再直接调整LV的大小即可:
 

as1:~ # lvresize -L +21G /dev/vgscparch1/lv_arch
  Extending logical volume lv_arch to 41.00 GB
  Logical volume lv_arch successfully resized


as1:~ # vgdisplay
  --- Volume group ---
  VG Name               vgscparch1
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               42.00 GB
  PE Size               4.00 MB
  Total PE              10751
  Alloc PE / Size       10496 / 41.00 GB
  Free  PE / Size       255 / 1020.00 MB
  VG UUID               pJ43QV-x99D-bpYK-OAPo-Yyng-uzFS-ZcNDlb


as1:~ # lvdisplay
  --- Logical volume ---
  LV Name                /dev/vgscparch1/lv_arch
  VG Name                vgscparch1
  LV UUID                PYdv11-CTOu-Lfz9-FtuE-T1md-gVfS-Qo0yvR
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                41.00 GB
  Current LE             10496
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:0
 

完成。


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