【 tulaoshi.com - Linux 】
使用lvextend -L size LVNAME 增大一个逻辑卷的大小。[root@NEWLFS mnt]#lvextend -L +1G /dev/lvm_vg/lv_home Extending logical volume lv_home to 3.00 GB Logical volume lv_home successfully resized[root@NEWLFS mnt]# -L +1G 为lv_home加上 1G 空间。或者使用这种格式:[root@NEWLFS mnt]#lvextend -L 3G /dev/lvm_vg/lv_home指定lv_home更改后的大小,效果相同。
更改逻辑卷大小后,还应该更改文件系统的大小,保持一致:[root@NEWLFS mnt]#resize_reiserfs -f /dev/lvm_vg/lv_home 代码: resize_reiserfs 3.6.19 (2003 www.namesys.com)ReiserFS report:blocksize 4096block count 786432 (524288)free blocks 778197 (516061)bitmap block count 24 (16)Syncing..doneresize_reiserfs: Resizing finished successfully. [root@NEWLFS mnt]dfFilesystem Size Used Avail Use% Mounted on/dev/md0 5.4G 2.8G 2.7G 51% //dev/hda1 6.4G 4.0G 2.5G 62% /mnt/C/dev/hda6 25G 22G 3.6G 86% /mnt/E/dev/hda7 9.7G 3.7G 5.6G 40% /mnt/lfs/dev/mapper/lvm_vg-lv_home 3.0G 33M 3.0G 2% /mnt/lvm_home[root@NEWLFS mnt]#成功的将lvm_home扩展到了3G,没有重新启动,并且没有卸载文件系统。ReiserFS真是好用! ^_^当然,ReiserFS 也允许卸载文件系统后resize,使用下列命令:[root@NEWLFS mnt]#umount /dev/lvm_vg/lv_home卸载文件系统[root@NEWLFS mnt]#resize_reiserfs /dev/lvm_vg/lv_home调整大小,与上面不同的地方是没有 -f 参数.[root@NEWLFS mnt]#mount -t reiserfs /dev/lvm_vg/lv_home lvm_home/重新挂载上.EXT2/3 安装,扩展:[root@NEWLFS mnt]#lvcreate -L 2G -n lv_opt lvm_vg Logical volume "lv_opt" created分出一块2G名字为lv_opt的逻辑卷[root@NEWLFS mnt]#mke2fs -j /dev/lvm_vg/lv_opt 代码: mke2fs 1.35 (28-Feb-2004)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=016 block groups32768 blocks per group, 32768 fragments per group16384 inodes per groupSuperblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912Writing inode tables: doneCreating journal (8192 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 35 mounts or180 days, whichever comes first. Use tune2fs -c or -i to override. 创建ext3文件系统[root@NEWLFS mnt]#mkdir lvm_opt[root@NEWLFS mnt]#mount -t ext3 /dev/lvm_vg/lv_opt lvm_opt/创建挂载点,挂载上。[root@NEWLFS mnt]#df 代码: Filesystem Size Used Avail Use% Mounted............../dev/mapper/lvm_vg-lv_home 3.0G 33M 3.0G 2% /mnt/lvm_home/dev/mapper/lvm_vg-lv_opt 2.0G 33M 1.9G 2% /mnt/lvm_opt [root@NEWLFS mnt]#lvextend -L +1G /dev/lvm_vg/lv_opt Extending logical volume lv_opt to 3.00 GB Logical volume lv_opt successfully resized为lv_opt 增加一个G的空间。[root@NEWLFS mnt]#umount lvm_opt/调整ext2/3文件系统 需要先卸载,然后调整,不象ReiserFS可以不用卸载。[root@NEWLFS mnt]#resize2fs /dev/lvm_vg/lv_optresize2fs 1.35 (28-Feb-2004)Please run 'e2fsck -f /dev/lvm_vg/lv_opt' first.提示先运行e2fsck -f 那就检查下吧
resize2fs -f 参数可以不用e2fsck,检查下也是好的。[root@NEWLFS mnt]#e2fsck -f /dev/lvm_vg/lv_opt 代码: e2fsck 1.35 (28-Feb-2004)Pass 1: Checking inodes, blocks, and sizesPass 2: Checking directory structurePass 3: Checking directory connectivityPass 4: Checking reference countsPass 5: Checking group summary information/dev/lvm_vg/lv_opt: 11/262144 files (0.0% non-contiguous), 16443/524288 blocks[root@NEWLFS mnt]#resize2fs /dev/lvm_vg/lv_optresize2fs 1.35 (28-Feb-2004)Resizing the filesystem on /dev/lvm_vg/lv_opt to 786432 (4k) blocks.The filesystem on /dev/lvm_vg/lv_opt is now 786432 blocks long. 成功将lv_opt调整成3G,重新mount 看看吧 ![root@NEWLFS mnt]#mount -t ext3 /dev/lvm_vg/l