[linux-lvm] Scanning MD devices - bug or feature?

Dan Bar Dov danb at voltaire.com
Tue Jun 15 13:44:21 UTC 2004

I have a problem where LVM fails to create VGs from PVs I make on newly
created MDs.
After looking in the code it looks as if LVM (1.0.8 BTW) is relying on a
device cache, so that newly created devices 
are not accessible. It means that to use an MD device bt LVM, I need to
create the MD device and reboot.

Digging in the code I found that lvm_dir_cache is calling _scan_devs
either with TRUE or FALSE, _scan_devs on 
false scans only /dev/loop and /dev/nb, it does not re-scan /dev/md. In
addition, lvmdiskscan relies on the cache as well.

My first solution was to remove the if - make it scan all the devices
all the time, but that would exclude /dev/loop and nb from the search.
I'm now thinking to add /dev/md to the _notprocdir table.

Another problem I see but need to further investigate is that my
/dev/partitions is so huge that it gets binary characters in it, and
also the proc implementation is not handling the spill over page size

Any ideas/comments would be appreciated.

/* devices *not* showing up in /proc/partitions must be scanned anyway
static char *_noprocdir[] = {
        LVM_DIR_PREFIX "loop",
        LVM_DIR_PREFIX "nb",

int lvm_dir_cache(dir_cache_t **dir_cache_ptr)
        int ret = 0;
        debug_enter("lvm_dir_cache -- CALLED\n");

        if (!dir_cache_ptr) {
                ret = -LVM_EPARAM;
                goto out;

        if (!_dir_cache) {
                        _scan_devs( TRUE);
                        _scan_devs( FALSE);

More information about the linux-lvm mailing list