lvm cluster

[root@localhost ~]# fdisk /dev/sdb
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): n
Partition number (1-128, default 1):
First sector (34-20971486, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-20971486, default 20971486): +512MB                                     
Created partition 1


Command (m for help): wq
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# pvcreate /dev/sdb1
WARNING: ext4 signature detected on /dev/sdb1 at offset 1080. Wipe it? [y/n]: y
  Wiping ext4 signature on /dev/sdb1.
  Physical volume "/dev/sdb1" successfully created.
[root@localhost ~]# vgcreate vg /dev/sdb1
  Volume group "vg" successfully created
[root@localhost ~]# lvcreate -L 500M -n lv vg
  Volume group "vg" has insufficient free space (121 extents): 125 required.
[root@localhost ~]# lvcreate -L 450M -n lv vg
  Rounding up size to full physical extent 452.00 MiB
  Logical volume "lv" created.
[root@localhost ~]#  mkfs.xfs /dev/vg/lv
meta-data=/dev/vg/lv             isize=512    agcount=4, agsize=28928 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=115712, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=855, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@localhost ~]# lvs
  LV   VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root centos -wi-ao---- <26.00g                                                 
  swap centos -wi-ao----   3.00g                                                 
  lv   vg     -wi-a----- 452.00m                                                 
[root@localhost ~]# vgs
  VG     #PV #LV #SN Attr   VSize   VFree
  centos   1   2   0 wz--n- <29.00g     0
  vg       1   1   0 wz--n- 484.00m 32.00m
[root@localhost ~]# lvmconf --enable-halvm --services --startstopservices
Warning: Stopping lvm2-lvmetad.service, but it can still be activated by:
  lvm2-lvmetad.socket
Removed symlink /etc/systemd/system/sysinit.target.wants/lvm2-lvmetad.socket.
[root@localhost ~]# lvmconf --enable-halvm
[root@localhost ~]#  systemctl disable lvm2-lvmetad.service
[root@localhost ~]# systemctl disable lvm2-lvmetad.socket
[root@localhost ~]# systemctl stop lvm2-lvmetad.service
[root@localhost ~]# systemctl stop lvm2-lvmetad.socket
[root@localhost ~]# chkconfig lvm2-lvmetad off
Note: Forwarding request to 'systemctl disable lvm2-lvmetad.service'.
[root@localhost ~]# service lvm2-lvmetad stop
Redirecting to /bin/systemctl stop lvm2-lvmetad.service

[root@localhost ~]# cat  /etc/lvm/lvm.conf
volume_list = [ centos ]

[root@localhost ~]# vgs
  VG     #PV #LV #SN Attr   VSize   VFree 
  centos   1   2   0 wz--n- <29.00g     0 
  vg       1   1   0 wz--n- 484.00m 32.00m
ERROR example:
# vgimport /dev/mapper/mpath-c0t5000CCA027C3225Cd0
  connect() failed on local socket: Connection refused
  WARNING: Falling back to local file-based locking.
  Volume Groups with the clustered attribute will be inaccessible.
  Skipping clustered volume group vgclu1


SOLUTION

Check that volume group has clusterd attribute
   # vgs --config 'global {locking_type = 0}'
  WARNING: Locking disabled. Be careful! This could corrupt your metadata.
  VG     #PV #LV #SN Attr   VSize  VFree
  vgclu1  1   1   0 wz--nc 96.00M 76.00M       <----- Attr includes the 'c' flag meaning clustered.

Make sure that this volume group not using cluster software, for e.x. Redhat Cluster Suite.



Force take over clusger volume group
 # vgchange -cn vgclu1 --config 'global {locking_type = 0}'
  WARNING: Locking disabled. Be careful! This could corrupt your metadata.
  Volume group "vgname" successfully changed
# vgchange -ay vgclu1
  WARNING: After making this change, you must not activate the volume group on more than one server at a time or LVM metadata corruption can occur (even if no changes are made).


To temporarily activate the volume group, but leave it clustered, use the following command:
 # vgchange -ay vgclu1 --config 'global { locking_type = 0 }'
  WARNING: Locking disabled. Be careful! This could corrupt your metadata.
  1 logical volume(s) in volume group "vgclu1" now active

Comments

Popular posts from this blog

ansible redhat cluster qorum qdevice

PE 3.9.0 on centos 6

gfs2 cluster