Wednesday, March 23, 2011

RHEL Mapper stealing Filesystem

Today, we've setup our RHEL server to use iSCSI with CHAP authentication to connect to our iSCSI array volumes. We found this tutorial very helpful, although instead of open-iscsi, we simply used RedHat's iscsi-initiator-utils package (probably the same thing).

One thing to note is that after successfully authenticating to the array via CHAP and partitioning the block (which was /dev/sdd) with LVM2, we could not successfully run the pvcreate /dev/sdd1 command to create a physical volume on which we can build our LVMs. When running pvcreate, we'd get the following:

#pvcreate /dev/sdd1
Can't open /dev/sdd1 exclusively. Mounted filesystem?

Although running 'mount' wouldn't show the drive mapped anywhere. As it turns out, after writing LVM2 to the partition table, /dev/mapper grabs onto the device which effectively "mounts" it within the mapper. In our case, it was listed in the mapper as three devices:

eql-0-8a0906-8a0b93e09-01120a256614d8a6-ora-data01p1
eql-0-8a0906-8a0b93e09-01120a256614d8a6-ora-data01
eql-0-8a0906-8a0b93e09-01120a256614d8a6_a


Note the long name referencing our Equillogic iSCSI SAN. We found two workarounds:

  1. Run pvcreate using the /dev/mapper/ name, so:
    #pvcreate /dev/mapper/eql-0-8a0906-8a0b93e09-01120a256614d8a6-ora-data01p1
    This was less desirable, however, because of the long file name
  2. Remove the device from the /dev/mapper and then run pvcreate:

    #dmsetup ls
    #dmsetup remove eql-0-8a0906-8a0b93e09-01120a256614d8a6-ora-data01p1
    #dmsetup remove eql-0-8a0906-8a0b93e09-01120a256614d8a6-ora-data01
    #dmsetup remove eql-0-8a0906-8a0b93e09-01120a256614d8a6_a
    #pvcreate /dev/sdd1
    Physical volume "/dev/sdd1" successfully created

That solved our problem, allowing us to create the physical volume and then create our LVMs on top of it. Thanks to this forum article for the tip.

No comments: