multipath, lvm, and you!
Today I went on a magical learning adventure. I learned about multipathing(I had no idea it was a thing). It changed my world in a strange and radical way, left me feeling like the universe was a much bigger place. Insert other cliche statement here.
Anyway, for those of you out there that are just as ignorant as I was, multipathing is a solution to a problem created by SANs/LUNs. Our SAN for example, provides us a few redundant paths to the same storage space, on one of our servers that may look like
# parted - # print devices /dev/sde (2147GB) /dev/sdf (2147GB) /dev/sdg (2147GB) /dev/sdh (2147GB)
All of those are 1 drive. How then would you determine which to format, which to work with on a daily basis? MULTIPATH!
by simply issuing “multipath -l” All the information you could hope for is revealed!
mpathg (3600015d00022d500000000000002b858) dm-5 XXX size=2.0T features='0' hwhandler='0' wp=rw |-+- policy='round-robin 0' prio=0 status=active | `- 1:0:0:0 sde 8:64 active undef running |-+- policy='round-robin 0' prio=0 status=enabled | `- 1:0:1:0 sdf 8:80 active undef running |-+- policy='round-robin 0' prio=0 status=enabled | `- 2:0:0:0 sdg 8:96 active undef running `-+- policy='round-robin 0' prio=0 status=enabled `- 2:0:1:0 sdh 8:112 active undef running
As you can see, the device “mpathg” (located under /dev/mapper/mpathg) is multipathed to “sde”, “sdf”, “sdg”, and “sdh”, it is also set to a multipath device of “dm-5” (located as /dev/dm-5).
Partitions created for this device will end up at “/dev/mapper/mpathgp#”.
Amazingly simple.
Now the LVM part: if your system is multipathing your devices, you MUST use the multipath location when dealing with them for lvm purposes, for example, I had a physical disk “/dev/sdb” that I wanted to add to my primary volume group, I formatted it, did all the necessary steps, issued “pvcreate /dev/sdb1” and got:
Device /dev/sdb1 not found (or ignored by filtering).
Instead I had to issue “pvcreate /dev/mapper/mpathbp1” which worked like a charm.
Such a simple bit of knowledge I know, but I was completely clueless about it for a long time. Remember kids, knowing is half the battle! (the other half of the battle…is…the battle.)