免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1011 | 回复: 0
打印 上一主题 下一主题

LVM2 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-06-30 12:02 |只看该作者 |倒序浏览
Logical volumes can be created at installation time, however, the need sometimes arises to create new logical volumes after the installation.
To create a logical volume after install time we can do the following, for example:
We have disk partitions /dev/sda3, /dev/sdb1 and /dev/hda2 free for use and we want to create a volume group (VG) named test_vg for a Logical Volume Manager (LVM) partition.
  • Change the partition type for these 3 partitions to 0x8e with fdisk.
    See pvcreate(8) (man 8 pvcreate) which tells us that 0x8e identifies LVM partitions.
  • pvcreate /dev/sda3 /dev/sdb1 /dev/hda2
  • vgcreate test_vg /dev/sda3 /dev/sdb1 /dev/hda2 With our volume group test_vg now online, we can create logical volumes. For example, a logical volume with a size of 100 MB and standard name /dev/test_vg/lvol1 and another one named my_test_lv with size 200 MB striped (RAID 0) across all the three physical volumes.
  • lvcreate -L 100 test_vg
  • lvcreate -L 200 -n my_test_lv -i 3 test_vg Note that the command lvcreate -L 100 test_vg will create the logical volume named /dev/test_vg/lvol1 100 MB in size. The second command, lvcreate -L 200 -n my_test_lv -i 3 test_vg will create a logical volume named my_test_lv because we used the -n option. Also, the -i option gives the number of stripes which is equal to the number of physical volumes to scatter the logical volume, 3 in our case.
    Now we can create a file system on our arrays. For example, to create an ext2 file system on the LV my_test_lv:
    mkfs -t ext2 /dev/test_vg/my_test_lv
    You can then mount the LV using the mount command:
    mount /dev/test_vg/my_test_lv /usr1
    If you want this newly created LV to come up during the boot sequence, you can add the correct notation in the /etc/fstab file.

    本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/8793/showart_134682.html
  • 您需要登录后才可以回帖 登录 | 注册

    本版积分规则 发表回复

      

    北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
    未成年举报专区
    中国互联网协会会员  联系我们:huangweiwei@itpub.net
    感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

    清除 Cookies - ChinaUnix - Archiver - WAP - TOP