LVM With Dmraid

When adding a new disk for a customer running CentOS 4.7 on severely old hardware, I bumped into something I’ve never had happening to me before. Basically the system wouldn’t let me create the Physical Volume and gave me this message:

1
2
[root@gwyneth ~]# pvcreate /dev/hdc1
Can't open /dev/hdc1 exclusively.  Mounted filesystem?

hdc1 was obviously not mounted or in any other way used. Or so I thought. As I was flicking through the loaded kernel modules, I saw the dm_* modules being loaded and I was quite sure I knew what it was at that point. dmraid is hogging the disk. I verified that dmraid was indeed aware of the new disk with:

1
2
[root@gwyneth ~]# dmraid -r
/dev/hdc: pdc, "pdc_hceidaeha", mirror, ok, 78125000 sectors, data@ 0

So deactivating the (in)appropriate RAID set:

1
2
3
[root@gwyneth ~]# dmraid -a no pdc
[root@gwyneth ~]# pvcreate /dev/hdc1
Physical volume "/dev/hdc1" successfully created

Obviously, if you currently aren’t or don’t plan on ever run any software RAID setup (which you shouldn’t on a server in my opinion), you do best in removing the dmraid package altogether to avoid the same or similar problems in the future.

Jul 15th, 2008