I'm moving a work project from RHEL 6 (Kernel 2.6.32) to RHEL 7 (Kernel 3.10.0).
The project involves the building of a raw disk image files to be used on virtual machines, these are representative of real hardware, but allow testing and development without using the target hardware.
When deploying software to the disks from the host operating system the raw files are attached to loop devices, and partitions are created. Some of them are raid 0 partitions. These partitions sometimes have the same label for disks that get attached to different virtual machines. For example I have four raw files, raw files 1 and 2 are attached to one VM, 3 and 4 are attached to another; however, I need a raid set on both disks where the partition label is "LOG."
This isn't a problem on RHEL 6. When attaching the loop device I have to run
kpartx -a /dev/loop0 and
kpartx -a /dev/loop1 if I want to assemble the raid device which is done with:
mdadm --assemble /dev/md/LOG --name LOG. The partitions for the loop device do not show up in
blkid until I use kpartx.
Doing the same in RHEL 7 is where things get tricky. Simply attaching the raw file as a loop device results in the partitions being detected. Using
blkid I am able to see the partitions for the loop devices, and when loading software the mdadm tool will see the partition labels 'LOG' on loop devices 0-3, and fail to assemble the raid set since partitions labeled LOG on loop 0 and 1 are different from partitions labeled LOG on loop 2 and 3.
I haven't found a way to prevent this using parameters in losetup. Is there a way to prevent detection of partitions on a loop device either via a kernel parameter or other config file?