RedHat Linux 4/5下LVM 在线扩容
RHEL4:
: ~/root> df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              15G  7.9G  6.2G  56% /
/dev/sda1              99M   12M   82M  13% /boot
none                 1014M     0 1014M   0% /dev/shm
/dev/sda3              15G  3.9G  9.9G  29% /opt
/dev/sda6              47G   17G   28G  39% /oradata
/dev/hda              2.3G  2.3G     0 100% /mnt
/dev/mapper/vg00-lv00
                      6.6G  6.2G  443M  94% /lvm
                     
: ~/root> vgdisplay
  --- Volume group ---
  VG Name               vg00
  System ID            
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  15
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               9.99 GB
  PE Size               4.00 MB
  Total PE              2558
  Alloc PE / Size       1560 / 6.09 GB

  Free  PE / Size       998 / 3.90 GB
  VG UUID               qFsZT2-rf1T-pkbe-2JM6-WZfk-21RM-7hnMBh
 
 
: ~/root> lvdisplay
  --- Logical volume ---
  LV Name                /dev/vg00/lv00
  VG Name                vg00
  LV UUID                FkDRvC-slrn-geiz-BqQC-MM8o-qHWG-eqJzd6
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                6.09 GB
  Current LE             1560

  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
 
: ~/root> lvextend -l 2000 /dev/vg00/lv00
  /dev/cdrom: open failed: Read-only file system
  Extending logical volume lv00 to 7.81 GB
  Logical volume lv00 successfully resized


: ~/root> ext2online /dev/vg00/lv00
ext2online v1.1.18 - 2001/03/18 for EXT2FS 0.5b
: ~/root> df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              15G  7.9G  6.2G  56% /
/dev/sda1              99M   12M   82M  13% /boot
none                 1014M     0 1014M   0% /dev/shm
/dev/sda3              15G  3.9G  9.9G  29% /opt
/dev/sda6              47G   17G   28G  39% /oradata
/dev/hda              2.3G  2.3G     0 100% /mnt
/dev/mapper/vg00-lv00
                      7.7G  6.2G  1.6G  80% /lvm




RHEL5:


: ~/root> vgdisplay
  --- Volume group ---
  VG Name               VolGroup00
  System ID            
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  11
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                5
  Open LV               5
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               57.84 GB
  PE Size               32.00 MB
  Total PE              1851
  Alloc PE / Size       1820 / 56.88 GB
  Free  PE / Size       31 / 992.00 MB

  VG UUID               WXEcHz-UBt6-E3xy-7jgk-Xs3H-vHNq-TEFzp3
 
: ~/root> df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol04
                       12G  4.3G  7.0G  39% /
/dev/mapper/VolGroup00-LogVol01
                      9.7G  151M  9.1G   2% /arch
/dev/mapper/VolGroup00-LogVol00
                      9.7G  2.0G  7.3G  22% /opt

/dev/mapper/VolGroup00-LogVol02
                       18G  9.0G  7.3G  56% /data
/dev/sda1              99M   13M   82M  14% /boot
tmpfs                1006M     0 1006M   0% /dev/shm
/dev/hda              3.4G  3.4G     0 100% /mnt


: ~/root> lvdisplay /dev/VolGroup00/LogVol00
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol00
  VG Name                VolGroup00
  LV UUID                x3Pcas-WKn4-aU7U-OIFw-y4Ip-mP64-YkFbA9
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                10.00 GB
  Current LE             320

  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2


: ~/root> lvextend -l 350 /dev/VolGroup00/LogVol00
  Extending logical volume LogVol00 to 10.94 GB
  Logical volume LogVol00 successfully resized
: ~/root> resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /opt; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 2867200 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 2867200 blocks long.


: ~/root> df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol04
                       12G  4.3G  7.0G  39% /
/dev/mapper/VolGroup00-LogVol01
                      9.7G  151M  9.1G   2% /arch
/dev/mapper/VolGroup00-LogVol00
                       11G  2.0G  8.1G  20% /opt

/dev/mapper/VolGroup00-LogVol02
                       18G  9.0G  7.3G  56% /data
/dev/sda1              99M   13M   82M  14% /boot
tmpfs                1006M     0 1006M   0% /dev/shm
/dev/hda              3.4G  3.4G     0 100% /mnt


: ~/root>  lvdisplay /dev/VolGroup00/LogVol00
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol00
  VG Name                VolGroup00
  LV UUID                x3Pcas-WKn4-aU7U-OIFw-y4Ip-mP64-YkFbA9
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                10.94 GB
  Current LE             350

  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2