33

I connect an iSCSI target, create a Physical Volume and Volume Group on it.

Then I create an LV, and

mkfs.ext3 /dev/vg00/vm

and all that works great.

Then I disconnect the target

iscsiadm -m node -T iqn.2004-04.com.qnap:ts-509:iscsi.linux01.ba4731 -p 192.168.0.4 -u

login to another Linux server, and connect the target there

iscsiadm -m node -T iqn.2004-04.com.qnap:ts-509:iscsi.linux01.ba4731 -p 192.168.0.4 -l

and I get:

linux01:~ # lvdisplay 
  --- Logical volume ---
  LV Name                /dev/vg00/vm
  VG Name                vg00
  LV UUID                NBNRGV-FkSR-ZNZ9-9AVk-chLQ-j5nc-RazeBw
  LV Write Access        read/write
  LV Status              NOT available
      LV Size                17.00 GB
  Current LE             4352
  Segments               1
  Allocation             inherit
  Read ahead sectors     0

I can see that /dev/vg00/vm doesn't exist, as I would have expected.

What am I doing wrong?

Sandra
  • 9,973
  • 37
  • 104
  • 160

2 Answers2

50

You need to activate a volume group after you attached it.

To activate all the inactive volumes on the system you would use a command like vgchange -a y.

Zoredache
  • 128,755
  • 40
  • 271
  • 413
10

When you connect the target to the new system, the lvm subsystem needs to be notified that a new physical volume is available. You may need to call pvscan, vgscan or lvscan manually. Or you may need to call vgimport vg00 to tell the lvm subsystem to start using vg00, followed by vgchange -ay vg00 to activate it. Possibly you should do the reverse, i.e., vgchange -an vg00; vgexport vg00 before detaching the target.

(I don't know anything about iSCSI, so maybe these steps are not necessary or should have been performed automatically by the iSCSI tools.)