建立 Shared LVM

2013-07-04 11:40

 

1. 在 node1 上建立 LVM

 
[root@node1 ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created
[root@node1 ~]# vgcreate datavg /dev/sdb1
  Clustered volume group "datavg" successfully created
[root@node1 ~]# lvcreate -n datalv -L 10G datavg
  Error locking on node node2: Volume group for uuid not found: drQtmHJgZ4t6OH5b096iKUyHBU3x6RIVAfvXEPtf6shEf3bg6bgMWaligdOvFl6V
  Failed to activate new LV.
 

 

2. 到 node2 上建立 PV

 
 
建立之前
 
[root@node2 ~]# pvs
  PV         VG         Fmt  Attr PSize  PFree
  /dev/sda2  vg_centos6 lvm2 a--  39.51g    0
 
[root@node2 ~]# vgs
  VG         #PV #LV #SN Attr   VSize  VFree
  vg_centos6   1   2   0 wz--n- 39.51g    0
 
 
 
輸入 pvcreate /dev/sdb1
 
[root@node2 ~]# pvcreate /dev/sdb1
Can't initialize physical volume "/dev/sdb1" of volume group "datavg" without -ff
 
 
就會看到新的 PV、VG
 
[root@node2 ~]# pvs
  PV         VG         Fmt  Attr PSize  PFree
  /dev/sda2  vg_centos6 lvm2 a--  39.51g     0
  /dev/sdb1  datavg     lvm2 a--  60.00g 50.00g
 
[root@node2 ~]# vgs
  VG         #PV #LV #SN Attr   VSize  VFree
  datavg       1   1   0 wz--nc 60.00g 50.00g
  vg_centos6   1   2   0 wz--n- 39.51g     0
 
 

 

3. 在 node1 上就可以建立 LV 了

 
[root@node1 ~]# lvcreate -n datalv -L 10G datavg
Logical volume "datalv" created