LVM在線增加LV的大小

[root@cacti ~]# lvcreate -L 2G -n lvtest vg01 //創建一個2G大小lvtest邏輯卷隸屬於vg01卷組
  /dev/hdc: open failed: No medium found
  Logical volume "lvtest" created

[root@cacti ~]# mkfs.ext3 /dev/vg01/lvtest //格式化lvtest邏輯卷
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
262144 inodes, 524288 blocks
26214 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912

Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.


[root@cacti ~]# mount /dev/vg01/lvtest /mnt //掛在邏輯卷lvtest到/mnt目錄下


[root@cacti ~]# df -h //查看邏輯卷的大小爲2G
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda3             8.7G  2.7G  5.5G  33% /
/dev/hda1              99M   19M   76M  20% /boot
tmpfs                 440M     0  440M   0% /dev/shm
none                  440M  104K  440M   1% /var/lib/xenstored
/dev/mapper/vg01-lvtest
                      2.0G   68M  1.9G   4% /mnt //lvtest大小爲2g

[root@cacti ~]# ls /mnt //拷貝東西到/mnt目錄下。
lost+found  openssl-0.9.8e.tar.gz


[root@cacti ~]# lvextend -L +2G /dev/vg01/lvtest //擴展lvtest大小加2個G。
  /dev/hdc: open failed: No medium found
  Extending logical volume lvtest to 4.00 GB
  Logical volume lvtest successfully resized

[root@cacti ~]# resize2fs -f /dev/vg01/lvtest //在線生效lvtest
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/vg01/lvtest is mounted on /mnt; on-line resizing required
Performing an on-line resize of /dev/vg01/lvtest to 1048576 (4k) blocks.
The filesystem on /dev/vg01/lvtest is now 1048576 blocks long.

[root@cacti ~]# df -h  //查看lvtest的大小
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda3             8.7G  2.7G  5.5G  33% /
/dev/hda1              99M   19M   76M  20% /boot
tmpfs                 440M     0  440M   0% /dev/shm
none                  440M  104K  440M   1% /var/lib/xenstored
/dev/mapper/vg01-lvtest
                      4.0G   72M  3.7G   2% /mnt //lvtest邏輯卷已經成功增大到4g.

[root@cacti ~]# ls /mnt //查看/mnt內容還在。
lost+found  openssl-0.9.8e.tar.gz

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章