iSCSI and LVM: Boot problem

Both LVM and iSCSI are powerful and reliable. But there is an issue with the combination of both that made me fell completely lost more than once.

The Scenario:
iSCSI target / server is a Linux Box with LVM features
iSCSI target / server exports disk, partition or LVM LV
iSCSI initiator / client uses the exported volume as LVM PV
All works perfectly until rebooting the iSCSI target / server

The symptom:
After rebooting the iSCSI target / server, it becomes impossible for the initiator / client use the exported volume as if it were deleted. The iSCSI target / server service itself is working properly but the exported volume is not.

The cause:
During the boot of the iSCSI target / server, its LVM liked the new found PVs / VGs / LVs. The iSCSI target / server has no idea about those new found are not for the local machine and it "locks" the VGs and LVs for local use. When iSCSI exports the LV, it will contain locked LVM volumes. This is why it becomes impossible to use it on the iSCSI initiator / client.

The solution:
It is very easy. Edit /etc/lvm/lvm.conf and use "filters" to tell LVM what is not for local use. My filter is configured as:

filter = [ "a/sda/", "r/.*/" ]

For testing, just type pvscan after editing the file to see if the filter worked as expected. If so, just reboot and it will work.

Please note that using sda on the filter is not the safest solution as it is not impossible that sda becomes sdb for example. It will be safer to use UUIDs of something else.


Anonymous said…
Thank you, this resolved my issue with running: `/usr/sbin/tgt-admin -e` and it failing: "exited with code: 72057594037927935." In addition I would see tgtd segfault in demsg. Also my LUN would never show up (after rebooting the server) when I ran `/usr/sbin/tgtadm --lld iscsi --op show --mode target` until I added the LVM filter and rebooted.

Popular posts from this blog

Fedora: Booting Fedora LIVE to RAM

Benchmark: Core 2 Duo T7200 vs. Core i7 2620M

Five steps to create Fedora chroot jail using yum