vgcreate doesn't work with lvmlockd running
Hi all,
I am new to lvm. When I was trying to create a shared VG (vgcreate --shared <vg_name> /dev/sdb1 /dev/sdc1) in my system and I received the "device not cleared" error with sanlock and lvmlockd running. I've searched the internet but nothing has solved my problem. So I'm here to ask for your help.
root@n151-143-035:~# lvmlockd -V lvmlockd version: 2.03.02(2) (2018-12-18) root@n151-143-035:~# sanlock -V sanlock 3.6.0 (built Jul 11 2018 12:44:29)
root@n151-143-035:~# systemctl status sanlock
● sanlock.service - Shared Storage Lease Manager
Loaded: loaded (/lib/systemd/system/sanlock.service; disabled;
vendor preset: enabled)
Active: active (running) since Thu 2022-05-05 00:31:17 CST; 11h ago
Process: 25844 ExecStart=/usr/sbin/sanlock daemon $sanlock_opts
(code=exited, status=0/SUCCESS)
Main PID: 25850 (sanlock)
Tasks: 6 (limit: 6143)
CGroup: /system.slice/sanlock.service
├─25850 /usr/sbin/sanlock daemon -w 0
└─25852 /usr/sbin/sanlock daemon -w 0
May 05 00:31:17 n151-143-035 systemd[1]: Starting Shared Storage Lease Manager...
May 05 00:31:17 n151-143-035 systemd[1]: Started Shared Storage Lease Manager.root@n151-143-035:~# systemctl status lvmlockd
● lvmlockd.service - LVM lock daemon
Loaded: loaded (/lib/systemd/system/lvmlockd.service; enabled;
vendor preset: enabled)
Active: active (running) since Thu 2022-05-05 00:31:23 CST; 11h ago
Docs: man:lvmlockd(8)
Main PID: 26152 (lvmlockd)
Tasks: 3 (limit: 6143)
CGroup: /system.slice/lvmlockd.service
└─26152 /sbin/lvmlockd --foreground
May 05 00:31:23 n151-143-035 systemd[1]: Starting LVM lock daemon...
May 05 00:31:23 n151-143-035 lvmlockd[26152]: [D] creating /run/lvm/lvmlockd.socket
May 05 00:31:23 n151-143-035 lvmlockd[26152]: 1651681883 lvmlockd started
May 05 00:31:23 n151-143-035 systemd[1]: Started LVM lock daemon.root@n151-143-035:~# pvs Skipping global lock: lockspace not found or started root@n151-143-035:~# pvcreate /dev/mapper/mpatha1 Global lock failed: check that global lockspace is started root@n151-143-035:~# pvs Skipping global lock: lockspace not found or started
It is mentioned in the main page under "creating the first sanlock VG" that the first VG is created to get the global lock, so I create the VG directly:
root@n151-143-035:~# vgcreate --lock-type sanlock --shared test /dev/mapper/mpatha1 --verbose
Enabling sanlock global lock
Wiping signatures on new PV /dev/mapper/mpatha1.
Set up physical volume for "/dev/mapper/mpatha1" with 2147483648
available sectors.
Zeroing start of device /dev/mapper/mpatha1.
Writing physical volume data to disk "/dev/mapper/mpatha1".
Physical volume "/dev/mapper/mpatha1" successfully created.
Adding physical volume '/dev/mapper/mpatha1' to volume group 'test'
Archiving volume group "test" metadata (seqno 0).
Creating logical volume lvmlock
Creating volume group backup "/etc/lvm/backup/test" (seqno 2).
Activating logical volume test/lvmlock.
activation/volume_list configuration setting not defined: Checking
only host tags for test/lvmlock.
Creating test-lvmlock
Loading table for test-lvmlock (254:1).
Resuming test-lvmlock (254:1).
/dev/test/lvmlock: not found: device not cleared
Aborting. Failed to wipe start of new LV.
Removing test-lvmlock (254:1)
Creating volume group backup "/etc/lvm/backup/test" (seqno 3).
Failed to create sanlock lv lvmlock in vg test
Failed to create internal lv.
Failed to initialize lock args for lock type sanlock
Removing physical volume "/dev/mapper/mpatha1" from volume group "test"
Volume group "test" successfully removed
root@n151-143-035:~# pvs
Skipping global lock: lockspace not found or started
PV VG Fmt Attr PSize PFree
/dev/mapper/mpatha1 lvm2 --- 1.00t 1.00t
root@n151-143-035:~# vgs
Skipping global lock: lockspace not found or startedI set use_lvmlockd = 1 in the configuration file /etc/lvm/lvm.conf and did not find useful log information in /var/log/syslog and /var/log /sanlock.log. And I can successfully use and create lvm when use_lvmlockd = 0.
Regards,
Zhiyong Ye
_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
Quoted 11 lines · Zhiyong Ye
root@n151-143-035:~# lvmlockd -V lvmlockd version: 2.03.02(2) (2018-12-18) root@n151-143-035:~# sanlock -V sanlock 3.6.0 (built Jul 11 2018 12:44:29)It is mentioned in the main page under "creating the first sanlock VG" that the first VG is created to get the global lock, so I create the VG directly:
root@n151-143-035:~# vgcreate --lock-type sanlock --shared test /dev/mapper/mpatha1 --verbose
This is correct.
Quoted 11 lines
Enabling sanlock global lock
Wiping signatures on new PV/dev/mapper/mpatha1.
Set up physical volume for "/dev/mapper/mpatha1" with 2147483648
available sectors.
Zeroing start of device/dev/mapper/mpatha1.
Writing physical volume data to disk "/dev/mapper/mpatha1".
Physical volume "/dev/mapper/mpatha1" successfully created.
Adding physical volume '/dev/mapper/mpatha1' to volume group 'test' Archiving volume group "test" metadata (seqno 0). Creating logical volume lvmlock
Creating volume group backup "/etc/lvm/backup/test" (seqno 2).
Quoted 8 lines
Activating logical volume test/lvmlock. activation/volume_list configuration setting not defined: Checking only
host tags for test/lvmlock.
Creating test-lvmlock
Loading table for test-lvmlock (254:1).
Resuming test-lvmlock (254:1).
/dev/test/lvmlock: not found: device not cleared
Aborting. Failed to wipe start of new LV.
This looks like a bug, and it does look familiar. I'd guess that section of code is missing a call to synchronize with udev (sync_local_dev_names). Unfortunately your version of lvm (and sanlock) are old enough that it's hard to say immediately if it's fixed. The best option would be trying newer versions where it's most likely been fixed.
Dave
_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
Hi David,
Thanks for your reply and detailed answer. It is true that It works fine with the latest version of lvm as you said.
Thanks again!
Zhiyong
Quoted 35 lines · David Teigland
Quoted 11 lines · Zhiyong Ye
root@n151-143-035:~# lvmlockd -V lvmlockd version: 2.03.02(2) (2018-12-18) root@n151-143-035:~# sanlock -V sanlock 3.6.0 (built Jul 11 2018 12:44:29)It is mentioned in the main page under "creating the first sanlock VG" that the first VG is created to get the global lock, so I create the VG directly:
root@n151-143-035:~# vgcreate --lock-type sanlock --shared test /dev/mapper/mpatha1 --verboseThis is correct.
Quoted 11 lines
Enabling sanlock global lock
Wiping signatures on new PV/dev/mapper/mpatha1.
Set up physical volume for "/dev/mapper/mpatha1" with 2147483648
available sectors.
Zeroing start of device/dev/mapper/mpatha1.
Writing physical volume data to disk "/dev/mapper/mpatha1".
Physical volume "/dev/mapper/mpatha1" successfully created.
Adding physical volume '/dev/mapper/mpatha1' to volume group 'test' Archiving volume group "test" metadata (seqno 0). Creating logical volume lvmlock
Creating volume group backup "/etc/lvm/backup/test" (seqno 2).Quoted 8 lines
Activating logical volume test/lvmlock. activation/volume_list configuration setting not defined: Checking only
host tags for test/lvmlock.
Creating test-lvmlock
Loading table for test-lvmlock (254:1).
Resuming test-lvmlock (254:1).
/dev/test/lvmlock: not found: device not cleared
Aborting. Failed to wipe start of new LV.
Quoted 8 lines
This looks like a bug, and it does look familiar. I'd guess that section of code is missing a call to synchronize with udev (
sync_local_dev_names). Unfortunately your version of lvm (and sanlock) are old enough that it's hard to say immediately if it's fixed. The best option would be trying newer versions where it's most likely been fixed.Dave
_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/