Linux逻辑卷管理LVM
| [日期:2013-03-25] |
来源:Linux社区
作者:missedyou |
[字体:大 中 小]
|
- LVM最主要的功能就是能动态的调整分区的大小,其实也就是修改逻辑卷的大小
- lvresize [-L (+size) –l (+PE数)] 逻辑卷名称
- 扩展逻辑卷sharedisk的大小到5G,执行以下命令:
- [root@rhel5 ~]# lvresize -L 5G /dev/iscsi/sharedisk
- [root@rhel5 ~]# resize2fs /dev/iscsi/sharedisk
- resize2fs 1.39 (29-May-2006)
- resize2fs: Bad magic number in super-block while trying toopen /dev/iscsi/sharedisk
- Couldn't find valid filesystem superblock.
- 缩小LV必须先缩小LV所在的文件系统(resize2fs)才能进一步缩小LV(lvresize)
- 缩小逻辑卷sharediak的大小为3G
- [root@rhel5 ~]# umount /dev/iscsi/sharedisk
- [root@rhel5 ~]# e2fsck -f /dev/iscsi/sharedisk //检查文件系统的准确性
- e2fsck 1.39 (29-May-2006)
- Couldn't find ext2 superblock, trying backup blocks...
- Pass 1: Checking inodes, blocks, and sizes
- Pass 2: Checking directory structure
- Pass 3: Checking directory connectivity
- Pass 4: Checking reference counts
- Pass 5: Checking group summary information
- /dev/iscsi/sharedisk: ***** FILE SYSTEM WAS MODIFIED *****
- /dev/iscsi/sharedisk: 11/262144 files (9.1% non-contiguous), 25406/524288 blocks
- [root@rhel5 ~]# resize2fs /dev/iscsi/sharedisk 3G //缩小文件系统的大小为3G
- resize2fs 1.39 (29-May-2006)
- Resizing the filesystem on /dev/iscsi/sharedisk to 786432 (4k) blocks.
- The filesystem on /dev/iscsi/sharedisk is now 786432 blocks long.
- [root@rhel5 ~]# lvresize -L 3G /dev/iscsi/sharedisk //缩小逻辑卷sharedisk的大小为3G
- WARNING: Reducing active logical volume to 3.00 GB
- THIS MAY DESTROY YOUR DATA (filesystem etc.)
- Do you really want to reduce sharedisk? [y/n]: y
- Reducing logical volume sharedisk to 3.00 GB
- Logical volume sharedisk successfully resized
- [root@rhel5 ~]# mount /dev/iscsi/sharedisk /data/
- 删除物理卷的命令是pvremove,将物理卷从卷组移除的命令是vgreduce,删除卷组的命令是vgremove,同理,删除逻辑卷的命令是lvremove。
- 删除一个卷组的顺序是:卸载逻辑卷分区
- [root@rhel5 ~]# umount /dev/iscsi/sharedisk
- [root@rhel5 ~]# lvremove /dev/iscsi/sharedisk
- Do you really want to remove active logical volume sharedisk? [y/n]: y
- Logical volume "sharedisk" successfully removed
- [root@rhel5 ~]# vgchange -a n iscsi //停用卷组iscsi
- 0 logical volume(s) in volume group"iscsi" now active
- [root@rhel5 ~]# vgreduce iscsi /dev/sda6 //从卷组iscsi 中移除一个/dev/sda6的物理卷
- Removed "/dev/sda6"from volume group"iscsi"
- [root@rhel5 ~]# vgs iscsi
- VG #PV #LV #SN Attr VSize VFree
- iscsi 1 0 0 wz
- [root@rhel5 ~]# vgremove iscsi /dev/sda5
- Volume group"iscsi" successfully removed
- [root@rhel5 ~]# pvremove /dev/sda5
- Labels on physical volume "/dev/sda5" successfully wiped
- [root@rhel5 ~]# pvremove /dev/sda6
- Labels on physical volume "/dev/sda6" successfully wiped

评论声明
- 尊重网上道德,遵守中华人民共和国的各项有关法律法规
- 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
- 本站管理人员有权保留或删除其管辖留言中的任意内容
- 本站有权在网站内转���或引用您的评论
- 参与本评论即表明您已经阅读并接受上述条款
|
|
|
|