您的位置:首页 > 其它

LVM在线增加LV的大小

2014-04-29 13:41 399 查看
[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

本文出自 “有志者事竟成!” 博客,请务必保留此出处http://zh888.blog.51cto.com/1684752/1404523
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: