[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: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)262144 inodes, 524288 blocks26214 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=53687091216 block groups32768 blocks per group, 32768 fragments per group16384 inodes per groupSuperblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912Writing inode tables: done
Creating journal (16384 blocks): doneWriting superblocks and filesystem accounting information: doneThis 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 //查看逻辑卷的大小为2GFilesystem Size Used Avail Use% Mounted on/dev/hda3 8.7G 2.7G 5.5G 33% //dev/hda1 99M 19M 76M 20% /boottmpfs 440M 0 440M 0% /dev/shmnone 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 requiredPerforming 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% /boottmpfs 440M 0 440M 0% /dev/shmnone 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