码迷,mamicode.com
首页 > 其他好文 > 详细

如何创建LVM

时间:2015-12-02 18:53:40      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:lvm 逻辑卷管理


fdisk /dev/sd[abcd...] --> 8e --> pv --> vg --> lv


(1)、创建分区

fdisk /dev/sdb

p --> n --> p --> 1 --> 回车 --> 回车--> p --> t --> 8e --> p --> w



fdisk /dev/sdc

p --> n --> p --> 1 --> 回车 --> 回车--> p --> t --> 8e --> p --> w


fdisk /dev/sdd

p --> n --> p --> 1 --> 回车 --> 回车--> p --> t --> 8e --> p --> w



(2)、创建物理卷pv

可以通过pvscan 查看是否有物理卷及其信息


# pvcreate -v /dev/sdb1 /dev/sdc1 /dev/sdd1

    Set up physical volume for "/dev/sdb1" with 817885152 available sectors

    Zeroing start of device /dev/sdb1

    Writing physical volume data to disk "/dev/sdb1"

  Physical volume "/dev/sdb1" successfully created

    Set up physical volume for "/dev/sdc1" with 775939437 available sectors

    Zeroing start of device /dev/sdc1

    Writing physical volume data to disk "/dev/sdc1"

  Physical volume "/dev/sdc1" successfully created

    Set up physical volume for "/dev/sdd1" with 461370672 available sectors

    Zeroing start of device /dev/sdd1

    Writing physical volume data to disk "/dev/sdd1"

  Physical volume "/dev/sdd1" successfully created


(3)、创建卷组vg

-s 8M 指定PE为8M,默认为4M,只能为4M的整数倍

# vgcreate -v lvmvg /dev/sdb1 /dev/sdc1 /dev/sdd1

    Wiping cache of LVM-capable devices

    Adding physical volume ‘/dev/sdb1‘ to volume group ‘lvmvg‘

    Adding physical volume ‘/dev/sdc1‘ to volume group ‘lvmvg‘

    Adding physical volume ‘/dev/sdd1‘ to volume group ‘lvmvg‘

    Archiving volume group "lvmvg" metadata (seqno 0).

    Creating volume group backup "/etc/lvm/backup/lvmvg" (seqno 1).

  Volume group "lvmvg" successfully created


(4)、创建逻辑卷(LVM)

lvcreate [options] -L 大小 -n 逻辑卷名  卷组名


vgdisplay 查看vg的空间有多大

# lvcreate -L 979.98G -n lvmdata lvmvg

  Rounding up size to full physical extent 979.98 GiB

  Logical volume "lvmdata" created



(5)、创建文件系统

# mkfs.ext4 /dev/lvmvg/lvmdata



(6)、挂载磁盘分区

mkdir /oradata

blkid /dev/lvmvg/lvmdata

vi /etc/fstab

mount -a

df -h


via:http://blog.chinaunix.net/uid-20276248-id-92114.html

本文出自 “Unix-like” 博客,请务必保留此出处http://alipay.blog.51cto.com/7119970/1718834

如何创建LVM

标签:lvm 逻辑卷管理

原文地址:http://alipay.blog.51cto.com/7119970/1718834

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!