CentOS 5.2+Raid 0+LVM+ISCSI配置详解(2)

二、 配置 LVM ;
 
要配置 LVM ,可以按以下步骤进行:
1.        创建和初始化物理卷( Physical Volume ),通过 pvcreate 建立 pv ,即 pv 阶段;
2.        添加物理卷到卷组( Volume Group ),使用 vgcreate 加入多个 pv 成为 vg ,即 vg 阶段;
3.        在卷组上创建逻辑卷( logical volume ),使用 lvcreate 划分 vg, 成为一个或多个 lv, 即 lv 阶段;
 
# pvcreate /dev/md0       # 创建 PV
  Physical volume "/dev/md0" successfully created
 
# pvscan
  PV /dev/md0   VG LVM1   lvm2 [1.82 TB / 1.82 GB free]
  Total: 1 [1.82 TB] / in use: 1 [1.82 TB] / in no VG: 0 [0   ]
 
# vgcreate LVM1 /dev/md0   # 创建 VG
  Volume group "LVM1" successfully created
 
# vgdisplay   LVM1  
  --- Volume group ---
  VG Name               LVM1
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               1.82 TB
  PE Size                4.00 MB
  Total PE              476933
  Alloc PE / Size       0 / 0  
  Free  PE / Size       476933 / 1.82 TB
  VG UUID               97Fecv-lBFP-oB19-dfrF-wJ7y-9KJ9-9sIKYG
 
# lvcreate -L 1.5TB -n data1 LVM1     # 创建 LV
  /dev/cdrom: open failed: Read-only file system
  Logical volume "data1" created
 
# lvcreate -L 325GB -n data2 LVM1   # 创建 LV
  /dev/cdrom: open failed: Read-only file system
  Logical volume "data2" created
 
# lvscan                   # 查看 LV 信息
  ACTIVE            '/dev/LVM1/data1' [1.50 TB] inherit
  ACTIVE            '/dev/LVM1/data2' [325.00 GB] inherit
 
# pvscan                  # 再次查看 PV 信息
  PV /dev/md0   VG LVM1   lvm2 [1.82 TB / 2.02 GB free]
  Total: 1 [1.82 TB] / in use: 1 [1.82 TB] / in no VG: 0 [0   ]
 
# vgdisplay LVM1       # 再次查看 VG 信息
 
  --- Volume group ---
  VG Name               LVM1
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  VG Access             read/write
  VG Status              resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               1.82 TB
  PE Size               4.00 MB
  Total PE               476933
  Alloc PE / Size       476416 / 1.82 TB
  Free  PE / Size       517 / 2.02 GB
  VG UUID               97Fecv-lBFP-oB19-dfrF-wJ7y-9KJ9-9sIKYG

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wyzdfg.html